Merge remote-tracking branch 'upstream/master'
diff --git a/.gitignore b/.gitignore
index 3c5748b..dd8d359 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
*.class
.classpath
.project
+.pydevproject
target
onos-logs
-onos.log
\ No newline at end of file
+onos.log
+repo
+
diff --git a/README.md b/README.md
index 6e65f51..9f2c040 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,120 @@
-ONOS
-====
+ONOS (Open Networking Operating System)
+=======================================
-Open Networking Operating System
\ No newline at end of file
+ONOS (Open Networking Operating System) is an experimental distributed
+SDN OS. Currently, it is under active development. ONOS was announced
+and demonstrated at ONS'13.
+
+Steps to download and setup a development Virtual Machine
+==========================================
+
+http://wiki.onlab.us/display/Eng/ONOS+Development+VM
+
+Building ONOS
+-------------
+
+0. Install custom jars and dependencies (needs to be run only once)
+
+ $ ./setup-local-maven.sh
+
+1. Cleanly build ONOS
+
+ $ mvn clean
+ $ mvn compile
+
+ NOTE: installing maven for the first time may switch java version
+ from 1.7 to 1.6. This might prevent Cassandra to run.
+
+Dependencies
+------------
+1. Zookeeper
+
+ Download and install apache-zookeeper-3.4.5:
+ http://zookeeper.apache.org/releases.html
+
+ Edit file `(ONOS-INSTALL-DIR)/start-zk.sh` and set variable "ZK_DIR"
+ to point to the Zookeeper directory.
+
+2. Cassandra
+
+ Download and install apache-cassandra-1.2.4:
+ http://cassandra.apache.org/download/
+
+ Edit file `(ONOS-INSTALL-DIR)/start-cassandra.sh` and set variable
+ "CASSANDRA_DIR" to point to the Cassandra directory.
+
+Running ONOS with Cassandra as a separate process
+-------------------------------------------------
+[See below for information how to run ONOS with Embedded Cassandra]
+
+1. Start Zookeeper
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-zk.sh start
+
+ ## Confirm Zookeeper is running:
+ $ ./start.zk.sh status
+
+2. Start Cassandra
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-cassandra.sh start
+
+ ## Confirm Cassandra is running:
+ $ ./start-cassandra.sh status
+
+3. Start ONOS
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-onos.sh start
+
+ ## Confirm ONOS is running:
+ $ ./start-onos.sh status
+
+4. Start ONOS REST API server
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-rest.sh start
+
+ ## Confirm the REST API server is running:
+ $ ./start-rest.sh status
+
+Running ONOS with Cassandra embedded (Optional)
+-----------------------------------------------
+
+1. Start Zookeeper
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-zk.sh start
+
+ ## Confirm Zookeeper is running:
+ $ ./start.zk.sh status
+
+2. Start ONOS and Cassandra embedded
+
+ $ cd (ONOS-INSTALL_DIR)/
+ $ ./start-onos-embedded.sh start
+
+ ## Confirm ONOS is running:
+ $ ./start-onos-embedded.sh status
+
+3. Start ONOS REST API server
+
+ $ cd (ONOS-INSTALL-DIR)/
+ $ ./start-rest.sh start
+
+ ## Confirm the REST API server is running:
+ $ ./start-rest.sh status
+
+
+Running in offline mode (Optional)
+----------------------------------
+
+Maven is used to build and run ONOS. By default, maven tries to reach
+the repositories. The '-o' option can be given to the 'mvn' command to
+suppress this behavior. The `MVN` environmental variable can be used to
+set additional options to the 'mvn' command used in ONOS.
+
+* Example: Running in offline mode
+
+ $ env MVN="mvn -o" ./start-onos.sh start
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 4aa99bf..0000000
--- a/build.xml
+++ /dev/null
@@ -1,310 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-
- <!--
- Copyright 2011, Big Switch Networks, Inc.
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!--
- The build uses pregenerated Thrift code by default to reduce build
- dependencies. To generate it locally run the gen-thrift target.
- If you change the Thrift files be sure to also commit the updated
- generated code.
--->
-
-<project default="dist" name="Floodlight">
- <property name="target" location="target"/>
- <property name="build" location="${target}/bin"/>
- <property name="build-test" location="${target}/bin-test"/>
- <property name="build-coverage" location="${target}/bin-coverage"/>
- <property name="test-output" location="${target}/test"/>
- <property name="coverage-output" location="${target}/coverage"/>
- <property name="source" location="src/main/java"/>
- <property name="resources" location="src/main/resources/"/>
- <property name="source-test" location="src/test/java"/>
- <property name="python-src" location="src/main/python"/>
- <property name="docs" location="${target}/docs"/>
- <property name="main-class" value="net.floodlightcontroller.core.Main"/>
- <property name="floodlight-jar" location="${target}/floodlight.jar"/>
- <property name="floodlight-test-jar" location="${target}/floodlight-test.jar"/>
- <property name="floodlight-only-jar" location="${target}/floodlight-only.jar"/>
- <property name="thrift.dir" value="${basedir}/src/main/thrift"/>
- <property name="thrift.out.dir" value="lib/gen-java"/>
- <property name="thrift.package" value="net/floodlightcontroller/packetstreamer/thrift"/>
- <property name="ant.build.javac.source" value="1.6"/>
- <property name="ant.build.javac.target" value="1.6"/>
- <property name="lib" location="lib"/>
- <property name="titanlib" location="lib/titan/"/>
-
- <patternset id="lib">
- <include name="logback-classic-1.0.0.jar"/>
- <include name="logback-core-1.0.0.jar"/>
- <include name="jackson-core-asl-1.9.11.jar"/>
- <include name="jackson-mapper-asl-1.9.11.jar"/>
- <include name="slf4j-api-1.6.4.jar"/>
- <include name="org.restlet-2.1-RC1.jar"/>
- <include name="org.restlet.ext.jackson-2.1-RC1.jar"/>
- <include name="org.restlet.ext.simple-2.1-RC1.jar"/>
- <include name="org.restlet.ext.slf4j-2.1-RC1.jar"/>
- <include name="simple-4.1.21.jar"/>
- <include name="netty-3.2.6.Final.jar"/>
- <include name="args4j-2.0.16.jar"/>
- <include name="concurrentlinkedhashmap-lru-1.3.jar"/>
- <include name="jython-2.5.2.jar"/>
- <include name="libthrift-0.7.0.jar"/>
- <include name="curator-client-1.3.1.jar"/>
- <include name="curator-framework-1.3.1.jar"/>
- <include name="curator-recipes-1.3.1.jar"/>
- </patternset>
-
- <patternset id="titanlib">
- <include name="**/*.jar"/>
- </patternset>
-
- <path id="classpath">
- <fileset dir="${lib}">
- <patternset refid="lib"/>
- </fileset>
- <fileset dir="${titanlib}">
- <patternset refid="titanlib"/>
- </fileset>
- </path>
-
- <patternset id="lib-cobertura">
- <include name="cobertura-1.9.4.1.jar"/>
- <include name="asm-3.0.jar"/>
- <include name="asm-tree-3.0.jar"/>
- <include name="oro/jakarta-oro-2.0.8.jar"/>
- <include name="log4j-1.2.9.jar"/>
- </patternset>
- <path id="classpath-cobertura">
- <fileset dir="${lib}">
- <patternset refid="lib-cobertura"/>
- </fileset>
- </path>
-
- <patternset id="lib-test">
- <include name="junit-4.8.2.jar"/>
- <include name="org.easymock-3.1.jar"/>
- <include name="objenesis-1.2.jar"/> <!-- required by easymock to mock classes -->
- <include name="cglib-nodep-2.2.2.jar"/> <!-- required by easymock to mock classes -->
- </patternset>
- <path id="classpath-test">
- <fileset dir="${lib}">
- <patternset refid="lib-test"/>
- <patternset refid="lib-cobertura"/>
- <patternset refid="lib"/>
- <patternset refid="titanlib"/>
- </fileset>
- </path>
-
- <target name="init">
- <mkdir dir="${build}"/>
- <mkdir dir="${build-test}"/>
- <mkdir dir="${target}/lib"/>
- <mkdir dir="${thrift.out.dir}"/>
- <mkdir dir="${test-output}"/>
- </target>
-
- <target name="compile" depends="init">
- <javac includeAntRuntime="false"
- classpathref="classpath"
- debug="true"
- srcdir="${source}:${thrift.out.dir}"
- destdir="${build}">
- </javac>
- </target>
-
- <target name="compile-tests" depends="compile-test"/>
- <target name="compile-test" depends="compile">
- <fileset dir="${resources}"/>
- <javac includeAntRuntime="false" debug="true"
- srcdir="${source-test}"
- classpath="${build}"
- classpathref="classpath-test"
- destdir="${build-test}"/>
- </target>
-
- <!-- Thrift build based on http://www.flester.com/blog/2009/04/26/using-thrift-from-ant -->
- <fileset id="thrift.files" dir="${thrift.dir}">
- <include name="**/*.thrift"/>
- </fileset>
-
- <target name="gen-thrift" depends="init">
- <pathconvert property="thrift.file.list" refid="thrift.files"
- pathsep=" " dirsep="/">
- </pathconvert>
- <echo message="Running thrift generator on ${thrift.file.list}"/>
- <exec executable="thrift" dir="${basedir}" failonerror="true">
- <arg line="--strict -v --gen java -o ${thrift.out.dir}/.. ${thrift.file.list}"/>
- </exec>
- <!-- Get rid of annoying warnings in thrift java: at annotations -->
- <echo message="Adding @SuppressWarning annotations"/>
- <replaceregexp byline="true">
- <regexp pattern="^public "/>
- <substitution expression='@SuppressWarnings("all") public '/>
- <fileset id="thrift.output.files" dir="${thrift.out.dir}/..">
- <include name="**/*.java"/>
- </fileset>
- </replaceregexp>
- </target>
-
- <target name="clean">
- <delete dir="${target}"/>
- </target>
-
- <target name="run" depends="dist">
- <java fork="true" jar="${floodlight-jar}" classpathref="classpath">
- <jvmarg value="-server"/>
- <jvmarg value="-Xms1024M"/>
- <jvmarg value="-Xmx1024M"/>
- </java>
- </target>
-
- <target name="tests" depends="test"/>
- <target name="test" depends="compile-test">
- <junit fork="true" forkmode="once"
- failureproperty="junit.failure"
- printsummary="on">
- <sysproperty key="net.sourceforge.cobertura.datafile"
- file="${target}/cobertura.ser" />
- <classpath>
- <pathelement location="${build-coverage}"/>
- <pathelement location="${build}"/>
- <pathelement location="${build-test}"/>
- <pathelement location="${floodlight-jar}"/>
- <path refid="classpath-test"/>
- </classpath>
- <formatter type="brief" usefile="true" />
- <batchtest todir="${test-output}">
- <fileset dir="${source-test}">
- <exclude name="**/storage/tests/StorageTest.java"/>
- <include name="**/*Test*.java"/>
- <exclude name="**/core/test/**"/>
- <exclude name="**/core/module/**"/>
- </fileset>
- </batchtest>
- </junit>
- <fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
- </target>
-
- <taskdef classpathref="classpath-cobertura" resource="tasks.properties"/>
- <target name="clean-instrument">
- <delete file="${target}/cobertura.ser"/>
- <delete dir="${build-coverage}"/>
- </target>
- <target name="instrument" depends="compile,compile-test,clean-instrument">
- <cobertura-instrument datafile="${target}/cobertura.ser"
- todir="${build-coverage}"
- classpathref="classpath-cobertura">
- <fileset dir="${build}">
- <include name="**/*.class"/>
- </fileset>
- </cobertura-instrument>
- </target>
- <target name="coverage-report">
- <cobertura-report format="html"
- datafile="${target}/cobertura.ser"
- destdir="${coverage-output}"
- srcdir="${source}"/>
- <cobertura-report format="xml"
- datafile="${target}/cobertura.ser"
- destdir="${coverage-output}"
- srcdir="${source}"/>
- </target>
- <target name="coverage" depends="instrument,test,coverage-report"/>
-
- <target name="jar" depends="compile">
- <jar destfile="${floodlight-only-jar}">
- <fileset dir="${build}"/>
- <fileset dir="${resources}"/>
- <fileset dir="${python-src}">
- <include name="**/*.py"/>
- </fileset>
- </jar>
- </target>
-
- <target name="dist" depends="compile,compile-test">
- <jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain">
- <manifest>
- <attribute name="Main-Class" value="${main-class}"/>
- <attribute name="Class-Path" value="."/>
- </manifest>
- <fileset dir="${build}"/>
- <fileset dir="${resources}"/>
- <fileset dir="${python-src}">
- <include name="**/*.py"/>
- </fileset>
- <zipgroupfileset dir="${titanlib}">
- <patternset refid="titanlib"/>
- </zipgroupfileset>
- <zipgroupfileset dir="${lib}">
- <patternset refid="lib"/>
- </zipgroupfileset>
- </jar>
- <jar destfile="${floodlight-test-jar}" filesetmanifest="mergewithoutmain">
- <manifest>
- <attribute name="Class-Path" value="."/>
- </manifest>
- <fileset dir="${build-test}"/>
- <fileset dir="${resources}"/>
- <zipgroupfileset dir="${lib}">
- <patternset refid="lib-test"/>
- <patternset refid="lib-cobertura"/>
- </zipgroupfileset>
- <zipgroupfileset dir="${titanlib}">
- <patternset refid="titanlib"/>
- </zipgroupfileset>
- </jar>
- </target>
-
- <target name="javadoc">
- <javadoc access="protected"
- author="true"
- classpathref="classpath"
- destdir="${docs}"
- doctitle="Floodlight"
- nodeprecated="false"
- nodeprecatedlist="false"
- noindex="false"
- nonavbar="false"
- notree="false"
- source="1.6"
- sourcepath="${source}"
- splitindex="true"
- use="true"
- version="true"/>
- </target>
-
- <target name="eclipse" depends="init">
- <pathconvert property="eclipse-lib">
- <map from="${basedir}/" to=""/>
- <fileset dir="${lib}">
- <patternset refid="lib"/>
- <patternset refid="lib-test"/>
- </fileset>
- <fileset dir="${titanlib}">
- <patternset refid="titanlib"/>
- </fileset>
- </pathconvert>
- <exec executable="${basedir}/setup-eclipse.sh">
- <arg value="${main-class}"/>
- <arg value="${eclipse-lib}"/>
- </exec>
- </target>
-
-</project>
diff --git a/cassandra.titan b/cassandra.titan
deleted file mode 100644
index ef6f3ae..0000000
--- a/cassandra.titan
+++ /dev/null
@@ -1,3 +0,0 @@
-storage.backend=cassandra
-storage.hostname=localhost
-storage.keyspace=onos
diff --git a/cluster-mgmt/README.txt b/cluster-mgmt/README.txt
new file mode 100644
index 0000000..08380d2
--- /dev/null
+++ b/cluster-mgmt/README.txt
@@ -0,0 +1,22 @@
+########
+Cluster Management Tools
+#######
+
+ssh : contains necessary files in .ssh (don't change file permission)
+bash_profile: Can be used as $HOME/.bash_profile file. The following four lines needs to be changed as necessary
+
+export RCP_USER=ubuntu
+export RCMD_CMD=ssh
+export RCMD_CMD_ARGS="-i $HOME/.ssh/onlabkey.pem"
+export RCMD_USER=ubuntu
+export RCP_CMD="scp -i $HOME/.ssh/onlabkey.pem -o StrictHostKeyChecking=no"
+export FANOUT=64
+export CLUSTER="$HOME/bin/cluster.txt"
+
+### Set the proper value ##
+export ONOS_CLUSTER_BASENAME="onosdevx"
+export ONOS_CLUSTER_NR_NODES=8
+
+bin/start.sh : shutdown all service and restart
+bin/stop.sh : shutdown all service
+bin/status.sh : show status of the services
diff --git a/cluster-mgmt/bash_profile b/cluster-mgmt/bash_profile
new file mode 100644
index 0000000..e9f2a39
--- /dev/null
+++ b/cluster-mgmt/bash_profile
@@ -0,0 +1,25 @@
+# .bash_profile
+
+# Get the aliases and functions
+if [ -f ~/.bashrc ]; then
+ . ~/.bashrc
+fi
+
+# User specific environment and startup programs
+
+PATH=$PATH:$HOME/bin
+
+export PATH
+
+### Cluster-IT setting##
+export RCP_USER=ubuntu
+export RCMD_CMD=ssh
+export RCMD_CMD_ARGS="-i $HOME/.ssh/onlabkey.pem"
+export RCMD_USER=ubuntu
+export RCP_CMD="scp -i $HOME/.ssh/onlabkey.pem -o StrictHostKeyChecking=no"
+export FANOUT=64
+export CLUSTER="$HOME/cluster-mgmt/cluster.txt"
+
+#### Set the proper value ####
+#export ONOS_CLUSTER_BASENAME="onosdevx"
+#export ONOS_CLUSTER_NR_NODES=8
diff --git a/cluster-mgmt/bin/bootup.sh b/cluster-mgmt/bin/bootup.sh
new file mode 100755
index 0000000..ca86f7e
--- /dev/null
+++ b/cluster-mgmt/bin/bootup.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+. `dirname $0`/func.sh
+
+onos stop
+cassandra cleandb
+cassandra stop
+zk stop
+
+zk start
+cassandra start
+cassandra cleandb
+db_status=`cassandra checkdb |grep OK | wc -l`
+if [ $db_status != 1 ];then
+ echo $db_status
+ echo "Cassandra DB was screwed up. Need DB key drop"
+ exit
+fi
+onos start
+switch local
+#dsh -g $basename 'cd ONOS; ./ctrl-local.sh'
diff --git a/cluster-mgmt/bin/cassandra b/cluster-mgmt/bin/cassandra
new file mode 100755
index 0000000..b2033ad
--- /dev/null
+++ b/cluster-mgmt/bin/cassandra
@@ -0,0 +1,5 @@
+#! /bin/bash
+. `dirname $0`/func.sh
+
+#$0 $1 $2
+`basename $0` $1 $2
diff --git a/cluster-mgmt/bin/check_status.py b/cluster-mgmt/bin/check_status.py
new file mode 100755
index 0000000..61f2108
--- /dev/null
+++ b/cluster-mgmt/bin/check_status.py
@@ -0,0 +1,245 @@
+#! /usr/bin/env python
+import json
+import os
+
+urls="http://localhost:8080/wm/core/topology/switches/all/json http://localhost:8080/wm/core/topology/links/json http://localhost:8080/wm/registry/controllers/json http://localhost:8080/wm/registry/switches/json"
+RestIP=os.environ.get("ONOS_CLUSTER_BASENAME")+"1"
+RestPort="8080"
+
+core_switches=["00:00:00:00:ba:5e:ba:11", "00:00:00:00:00:00:ba:12", "00:00:20:4e:7f:51:8a:35", "00:00:00:00:ba:5e:ba:13", "00:00:00:08:a2:08:f9:01", "00:00:00:16:97:08:9a:46"]
+correct_nr_switch=[6,50,25,25,25,25,25,25]
+correct_intra_link=[16, 98, 48, 48, 48, 48, 48, 48]
+
+#nr_links=(switch[1]+switch[2]+switch[3]+switch[4]+switch[5]+switch[6]+switch[7]+len(switch)-1+8)*2
+nr_links= (49 + 24 * 6 + 7 + 8) * 2
+
+cluster_basename=os.environ.get("ONOS_CLUSTER_BASENAME")
+nr_nodes=os.environ.get("ONOS_CLUSTER_NR_NODES")
+
+def get_json(url):
+ print url
+ try:
+ command = "curl -s %s" % (url)
+ result = os.popen(command).read()
+ parsedResult = json.loads(result)
+ except:
+ print "REST IF %s has issue" % command
+ parsedResult = ""
+
+ if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
+ print "REST %s returned code %s" % (command, parsedResult['code'])
+ parsedResult = ""
+
+ return parsedResult
+
+def check_switch():
+ buf = ""
+ retcode = 0
+
+ url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ registry = get_json(url)
+
+ if registry == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+
+ buf += "switch: total %d switches\n" % len(parsedResult)
+ cnt = []
+ active = []
+ for r in range(8):
+ cnt.append(0)
+ active.append(0)
+
+ for s in parsedResult:
+ if s['dpid'] in core_switches:
+ nw_index = 0
+ else:
+ nw_index =int(s['dpid'].split(':')[-2], 16) - 1
+ cnt[nw_index] += 1
+
+ if s['state'] == "ACTIVE":
+ active[nw_index] += 1
+
+ if not s['dpid'] in registry:
+ buf += "switch: dpid %s lost controller\n" % (s['dpid'])
+
+ for r in range(8):
+ buf += "switch: network %d : %d switches %d active\n" % (r+1, cnt[r], active[r])
+ if correct_nr_switch[r] != cnt[r]:
+ buf += "switch fail: network %d should have %d switches but has %d\n" % (r+1, correct_nr_switch[r], cnt[r])
+ retcode = 1
+
+ if correct_nr_switch[r] != active[r]:
+ buf += "switch fail: network %d should have %d active switches but has %d\n" % (r+1, correct_nr_switch[r], active[r])
+ retcode = 1
+
+ return (retcode, buf)
+
+def check_link():
+ buf = ""
+ retcode = 0
+
+ url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
+ intra = []
+ interlink=0
+ for r in range(8):
+ intra.append(0)
+
+ for s in parsedResult:
+ if s['src-switch'] in core_switches:
+ src_nw = 1
+ else:
+ src_nw =int(s['src-switch'].split(':')[-2], 16)
+
+ if s['dst-switch'] in core_switches:
+ dst_nw = 1
+ else:
+ dst_nw =int(s['dst-switch'].split(':')[-2], 16)
+
+ src_swid =int(s['src-switch'].split(':')[-1], 16)
+ dst_swid =int(s['dst-switch'].split(':')[-1], 16)
+ if src_nw == dst_nw:
+ intra[src_nw - 1] = intra[src_nw - 1] + 1
+ else:
+ interlink += 1
+
+ for r in range(8):
+ if intra[r] != correct_intra_link[r]:
+ buf += "link fail: network %d should have %d intra links but has %d\n" % (r+1, correct_intra_link[r], intra[r])
+ retcode = 1
+
+ if interlink != 14:
+ buf += "link fail: There should be %d intra links (uni-directional) but %d\n" % (14, interlink)
+ retcode = 1
+
+ return (retcode, buf)
+
+def check_switch_local():
+ buf = "check_switch_local\n"
+ retcode = 0
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ for s in parsedResult:
+ #print s,len(s),s[0]['controllerId']
+ ctrl=parsedResult[s][0]['controllerId']
+ if s in core_switches:
+ nw = 1
+ else:
+ nw =int(s.split(':')[-2], 16)
+
+ if len(parsedResult[s]) > 1:
+ buf += "switch_local warn: switch %s has more than 1 controller: " % (s)
+ for i in parsedResult[s]:
+ buf += "%s " % (i['controllerId'])
+ buf += "\n"
+ retcode = 1
+
+ if int(ctrl[-1]) != nw:
+ buf += "switch_local fail: switch %s is wrongly controlled by %s\n" % (s, ctrl)
+ retcode = 1
+
+ return (retcode, buf)
+
+def check_switch_all(nr_ctrl):
+ buf = "check_switch_all\n"
+ retcode = 0
+
+ url = "http://%s:%s/wm/registry/controllers/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ ## Check Dup Controller ##
+ controllers=list(set(parsedResult))
+ if len (controllers) != len(parsedResult):
+ buf += "Duplicated Controller in registory: " + str(parsedResult) + "\n"
+ retcode = 1
+
+ ## Check Missing Controller ##
+ if len (controllers) != nr_ctrl:
+ buf += "Missiing Controller in registory: " + str(parsedResult) + "\n"
+ retcode = 1
+
+ ## Check Core Controller Exist ##
+ core_ctrl="%s1" % (cluster_basename)
+ if not core_ctrl in controllers:
+ buf += "Core controller missing in registory: " + str(parsedResult) + "\n"
+ retcode = 1
+
+ controllers.remove(core_ctrl)
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+ return (retcode, "Rest API has an issue")
+
+ for s in parsedResult:
+ ctrl_set = []
+ for c in parsedResult[s]:
+ ctrl_set.append(c['controllerId'])
+
+ if s in core_switches:
+ nw = 1
+ else:
+ nw =int(s.split(':')[-2], 16)
+
+ if nw == 1 and len(ctrl_set) != 1:
+ buf += "Core switch %s has more than 1 controller: %s\n" % (s, ctrl_set)
+ elif nw != 1:
+ if len(list(set(ctrl_set))) != len(ctrl_set):
+ buf += "Edge switch %s has dup controller: %s\n" % (s, ctrl_set)
+ elif len(list(set(ctrl_set))) != len(controllers):
+ buf += "Edge switch %s has missing controller: %s\n" % (s, ctrl_set)
+
+ return (retcode, buf)
+
+def check_controllers(n):
+ retcode = 0
+ buf = ""
+ url = "http://%s:%s/wm/registry/controllers/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ retcode = 1
+
+ return (retcode, "Rest API has an issue")
+
+ for i,c in enumerate(parsedResult):
+ buf += "%d : %s\n" % (i,c)
+
+ if len(parsedResult) != n:
+ buf += "controller fail: there are %d controllers (should be %d)\n" % (len(parsedResult), n)
+ retcode = 1
+
+ return (retcode, buf)
+
+if __name__ == "__main__":
+ print "%s" % check_switch()[1]
+ print "%s" % check_link()[1]
+ print "%s" % check_switch_local()[1]
+ print "%s" % check_controllers(8)[1]
diff --git a/cluster-mgmt/bin/check_status_failover.py b/cluster-mgmt/bin/check_status_failover.py
new file mode 100755
index 0000000..17baa01
--- /dev/null
+++ b/cluster-mgmt/bin/check_status_failover.py
@@ -0,0 +1,13 @@
+#! /usr/bin/env python
+import json
+import os
+from check_status import *
+
+cluster_basename=os.environ.get("ONOS_CLUSTER_BASENAME")
+nr_nodes=os.environ.get("ONOS_CLUSTER_NR_NODES")
+
+if __name__ == "__main__":
+ print "%s" % check_switch()[1]
+ print "%s" % check_link()[1]
+ print "%s" % check_controllers(8)[1]
+ print "%s" % check_switch_all(8)[1]
diff --git a/cluster-mgmt/bin/cho-failover.py b/cluster-mgmt/bin/cho-failover.py
new file mode 100755
index 0000000..04f83c5
--- /dev/null
+++ b/cluster-mgmt/bin/cho-failover.py
@@ -0,0 +1,188 @@
+#! /usr/bin/env python
+import json
+import sys
+import os
+import re
+from check_status import *
+import time
+
+basename=os.getenv("ONOS_CLUSTER_BASENAME")
+operation=['switch all', 'onos stop 8', 'onos stop 7', 'onos stop 6', 'onos stop 5', 'onos start 5;onos start 6;onos start 7;onos start 8', 'switch local']
+nr_controllers=[8, 7, 6, 5, 4, 8, 8]
+
+wait1=30
+wait2=60
+
+def check_by_pingall():
+ buf = ""
+ cmd = "pingall-speedup.sh %s" % (flowdef)
+ result = os.popen(cmd).read()
+ buf += result
+
+ if re.search("fail 0", result):
+ return (0, buf)
+ else:
+ return (1, buf)
+
+def link_change_core(op):
+ cmd = "dsh -w %s1 \"sudo ifconfig %s\"" % (basename, op)
+ os.popen(cmd)
+ print cmd
+
+def check_flow_nmap():
+ buf = ""
+ buf += os.popen("date").read()
+ print "dump all flows from network map"
+ cmd = "dsh -w %s1 \"cd ONOS/web; ./get_flow.py all\"" % cluster_basename
+ buf += os.popen(cmd).read()
+ return (0, buf)
+
+def check_flow_raw():
+ buf = ""
+ print "dump all flows from switches"
+ cmd = "dsh \"cd ONOS/scripts; ./showflow.sh\""
+ buf += os.popen(cmd).read()
+ return (0, buf)
+
+def dump_json(url, filename):
+ f = open(filename, 'w')
+ buf = ""
+ command = "curl -s %s" % (url)
+ result = os.popen(command).read()
+ buf += json.dumps(json.loads(result), sort_keys = True, indent = 2)
+ f.write(buf)
+ f.close()
+
+def dump_flowgetall(tag):
+ url="http://%s:%s/wm/flow/getall/json" % (RestIP, RestPort)
+ filename = "rest-flow-getall-log.%s.log" % tag
+ dump_json(url, filename)
+
+def check_rest(tag):
+ url="http://%s:%s/wm/flow/getall/json" % (RestIP, RestPort)
+ filename = "rest-flow-getall-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+ filename = "rest-sw-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+ filename = "rest-link-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ filename = "rest-reg-sw-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/registry/controllers/json" % (RestIP, RestPort)
+ filename = "rest-reg-ctrl-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/flow/getsummary/0/0/json" % (RestIP, RestPort)
+ filename = "rest-flow-getsummary-log.%s.log" % tag
+ dump_json(url, filename)
+
+
+def check_and_log(tag):
+ global cur_nr_controllers
+ buf = ""
+ buf += "check by pingall\n"
+ (code, result) = check_by_pingall()
+ if code == 0:
+ buf += "ping success %s\n" % (result)
+ else:
+ buf += "pingall failed\n"
+ buf += "%s\n" % (result)
+ error = "error-log.%s.log" % tag
+ rawflow = "raw-flow-log.%s.log" % tag
+
+ ferror = open(error, 'w')
+ ferror.write(result)
+
+ fraw = open(rawflow,'w')
+ fraw.write(check_flow_raw()[1])
+ fraw.close()
+
+ check_rest(tag)
+
+ ferror.write(check_switch()[1])
+ ferror.write(check_link()[1])
+ ferror.write(check_switch_local()[1])
+ ferror.write(check_controllers(cur_nr_controllers)[1])
+ ferror.close()
+
+ return (code, buf)
+
+def plog(string):
+ global logf
+ print string
+ logf.write(string+"\n")
+
+if __name__ == "__main__":
+ global logf, cur_nr_controllers
+ argvs = sys.argv
+ if len(argvs) == 5:
+ log_filename = sys.argv[1]
+ flowdef = sys.argv[2]
+ wait1 = int(sys.argv[3])
+ wait2 = int(sys.argv[4])
+ else:
+ print "usage: %s log_filename flowdef_filename wait1 wait2" % sys.argv[0]
+ print " wait1: wait time (sec) to check ping after change"
+ print " wait2: additional wait time (sec) if the first check failed"
+ sys.exit(1)
+
+ logf = open(log_filename, 'w', 0)
+
+ plog("flow def: %s" % flowdef)
+ plog("wait1 : %d" % wait1)
+ plog("wait2 : %d" % wait2)
+
+ plog(check_switch()[1])
+ plog(check_link()[1])
+ plog(check_controllers(8)[1])
+
+ (code, result) = check_by_pingall()
+
+ plog(result)
+
+ print result
+ k = raw_input('hit any key>')
+
+ for cycle in range(1000):
+ for n, op in enumerate(operation):
+ plog("==== Cycle %d operation %d ====: %s" % (cycle, n, os.popen('date').read()))
+# link_change_core(op)
+ os.popen(op)
+ plog(op)
+ cur_nr_controllers = nr_controllers[n]
+
+ plog("wait %d sec" % wait1)
+ time.sleep(wait1)
+ plog("check and log: %s" % os.popen('date').read())
+
+ tstart=int(time.time())
+ (code, result) = check_and_log("%d.%d.1" % (cycle,n))
+ plog(result)
+ plog("done: %s" % os.popen('date').read())
+ tend=int(time.time())
+
+ tdelta=tend-tstart
+
+ if not code == 0:
+ wait = max(0, wait2 - tdelta)
+ plog("took %d sec for check and log. wait another %d sec" % (tdelta, wait))
+ time.sleep(wait)
+ plog("check and log: %s" % os.popen('date').read())
+ (code, result) = check_and_log("%d.%d.2" % (cycle,n))
+ plog(result)
+ plog("done: %s" % os.popen('date').read())
+ if code == 0:
+ tag = "%d.%d.2" % (cycle,n)
+ dump_flowgetall(tag)
+ rawflow = "raw-flow-log.%s.log" % tag
+ fraw = open(rawflow,'w')
+ fraw.write(check_flow_raw()[1])
+ fraw.close()
+ logf.close()
diff --git a/cluster-mgmt/bin/cho-link-failure.py b/cluster-mgmt/bin/cho-link-failure.py
new file mode 100755
index 0000000..8889c1f
--- /dev/null
+++ b/cluster-mgmt/bin/cho-link-failure.py
@@ -0,0 +1,187 @@
+#! /usr/bin/env python
+import json
+import sys
+import os
+import re
+from check_status import *
+import time
+
+basename=os.getenv("ONOS_CLUSTER_BASENAME")
+operation=["sw3-eth4 down","sw4-eth4 down","sw4-eth3 down","sw3-eth4 up","sw1-eth2 down","sw4-eth4 up","sw4-eth3 up","sw1-eth2 up"]
+wait1=30
+wait2=60
+
+def check_by_pingall():
+ buf = ""
+ cmd = "pingall-speedup.sh %s" % (flowdef)
+ result = os.popen(cmd).read()
+ buf += result
+
+ if re.search("fail 0", result):
+ return (0, buf)
+ else:
+ return (1, buf)
+
+def link_change_core(op):
+ cmd = "dsh -w %s1 \"sudo ifconfig %s\"" % (basename, op)
+ os.popen(cmd)
+ print cmd
+
+def check_flow_nmap():
+ buf = ""
+ buf += os.popen("date").read()
+ print "dump all flows from network map"
+ cmd = "dsh -w %s1 \"cd ONOS/web; ./get_flow.py all\"" % cluster_basename
+ buf += os.popen(cmd).read()
+ return (0, buf)
+
+def check_flow_raw():
+ buf = ""
+ print "dump all flows from switches"
+ cmd = "dsh \"cd ONOS/scripts; ./showflow.sh\""
+ buf += os.popen(cmd).read()
+ return (0, buf)
+
+def dump_json(url, filename):
+ f = open(filename, 'w')
+ buf = ""
+ command = "curl -s %s" % (url)
+ result = os.popen(command).read()
+ buf += json.dumps(json.loads(result), sort_keys = True, indent = 2)
+ f.write(buf)
+ f.close()
+
+def dump_flowgetall(tag):
+ url="http://%s:%s/wm/flow/getall/json" % (RestIP, RestPort)
+ filename = "rest-flow-getall-log.%s.log" % tag
+ dump_json(url, filename)
+
+def check_rest(tag):
+ url="http://%s:%s/wm/flow/getall/json" % (RestIP, RestPort)
+ filename = "rest-flow-getall-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+ filename = "rest-sw-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+ filename = "rest-link-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ filename = "rest-reg-sw-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/registry/controllers/json" % (RestIP, RestPort)
+ filename = "rest-reg-ctrl-log.%s.log" % tag
+ dump_json(url, filename)
+
+ url = "http://%s:%s/wm/flow/getsummary/0/0/json" % (RestIP, RestPort)
+ filename = "rest-flow-getsummary-log.%s.log" % tag
+ dump_json(url, filename)
+
+
+def check_and_log(tag):
+ global cur_nr_controllers
+ buf = ""
+ buf += "check by pingall\n"
+ (code, result) = check_by_pingall()
+ if code == 0:
+ buf += "ping success %s\n" % (result)
+ else:
+ buf += "pingall failed\n"
+ buf += "%s\n" % (result)
+ error = "error-log.%s.log" % tag
+ rawflow = "raw-flow-log.%s.log" % tag
+
+ ferror = open(error, 'w')
+ ferror.write(result)
+
+ fraw = open(rawflow,'w')
+ fraw.write(check_flow_raw()[1])
+ fraw.close()
+
+ check_rest(tag)
+
+ ferror.write(check_switch()[1])
+ ferror.write(check_link()[1])
+ ferror.write(check_switch_local()[1])
+ ferror.write(check_controllers(cur_nr_controllers)[1])
+ ferror.close()
+
+ return (code, buf)
+
+def plog(string):
+ global logf
+ print string
+ logf.write(string+"\n")
+
+if __name__ == "__main__":
+ global logf, cur_nr_controllers
+
+ cur_nr_controllers = 8
+
+ argvs = sys.argv
+ if len(argvs) == 5:
+ log_filename = sys.argv[1]
+ flowdef = sys.argv[2]
+ wait1 = int(sys.argv[3])
+ wait2 = int(sys.argv[4])
+ else:
+ print "usage: %s log_filename flowdef_filename wait1 wait2" % sys.argv[0]
+ print " wait1: wait time (sec) to check ping after change"
+ print " wait2: additional wait time (sec) if the first check failed"
+ sys.exit(1)
+
+ logf = open(log_filename, 'w', 0)
+
+ plog("flow def: %s" % flowdef)
+ plog("wait1 : %d" % wait1)
+ plog("wait2 : %d" % wait2)
+
+ plog(check_switch()[1])
+ plog(check_link()[1])
+ plog(check_controllers(cur_nr_controllers)[1])
+
+ (code, result) = check_by_pingall()
+
+ plog(result)
+
+ print result
+ k = raw_input('hit any key>')
+
+ for cycle in range(1000):
+ for n, op in enumerate(operation):
+ plog("==== Cycle %d operation %d ====: %s" % (cycle, n, os.popen('date').read()))
+ link_change_core(op)
+ plog(op)
+
+ plog("wait %d sec" % wait1)
+ time.sleep(wait1)
+ plog("check and log: %s" % os.popen('date').read())
+
+ tstart=int(time.time())
+ (code, result) = check_and_log("%d.%d.1" % (cycle,n))
+ plog(result)
+ plog("done: %s" % os.popen('date').read())
+ tend=int(time.time())
+
+ tdelta=tend-tstart
+
+ if not code == 0:
+ wait = max(0, wait2 - tdelta)
+ plog("took %d sec for check and log. wait another %d sec" % (tdelta, wait))
+ time.sleep(wait)
+ plog("check and log: %s" % os.popen('date').read())
+ (code, result) = check_and_log("%d.%d.2" % (cycle,n))
+ plog(result)
+ plog("done: %s" % os.popen('date').read())
+ if code == 0:
+ tag = "%d.%d.2" % (cycle,n)
+ dump_flowgetall(tag)
+ rawflow = "raw-flow-log.%s.log" % tag
+ fraw = open(rawflow,'w')
+ fraw.write(check_flow_raw()[1])
+ fraw.close()
+ logf.close()
diff --git a/cluster-mgmt/bin/cho-link-failure.sh b/cluster-mgmt/bin/cho-link-failure.sh
new file mode 100755
index 0000000..4db887a
--- /dev/null
+++ b/cluster-mgmt/bin/cho-link-failure.sh
@@ -0,0 +1,54 @@
+#! /bin/sh
+basename=$ONOS_CLUSTER_BASENAME
+wait=10
+
+fdef="flowdef_8node_42.txt"
+
+function log()
+{
+ date > error.$1.$2.log
+ check_status.py >> error.$1.$2.log
+ dsh -w ${basename}1 "cd ONOS/web; ./get_flow.py all" >> error.$1.$2.log
+ dsh "cd ONOS/scripts; ./showflow.sh" >> error.$1.$2.log
+}
+
+echo "all links up"
+dsh -w ${basename}1 "cd ONOS/scripts; ./all-linkup.sh"
+echo "clean up flow"
+dsh -w ${basename}1 "cd ONOS/web; ./delete_flow.py 1 100"
+sleep 1
+dsh -w ${basename}1 "cd ONOS/web; ./get_flow.py all"
+dsh "cd ONOS/scripts; ./delflow.sh"
+echo "checkup status"
+check_status.py
+read -p "hit anykey> "
+
+echo "install pre-set flows"
+dsh -w ${basename}1 "cd ONOS/web; ./add_flow.py -m onos -f $fdef"
+sleep 6
+echo "check"
+dsh -w ${basename}1 "cd ONOS/web; ./pingall.py $fdef"
+
+#ports=`dsh -w ${basename}1 "cd ONOS/scripts; ./listports.sh" | awk '{print $2}' |grep -v tap`
+operation=("sw3-eth3 down" "sw4-eth4 down" "sw4-eth3 down" "sw3-eth3 up" "sw1-eth2 down" "sw4-eth4 up" "sw4-eth3 up" "sw1-eth2 up")
+
+((n=0))
+while [ 1 ] ; do
+ for (( i = 0; i< ${#operation[@]}; i ++)); do
+ echo "Test $n-$i"
+ p=`echo ${operation[$i]}`
+ echo "operation: $p"
+# read -p "hit anykey> "
+ dsh -w ${basename}1 "sudo ifconfig $p"
+ echo "wait $wait sec"
+ sleep $wait
+ result=`dsh -w ${basename}1 "cd ONOS/web; ./pingall.py $fdef"`
+ echo $result
+ nr_fail=`echo $result |grep fail | wc -l`
+ if [ $nr_fail -gt 0 ]; then
+ log $n $i
+ fi
+ done
+ ((n++))
+done
+
diff --git a/cluster-mgmt/bin/cmd b/cluster-mgmt/bin/cmd
new file mode 100755
index 0000000..b2033ad
--- /dev/null
+++ b/cluster-mgmt/bin/cmd
@@ -0,0 +1,5 @@
+#! /bin/bash
+. `dirname $0`/func.sh
+
+#$0 $1 $2
+`basename $0` $1 $2
diff --git a/cluster-mgmt/bin/comp-nwmap-sw.py b/cluster-mgmt/bin/comp-nwmap-sw.py
new file mode 100755
index 0000000..8dc65f6
--- /dev/null
+++ b/cluster-mgmt/bin/comp-nwmap-sw.py
@@ -0,0 +1,144 @@
+#! /usr/bin/env python
+import os
+import re
+import json
+import sys
+import os
+
+status=0
+
+pid=os.getpid()
+basename=os.getenv("ONOS_CLUSTER_BASENAME")
+RestPort=8080
+
+def dump_switch_table(filename):
+ cmd="dsh \"cd ONOS/scripts; ./showflow.sh\""
+ f=open(filename, 'w')
+ result=os.popen(cmd).read()
+
+ f.write(result)
+ f.close()
+
+def dump_network_map(filename):
+ url="http://%s1:%d/wm/flow/getall/json" % (basename, RestPort)
+ cmd="curl -s %s" % url
+ f=open(filename, 'w')
+ try:
+ result=json.loads(os.popen(cmd).read())
+ except:
+ print "REST has issue"
+ sys.exit(1)
+
+ json.dump(result, f, indent=2, sort_keys=True)
+ f.close()
+
+def make_key(*kargs):
+ key=""
+ for k in kargs:
+ key += str(k)+"_"
+ return key[:-1]
+
+def fdb_nmap(filename):
+ f=open(filename, 'r')
+ json_flow = json.load(f)
+ nr_flow_entries = 0
+ fdb_nmap={}
+ ## XXX should be better way to ditect empty list ##
+ if json_flow == "[]":
+ print "nmap contained %d flow entries" % nr_flow_entries
+ return fdb_nmap
+
+ for flow in json_flow:
+ fid = flow['flowId']['value']
+ dl_src = flow['flowEntryMatch']['srcMac']['value'].lower()
+ dl_dst = flow['flowEntryMatch']['dstMac']['value'].lower()
+ e = {}
+ for entry in flow['dataPath']['flowEntries']:
+ dpid = entry['dpid']['value'].replace(":","").lower()
+ cookie = entry['flowEntryId']
+ in_port = entry['flowEntryMatch']['inPort']['value']
+
+ outport = []
+ for p in entry['flowEntryActions']:
+ outport.append(p['actionOutput']['port']['value'])
+ outport.sort()
+
+ e['dpid']=dpid
+ e['cookie']=cookie
+ e['in_port']=in_port
+ e['dl_src']=dl_src
+ e['dl_dst']=dl_dst
+ e['actions']=outport
+ e['fid']=fid
+ key = make_key(dpid, in_port, dl_src, dl_dst, outport[0])
+
+ fdb_nmap[key]=e
+ nr_flow_entries += 1
+
+ print "nmap contained %d flow entries" % nr_flow_entries
+ return fdb_nmap
+
+def fdb_raw(filename):
+ f = open(filename, 'r')
+ fdb_raw={}
+ nr_flow_entries = 0
+ for line in f:
+ e = {}
+ if line[0] == '#':
+ continue
+ dpid=re.search("dpid=([0-9]|[a-f])*", line.strip()).group().split("=")[1]
+ cookie=re.search("cookie=0x([0-9]|[a-f])*", line.strip()).group().split("=")[1]
+ in_port=re.search("in_port=[0-9]*", line.strip()).group().split("=")[1]
+ dl_src=re.search("dl_src=([0-9]|[a-f]|:)*", line.strip()).group().split("=")[1]
+ dl_dst=re.search("dl_dst=([0-9]|[a-f]|:)*", line.strip()).group().split("=")[1]
+ outport_list=re.search("actions=(output:[0-9]*,*)*", line.strip()).group().split("=")[1].split(",")
+ outport=[]
+ for i in outport_list:
+ outport.append(int(i.split(":")[1]))
+ outport.sort()
+
+ e['dpid']=dpid
+ e['cookie']=cookie
+ e['in_port']=in_port
+ e['dl_src']=dl_src
+ e['dl_dst']=dl_dst
+ e['actions']=outport
+ key = make_key(dpid, in_port, dl_src, dl_dst, outport[0])
+ fdb_raw[key]=e
+ nr_flow_entries += 1
+
+ print "real switches contained %d flow entries" % nr_flow_entries
+ f.close()
+ return fdb_raw
+
+if __name__ == "__main__":
+ argvs = sys.argv
+ if len(argvs) != 2:
+ f1=".nmap.%d.txt" % pid
+ f2=".rawflow.%d.txt" % pid
+ dump_network_map(f1)
+ dump_switch_table(f2)
+
+ else:
+ f1 = sys.argv[1]
+ f2 = sys.argv[2]
+
+
+ fdb_nmap = fdb_nmap(f1)
+ fdb_raw = fdb_raw(f2)
+
+ nr_not_found_in_switch = 0
+ for f in fdb_nmap:
+ if not fdb_raw.has_key(f):
+ nr_not_found_in_switch += 1
+ print "fid=%s dpid=%s cookie=%s in_port=%s dl_src=%s dl_dst=%s outport=%s not found in switch" % (fdb_nmap[f]['fid'],fdb_nmap[f]['dpid'],fdb_nmap[f]['cookie'],fdb_nmap[f]['in_port'],fdb_nmap[f]['dl_src'],fdb_nmap[f]['dl_dst'],fdb_nmap[f]['actions'])
+
+ nr_not_found_in_nmap = 0
+ for f in fdb_raw:
+ if not fdb_nmap.has_key(f):
+ nr_not_found_in_nmap += 1
+ print "dpid=%s cookie=%s in_port=%s dl_src=%s dl_dst=%s outport=%s not found in nmap" % (fdb_raw[f]['dpid'],fdb_raw[f]['cookie'],fdb_raw[f]['in_port'],fdb_raw[f]['dl_src'],fdb_raw[f]['dl_dst'],fdb_raw[f]['actions'])
+
+ print "Network Map has %d flow entries, %d not found in switch" % (len(fdb_nmap), nr_not_found_in_switch)
+ print "Switches have %d flow entries, %d not found in network map" % (len(fdb_raw), nr_not_found_in_nmap)
+ print "dumpfiles: %s %s" % (f1, f2)
diff --git a/cluster-mgmt/bin/config.sh b/cluster-mgmt/bin/config.sh
new file mode 100755
index 0000000..19bfbf2
--- /dev/null
+++ b/cluster-mgmt/bin/config.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+. `dirname $0`/func.sh
+
+basename=$ONOS_CLUSTER_BASENAME
+nr_nodes=$ONOS_CLUSTER_NR_NODES
+
+for n in `seq 1 $nr_nodes`; do
+ echo "Host node$n"
+ echo "User ubuntu"
+ echo "HostName ${basename}${n}"
+done > ~/.ssh/config
+
+cd ${HOME}/bin
+for n in `seq 1 $nr_nodes`; do
+ ln -s ssh_exec node${n}
+done
diff --git a/cluster-mgmt/bin/demo-reset-hw.sh b/cluster-mgmt/bin/demo-reset-hw.sh
new file mode 100755
index 0000000..15f97e1
--- /dev/null
+++ b/cluster-mgmt/bin/demo-reset-hw.sh
@@ -0,0 +1,37 @@
+#! /bin/bash
+DIR=${HOME}/ONOS
+echo "==== Reset Demo to the initial State ==="
+date
+start=`date +"%s"`
+echo "all link up.."
+$DIR/scripts/all-linkup-hw.sh
+echo "link up done"
+
+echo "cleanup excess flows"
+$DIR/web/delete_flow.py 201 300
+echo "cleanup excess flows done"
+echo "Adding 200 flows"
+$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_start.txt
+echo "done"
+echo "killing iperf"
+dsh -g onos 'sudo pkill -KILL iperf'
+echo "done"
+echo "kill onos at 5 and 7"
+onos stop 5
+onos stop 7
+echo "done"
+echo "bringup 1 2 3 4 6 8 if dead"
+for i in 1 2 3 4 6 8; do
+ status=`onos status $i | grep instance | awk '{print $2}'`
+ echo "onos $i status $status"
+ if [ x$status == "x0" ]; then
+ onos start $i
+ fi
+done
+echo "done"
+
+sleep 2
+switch local
+endt=`date +"%s"`
+(( delta = endt -start ))
+echo "finish: took $delta sec"
diff --git a/cluster-mgmt/bin/demo-scale-out-hw.sh b/cluster-mgmt/bin/demo-scale-out-hw.sh
new file mode 100755
index 0000000..6a44c8d
--- /dev/null
+++ b/cluster-mgmt/bin/demo-scale-out-hw.sh
@@ -0,0 +1,6 @@
+#! /bin/bash
+onos start 5
+onos start 7
+switch local
+sleep 4
+cd ~/ONOS/web; ./add_flow.py -m onos -f flowdef_demo_add.txt &
diff --git a/cluster-mgmt/bin/func.sh b/cluster-mgmt/bin/func.sh
new file mode 100755
index 0000000..22071e2
--- /dev/null
+++ b/cluster-mgmt/bin/func.sh
@@ -0,0 +1,182 @@
+CASSANDRA_DIR='${HOME}/apache-cassandra-1.1.4'
+ZK_DIR='${HOME}/zookeeper-3.4.5'
+ONOS_DIR='${HOME}/ONOS'
+
+ZK_LIB='/var/lib/zookeeper'
+CASSANDRA_LIB='/var/lib/cassandra'
+
+if [ x$CLUSTER == "x" ]; then
+ echo "CLUSTER is not set. Exitting."
+ exit
+fi
+if [ x$ONOS_CLUSTER_BASENAME == "x" ]; then
+ echo "ONOS_CLUSTER_BASENAME is not set. Exitting"
+ exit
+fi
+if [ x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "ONOS_CLUSTER_NR_NODES is not set. Exitting"
+ exit
+fi
+
+export basename=$ONOS_CLUSTER_BASENAME
+export nr_nodes=$ONOS_CLUSTER_NR_NODES
+
+checkcluster () {
+ dsh -g $basename 'uname -a'
+}
+
+zk () {
+ case "$1" in
+ start)
+ echo "Starting ZK.."
+# dsh -g $basename "$ZK_DIR/bin/zkServer.sh start"
+ dsh -g $basename 'cd ONOS; ./start-zk.sh start'
+ while [ 1 ]; do
+# nup=`dsh -g $basename "$ZK_DIR/bin/zkServer.sh status" | grep "Mode" | egrep "leader|follower" | wc -l`
+ nup=`dsh -g $basename "cd ONOS; ./start-zk.sh status" | grep "Mode" | egrep "leader|follower|standalone" | wc -l`
+ echo "check status"
+ if [ $nup == $nr_nodes ]; then
+ echo "everybody's up: $nup up of of $nr_nodes"
+ echo "ZK started"
+ break;
+ fi
+ echo "waiting for everybody's up: $nup up of of $nr_nodes"
+ sleep 1
+ done
+ ;;
+ stop)
+ echo "Stopping ZK.."
+ dsh -g $basename "$ZK_DIR/bin/zkServer.sh stop"
+ ;;
+ status)
+ echo "Checking ZK Status"
+ dsh -g $basename "$ZK_DIR/bin/zkServer.sh status"
+ ;;
+ esac
+}
+
+cassandra () {
+ case "$1" in
+ start)
+ echo "Starting Cassandra.."
+ echo " start cassandra at the seed node"
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./start-cassandra.sh start"
+ sleep 1
+ echo " start cassandra in rest nodes"
+ dsh -g ${basename} -x ${basename}1 "cd $ONOS_DIR; ./start-cassandra.sh start"
+ while [ 1 ]; do
+ echo $$
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./start-cassandra.sh status" > .cassandra_check.$$
+ cat .cassandra_check.$$
+ nup=`cat .cassandra_check.$$ | grep Normal |grep Up| wc -l`
+ if [ $nup == $nr_nodes ]; then
+ echo "everybody's up: $nup up of of $nr_nodes"
+ echo "Cassandra started"
+ break;
+ fi
+ echo "waiting for everybody's up: $nup up of of $nr_nodes"
+ sleep 1
+ done
+ ;;
+ bootup)
+ echo "Removing old Cassandra data and logs"
+ dsh -g ${basename} "rm -rf /var/lib/cassandra/*"
+ dsh -g ${basename} "rm -rf /var/log/cassandra/*"
+
+ echo "Starting Cassandra nodes one by one..."
+ for (( c=1; c<=$nr_nodes; c++ ))
+ do
+ echo "Starting node ${basename}${c}"
+ dsh -g ${basename} -w ${basename}${c} "cd $ONOS_DIR; ./start-cassandra.sh start"
+
+ #Wait until it's up
+ while [ 1 ]; do
+ echo $$
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./start-cassandra.sh status" > .cassandra_check.$$
+ cat .cassandra_check.$$
+ nup=`cat .cassandra_check.$$ | grep Normal |grep Up| wc -l`
+ if [ $nup == $c ]; then
+ echo "New node up: $nup up of of $nr_nodes"
+ break;
+ fi
+ echo "Waiting for new node to come up: $nup up of of $nr_nodes"
+ sleep 5
+ done
+ done
+ ;;
+ stop)
+ echo "Stopping Cassandra.."
+ dsh -g ${basename} "cd $ONOS_DIR; ./start-cassandra.sh stop"
+ ;;
+ cleandb)
+ echo "Removing all data in db"
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./scripts/cleanup-cassandra.sh"
+ ;;
+ checkdb)
+ echo "Check DB Status"
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./scripts/check-db-status.sh"
+ ;;
+ status)
+ echo "Checking Cassandra Status"
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./start-cassandra.sh status"
+ ;;
+ esac
+}
+
+onos () {
+ case "$1" in
+ start)
+ if [ x$2 == "x" -o x$2 == "xall" ]; then
+ echo "Starting ONOS on all nodes"
+ dsh -w ${basename}1 "cd $ONOS_DIR; ./start-onos.sh start"
+ sleep 3
+ dsh -g ${basename} -x ${basename}1 "cd $ONOS_DIR; ./start-onos.sh start"
+ dsh -g ${basename} "cd $ONOS_DIR; ./start-rest.sh start"
+ else
+ echo "Starting ONOS on ${basename}$2"
+ dsh -w ${basename}$2 "cd $ONOS_DIR; ./start-onos.sh start"
+ fi
+ ;;
+ stop)
+ if [ x$2 == "x" -o x$2 == "xall" ]; then
+ echo "Stop ONOS on all nodes"
+ dsh -g ${basename} "cd $ONOS_DIR; ./start-onos.sh stop"
+ else
+ echo "Stop ONOS on ${basename}$2"
+ dsh -w ${basename}$2 "cd $ONOS_DIR; ./start-onos.sh stop"
+ fi
+ ;;
+ status)
+ echo "Checking ONOS Status"
+ dsh -g ${basename} "cd $ONOS_DIR; ./start-onos.sh status"
+ ;;
+ esac
+}
+switch () {
+ case "$1" in
+ local)
+ if [ x$2 == "x" -o x$2 == "xall" ]; then
+ echo "set all switches point to local controller"
+ dsh -g ${basename} "$ONOS_DIR/scripts/ctrl-local.sh"
+ else
+ dsh -w ${basename}$2 "$ONOS_DIR/scripts/ctrl-local.sh"
+ fi
+ ;;
+ all)
+ if [ x$2 == "x" -o x$2 == "xall" ]; then
+ echo "set all non-core switches point to all non-core controllers"
+ dsh -g ${basename} -x ${basename}1 "$ONOS_DIR/scripts/ctrl-add-ext.sh"
+ else
+ dsh -w ${basename}$2 "$ONOS_DIR/scripts/ctrl-add-ext.sh"
+ fi
+ ;;
+ none)
+ if [ x$2 == "x" -o x$2 == "xall" ]; then
+ echo "all non-core switches loose controller"
+ dsh -g ${basename} -x ${basename}1 "$ONOS_DIR/scripts/ctrl-none.sh"
+ else
+ dsh -w ${basename}$2 "$ONOS_DIR/scripts/ctrl-none.sh"
+ fi
+ ;;
+ esac
+}
diff --git a/cluster-mgmt/bin/known_hosts.sh b/cluster-mgmt/bin/known_hosts.sh
new file mode 100755
index 0000000..7113a8d
--- /dev/null
+++ b/cluster-mgmt/bin/known_hosts.sh
@@ -0,0 +1,4 @@
+#! /bin/bash
+. ${HOME}/bin/func.sh
+
+dsh -g ${basename} 'for i in `seq 1 25`; do ssh-keyscan 1.1.$i.1 >> ${HOME}/.ssh/known_hosts; done'
diff --git a/cluster-mgmt/bin/onos b/cluster-mgmt/bin/onos
new file mode 100755
index 0000000..b2033ad
--- /dev/null
+++ b/cluster-mgmt/bin/onos
@@ -0,0 +1,5 @@
+#! /bin/bash
+. `dirname $0`/func.sh
+
+#$0 $1 $2
+`basename $0` $1 $2
diff --git a/cluster-mgmt/bin/pingall-speedup.sh b/cluster-mgmt/bin/pingall-speedup.sh
new file mode 100755
index 0000000..9bec6ba
--- /dev/null
+++ b/cluster-mgmt/bin/pingall-speedup.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+if [ $# != 1 ]; then
+ echo "$0 flowdef_file"
+elif [ ! -f ${HOME}/ONOS/web/$1 ]; then
+ echo "no such flowdef file: $1"
+fi
+logfile="/tmp/.$USER.pingall.result.$$"
+echo "Raw data at $logfile"
+dsh "cd ONOS/web; ./pingallm-local.py $1" > $logfile
+cat $logfile | grep "Pingall flow" | sort -n -k 4
+cat $logfile | grep "Pingall Result" | awk '{s+=$5; f+=$7; i+=$9}END{printf("Pingall Result: success %d fail %d incomplete %d\n",s,f,i)}'
+
diff --git a/cluster-mgmt/bin/ssh_exec b/cluster-mgmt/bin/ssh_exec
new file mode 100755
index 0000000..da1f210
--- /dev/null
+++ b/cluster-mgmt/bin/ssh_exec
@@ -0,0 +1,4 @@
+#! /bin/bash
+. ${HOME}/bin/func.sh
+
+ssh `basename $0`
diff --git a/cluster-mgmt/bin/start.sh b/cluster-mgmt/bin/start.sh
new file mode 100755
index 0000000..277d69b
--- /dev/null
+++ b/cluster-mgmt/bin/start.sh
@@ -0,0 +1,15 @@
+#! /bin/bash
+. $HOME/bin/func.sh
+
+onos stop
+cassandra cleandb
+
+db_status=`cassandra checkdb |grep OK | wc -l`
+if [ $db_status != 1 ];then
+ echo $db_status
+ echo "Cassandra DB was screwed up. Need DB key drop"
+ exit
+fi
+onos start
+switch local
+#dsh -g $basename 'cd ONOS; ./ctrl-local.sh'
diff --git a/cluster-mgmt/bin/status.sh b/cluster-mgmt/bin/status.sh
new file mode 100755
index 0000000..d9a3ca2
--- /dev/null
+++ b/cluster-mgmt/bin/status.sh
@@ -0,0 +1,6 @@
+#! /bin/bash
+. $HOME/bin/func.sh
+
+onos status
+cassandra status
+zk status
diff --git a/cluster-mgmt/bin/stop.sh b/cluster-mgmt/bin/stop.sh
new file mode 100755
index 0000000..c76266a
--- /dev/null
+++ b/cluster-mgmt/bin/stop.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+. $HOME/bin/func.sh
+
+onos stop
+cassandra cleandb
+cassandra stop
+zk stop
diff --git a/cluster-mgmt/bin/switch b/cluster-mgmt/bin/switch
new file mode 100755
index 0000000..262c936
--- /dev/null
+++ b/cluster-mgmt/bin/switch
@@ -0,0 +1,5 @@
+#! /bin/bash
+. ${HOME}/bin/func.sh
+
+#$0 $1 $2
+`basename $0` $1 $2
diff --git a/cluster-mgmt/bin/test-link-failure.sh b/cluster-mgmt/bin/test-link-failure.sh
new file mode 100755
index 0000000..4db887a
--- /dev/null
+++ b/cluster-mgmt/bin/test-link-failure.sh
@@ -0,0 +1,54 @@
+#! /bin/sh
+basename=$ONOS_CLUSTER_BASENAME
+wait=10
+
+fdef="flowdef_8node_42.txt"
+
+function log()
+{
+ date > error.$1.$2.log
+ check_status.py >> error.$1.$2.log
+ dsh -w ${basename}1 "cd ONOS/web; ./get_flow.py all" >> error.$1.$2.log
+ dsh "cd ONOS/scripts; ./showflow.sh" >> error.$1.$2.log
+}
+
+echo "all links up"
+dsh -w ${basename}1 "cd ONOS/scripts; ./all-linkup.sh"
+echo "clean up flow"
+dsh -w ${basename}1 "cd ONOS/web; ./delete_flow.py 1 100"
+sleep 1
+dsh -w ${basename}1 "cd ONOS/web; ./get_flow.py all"
+dsh "cd ONOS/scripts; ./delflow.sh"
+echo "checkup status"
+check_status.py
+read -p "hit anykey> "
+
+echo "install pre-set flows"
+dsh -w ${basename}1 "cd ONOS/web; ./add_flow.py -m onos -f $fdef"
+sleep 6
+echo "check"
+dsh -w ${basename}1 "cd ONOS/web; ./pingall.py $fdef"
+
+#ports=`dsh -w ${basename}1 "cd ONOS/scripts; ./listports.sh" | awk '{print $2}' |grep -v tap`
+operation=("sw3-eth3 down" "sw4-eth4 down" "sw4-eth3 down" "sw3-eth3 up" "sw1-eth2 down" "sw4-eth4 up" "sw4-eth3 up" "sw1-eth2 up")
+
+((n=0))
+while [ 1 ] ; do
+ for (( i = 0; i< ${#operation[@]}; i ++)); do
+ echo "Test $n-$i"
+ p=`echo ${operation[$i]}`
+ echo "operation: $p"
+# read -p "hit anykey> "
+ dsh -w ${basename}1 "sudo ifconfig $p"
+ echo "wait $wait sec"
+ sleep $wait
+ result=`dsh -w ${basename}1 "cd ONOS/web; ./pingall.py $fdef"`
+ echo $result
+ nr_fail=`echo $result |grep fail | wc -l`
+ if [ $nr_fail -gt 0 ]; then
+ log $n $i
+ fi
+ done
+ ((n++))
+done
+
diff --git a/cluster-mgmt/bin/zk b/cluster-mgmt/bin/zk
new file mode 100755
index 0000000..b2033ad
--- /dev/null
+++ b/cluster-mgmt/bin/zk
@@ -0,0 +1,5 @@
+#! /bin/bash
+. `dirname $0`/func.sh
+
+#$0 $1 $2
+`basename $0` $1 $2
diff --git a/cluster-mgmt/common/authorized_keys b/cluster-mgmt/common/authorized_keys
new file mode 100644
index 0000000..0e3693f
--- /dev/null
+++ b/cluster-mgmt/common/authorized_keys
@@ -0,0 +1,3 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCTlBTIOKm30b7TsCgIT+xjq42q0zwG+EohOGkCtNr1eGkS9OZDYwkNAkPtpzYtZJ914oRL29JiXFm+OsAfwVKsY2yZlV+tcnTx4Djfhgs6/wURMhw3sOovWu2iAoPAhQYvvvq8maD8ZvybYTzq4yHNP27G7rv4s+GCtv3bXOgzsKd8Zkg0+tGZYuCks5mNimlfWGBlA5jI9MEkd0nWTqSTRj8IkfhJo26HralR+X/KwHGryfxjG9rsyqoZGnVC/xV4KOOtZlVRzTVxCDFPj86lO4dzf7Tt+dst/t/9u/V2d7YxnuhaM+Sarve+6f/tZoekWzpNRGGT9h7FzT7Osg+l onlab-gui
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEHmYMw6DugE6FCoLR5fdTO7iQfouHmLm60yxSjXu/wnBGmM7SGc1AAgmtr6JaEPYj8H6g7AL8+wFrbj7TXOoMD4HWoEzC/PuTZ5JgyCeTK/rmYdBlbAqBbLeD1d9q35O+GnWOsLIsSQHcKvKZveLLPTBtzJ6em9NfgiPKibbsAFD716w++cxXKHabzHw7KB9XaewoYdznrosWwU3TXR4C2rzMAimh6XuBLZ0xFTNF4nFhy+H0AWUEN8dY8NHwAMGlAWK4g7phZ2cQhgU4GeutfGlEKlKT3iT7j8rkW1JKsx/AOVfcnozuHCm76jYD5qXcizHeS4BYinXRepGY7mfn onlabkey
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3QgAX4yEcOHaKFgeq/tD2lbGg5VbNvRka1atUSd5q8hhtw5rB8um5Q5Z6+AfL83+Xlez2KonH6JLjhhs8wBHaJCVbzvDnycMEEHg12o+MvlKgKTkkSqP9W+Jejk4YGIr6QOQ/yzZRhRGoNGMaqI6KU7NjtgZyZs8h66GTyoBeXi9TZwGYdxeF5rVqZD80nlb+xlc+PUC4TQ/o2RnGej7S0J/+ES+/X6LiNgHyZPdFK2Pr4BilLwS8c5EyAHHQuW8hIcPhNwXgrx97f5L8yuNKAmW9WSYLk0r4DhnFUZrvIGqh3isxtnJDDf3UZ2U+PtGZ75ZNfk546obsuyc/IwHH ubuntu@onos9vpc
diff --git a/cluster-mgmt/common/hosts b/cluster-mgmt/common/hosts
new file mode 100644
index 0000000..220b30f
--- /dev/null
+++ b/cluster-mgmt/common/hosts
@@ -0,0 +1,11 @@
+127.0.0.1 localhost
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
+
+## For ONOS Development
diff --git a/cluster-mgmt/common/known_hosts b/cluster-mgmt/common/known_hosts
new file mode 100644
index 0000000..bc8d892
--- /dev/null
+++ b/cluster-mgmt/common/known_hosts
@@ -0,0 +1,2 @@
+|1|vpuCVwBaUAW338i8XkTyuZpPn3o=|OEtDpg0rUr4I6MJrPU3UgO6xIjY= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
+|1|oQEfymNRsrXOo9uHu/jCST0f0I0=|UqxLCIvwPdgIlZWmusieRLCzRxE= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvCFIZTznMUPbS/r6b0Gw9jcnOBbH21wcBKETjXg9U5bMwHz2ocnEK8PPL1EK8uUTjZ3Kbilx4Jeio8HXEWtUkyOF/KyW1nXd0mxrWqqGQjFlpPj017Wfo0KIISgCWB9L8RJJ3aJ0selZwvmdHmg7uS306UGsJf1co2qubLGMAsdjPhYpvKXSJHoThupHBCuoqqOw80Tt5b3qJ6RwFjt/QiCgom9KoQn2DMQhS0iB9h5NHpejDX9/qLgFFiF3PdXaBCTE+vFLvoXwecp/x3pP2c8zA6FhCzYbZxLYMdMHqSmJRSKALWU3Qg9ekdXUBfzrLs4lPQ6UGFcku9WBAtN7oQ==
diff --git a/cluster-mgmt/common/zoo.cfg b/cluster-mgmt/common/zoo.cfg
new file mode 100644
index 0000000..c4e1eb3
--- /dev/null
+++ b/cluster-mgmt/common/zoo.cfg
@@ -0,0 +1,45 @@
+# The number of milliseconds of each tick
+tickTime=2000
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=10
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=5
+# the directory where the snapshot is stored.
+# do not use /tmp for storage, /tmp here is just
+# example sakes.
+dataDir=/var/lib/zookeeper
+# the port at which the clients will connect
+clientPort=2181
+#
+# specify all servers in the Zookeeper ensemble
+
+#server.1=onosgui1:2888:3888
+#server.2=onosgui2:2888:3888
+#server.3=onosgui3:2888:3888
+#server.4=onosgui4:2888:3888
+#server.5=onosgui5:2888:3888
+#server.6=onosgui6:2888:3888
+#server.7=onosgui7:2888:3888
+#server.8=onosgui8:2888:3888
+#
+#
+# Be sure to read the maintenance section of the
+# administrator guide before turning on autopurge.
+#
+#
+# Be sure to read the maintenance section of the
+# administrator guide before turning on autopurge.
+#
+# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
+#
+# The number of snapshots to retain in dataDir
+#autopurge.snapRetainCount=3
+# Purge task interval in hours
+# Set to "0" to disable auto purge feature
+#autopurge.purgeInterval=1
+server.1=test1:2888:3888
+server.2=test2:2888:3888
+server.3=test3:2888:3888
+server.4=test4:2888:3888
diff --git a/cluster-mgmt/cp-config.sh b/cluster-mgmt/cp-config.sh
new file mode 100755
index 0000000..e6db9d3
--- /dev/null
+++ b/cluster-mgmt/cp-config.sh
@@ -0,0 +1,63 @@
+#! /bin/bash
+USERNAME=ubuntu
+CASSANDRA_DIR='/home/ubuntu/apache-cassandra-1.1.4'
+ZK_DIR='/home/ubuntu/zookeeper-3.4.5'
+ZK_LIB='/var/lib/zookeeper'
+CASSANDRA_LIB='/var/lib/cassandra'
+
+SSH_COPY="authorized_keys id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem"
+
+if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
+ exit
+fi
+
+basename=$ONOS_CLUSTER_BASENAME
+NR_NODES=$ONOS_CLUSTER_NR_NODES
+
+dsh -g $basename 'uname -a'
+
+echo "Stopping Services"
+#dsh -g $basename 'cd ONOS; ./start-onos.sh stop'
+#dsh -g $basename 'cd ONOS; ./stop-cassandra stop'
+#dsh -g $basename '$ZK_DIR/bin/zkServer.sh stop'
+
+# authorized_keys cassandra.yaml hosts id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem zoo.cfg
+## SSH Setting
+dsh -g $basename 'mkdir -m 700 .ssh'
+for n in $SSH_COPY; do
+ pcp -g $basename common/$n '.ssh'
+ if [ $n != "id_rsa.pub" ] ; then
+ dsh -g $basename "chmod 600 .ssh/$n"
+ fi
+done
+
+dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/commitlog/*"
+dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/saved_caches/*"
+dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/data/*"
+dsh -g $basename "sudo chown -R $username:$username $CASSANDRA_LIB"
+
+dsh -g $basename "sudo rm -rf $ZK_LIB/version-2*"
+dsh -g $basename "sudo rm -rf $ZK_LIB/myid"
+
+pcp -g $basename common/cassandra.yaml $CASSANDRA_DIR/conf
+pcp -g $basename common/zoo.cfg $ZK_DIR/conf
+pcp -g $basename common/hosts '~'
+
+for n in `seq 1 $NR_NODES`; do
+ pcp -w ${basename}${n} ${basename}${n}/hostname '~'
+ pcp -w ${basename}${n} ${basename}${n}/myid $ZK_DIR/conf
+done
+
+dsh -g $basename 'sudo cp ~/hostname /etc'
+dsh -g $basename 'sudo cp ~/hosts /etc'
+dsh -g $basename "cd $ZK_LIB; sudo ln -s $ZK_DIR/conf/myid"
+
+dsh -g $basename 'sudo hostname `cat /etc/hostname`'
+
+#for n in `seq 2 $NR_NODES`; do
+# pcp -w ${basename}${n} ${basename}${n}/onsdemo_edge.py 'ONOS/test-network/mininet'
+# pcp -w ${basename}${n} ${basename}${n}/tunnel_onos_edge.sh 'ONOS/test-network/mininet'
+#done
+#pcp -w ${basename}1 ${basename}1/tunnel_onos_core.sh 'ONOS/test-network/mininet'
+#pcp -w ${basename}1 ${basename}1/onsdemo_core.py 'ONOS/test-network/mininet'
diff --git a/cluster-mgmt/cp-mininet.sh b/cluster-mgmt/cp-mininet.sh
new file mode 100755
index 0000000..b7307c0
--- /dev/null
+++ b/cluster-mgmt/cp-mininet.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+USERNAME=ubuntu
+CASSANDRA_DIR='/home/ubuntu/apache-cassandra-1.1.4'
+ZK_DIR='/home/ubuntu/zookeeper-3.4.5'
+ZK_LIB='/var/lib/zookeeper'
+CASSANDRA_LIB='/var/lib/cassandra'
+
+if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
+ exit
+fi
+
+basename=$ONOS_CLUSTER_BASENAME
+NR_NODES=$ONOS_CLUSTER_NR_NODES
+
+dsh -g $basename 'uname -a'
+
+for n in `seq 1 $NR_NODES`; do
+ pcp -w ${basename}${n} ${basename}${n}/onsdemo.py 'ONOS/test-network/mininet'
+ pcp -w ${basename}${n} ${basename}${n}/tunnel_onsdemo.sh 'ONOS/test-network/mininet'
+done
+dsh -g $basename 'chmod 755 ONOS/test-network/mininet/tunnel_onsdemo.sh'
+dsh -g $basename 'chmod 755 ONOS/test-network/mininet/onsdemo.py'
diff --git a/cluster-mgmt/make-config.sh b/cluster-mgmt/make-config.sh
new file mode 100755
index 0000000..5e0794f
--- /dev/null
+++ b/cluster-mgmt/make-config.sh
@@ -0,0 +1,60 @@
+#! /bin/bash
+USERNAME=ubuntu
+if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
+ exit
+elif [ $# != 1 ]; then
+ echo "$0 hostfile"
+ exit
+fi
+
+basename=$ONOS_CLUSTER_BASENAME
+NR_NODES=$ONOS_CLUSTER_NR_NODES
+hosts_file=$1
+
+for n in `seq 1 $NR_NODES`; do
+ rm -rf ${basename}${n}
+ mkdir ${basename}${n}
+ echo "${basename}${n}" > ${basename}${n}/hostname
+ echo $n > ${basename}${n}/myid
+done
+
+## ZK config ##
+cp template/zoo.cfg common/
+for n in `seq 1 $NR_NODES`; do
+ echo "server.${n}=${basename}${n}:2888:3888"
+done >> common/zoo.cfg
+
+## Cassandra config ##
+cat template/cassandra.yaml |\
+ sed "s/__SEED__/${basename}1/g" > common/cassandra.yaml
+
+## /etc/hosts ##
+cat template/hosts $hosts_file > common/hosts
+
+
+## .ssh/known_hosts ##
+ssh-keyscan -H -t rsa github.com > common/known_hosts
+ssh-keyscan -H -t rsa onosnat >> common/known_hosts
+for n in `seq 1 $NR_NODES`; do
+ ssh-keyscan -H -t rsa ${basename}${n}
+done >> common/known_hosts
+
+echo "GROUP: $basename" > bin/cluster.txt
+cat $hosts_file | awk '{print $2}' >> bin/cluster.txt
+
+
+## Creating shell script to login each node ##
+for n in `seq 1 $NR_NODES`; do
+ cat << EOF > bin/${basename}${n}
+#!/bin/sh
+ssh $USERNAME@${basename}${n}
+EOF
+ chmod 755 bin/${basename}${n}
+done
+
+echo "======================================"
+echo "Do not forget to do the following"
+echo "paste $hosts_file to /etc/hosts"
+echo "paste cluster.txt to your CLUSTER file"
+echo "======================================"
diff --git a/cluster-mgmt/make-mininet.sh b/cluster-mgmt/make-mininet.sh
new file mode 100755
index 0000000..207b89e
--- /dev/null
+++ b/cluster-mgmt/make-mininet.sh
@@ -0,0 +1,39 @@
+#! /bin/bash
+if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
+ exit
+elif [ $# != 1 ]; then
+ echo "$0 hostfile"
+ exit
+fi
+
+basename=$ONOS_CLUSTER_BASENAME
+## Shell Var can't handle "-" so replace it with "_"
+basename_var=`echo $ONOS_CLUSTER_BASENAME | sed 's/\-/_/g'`
+
+NR_NODES=$ONOS_CLUSTER_NR_NODES
+hosts_file=$1
+
+for n in `seq 2 $NR_NODES`; do
+ if [ $n == 2 ]; then
+ nrsw=50
+ else
+ nrsw=25
+ fi
+ cat template/onsdemo_edge_template.py | sed "s/__NWID__/$n/g" | sed "s/__NRSW__/${nrsw}/g" > ${basename}${n}/onsdemo.py
+done
+cp template/onsdemo_core.py ${basename}1/onsdemo.py
+
+## Shell var can't handle "-" so replace it with "_"
+cat $hosts_file | sed 's/\-/\_/g' | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
+
+for n in `seq 2 $NR_NODES`; do
+ cat template/tunnel_onsdemo_edge_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
+ sed "s/__NWID__/$n/g" |\
+ sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename_var}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh
+ chmod 755 ${basename}${n}/tunnel_onsdemo.sh
+done
+
+cat template/tunnel_onsdemo_core_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
+ sed "s/__basename__/${basename_var}/g" > ${basename}1/tunnel_onsdemo.sh
+ chmod 755 ${basename}1/tunnel_onsdemo.sh
diff --git a/cluster-mgmt/ssh/authorized_keys b/cluster-mgmt/ssh/authorized_keys
new file mode 100644
index 0000000..f723bc2
--- /dev/null
+++ b/cluster-mgmt/ssh/authorized_keys
@@ -0,0 +1,2 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCTlBTIOKm30b7TsCgIT+xjq42q0zwG+EohOGkCtNr1eGkS9OZDYwkNAkPtpzYtZJ914oRL29JiXFm+OsAfwVKsY2yZlV+tcnTx4Djfhgs6/wURMhw3sOovWu2iAoPAhQYvvvq8maD8ZvybYTzq4yHNP27G7rv4s+GCtv3bXOgzsKd8Zkg0+tGZYuCks5mNimlfWGBlA5jI9MEkd0nWTqSTRj8IkfhJo26HralR+X/KwHGryfxjG9rsyqoZGnVC/xV4KOOtZlVRzTVxCDFPj86lO4dzf7Tt+dst/t/9u/V2d7YxnuhaM+Sarve+6f/tZoekWzpNRGGT9h7FzT7Osg+l onlab-gui
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEHmYMw6DugE6FCoLR5fdTO7iQfouHmLm60yxSjXu/wnBGmM7SGc1AAgmtr6JaEPYj8H6g7AL8+wFrbj7TXOoMD4HWoEzC/PuTZ5JgyCeTK/rmYdBlbAqBbLeD1d9q35O+GnWOsLIsSQHcKvKZveLLPTBtzJ6em9NfgiPKibbsAFD716w++cxXKHabzHw7KB9XaewoYdznrosWwU3TXR4C2rzMAimh6XuBLZ0xFTNF4nFhy+H0AWUEN8dY8NHwAMGlAWK4g7phZ2cQhgU4GeutfGlEKlKT3iT7j8rkW1JKsx/AOVfcnozuHCm76jYD5qXcizHeS4BYinXRepGY7mfn onlabkey
diff --git a/cluster-mgmt/ssh/id_rsa.pub b/cluster-mgmt/ssh/id_rsa.pub
new file mode 100644
index 0000000..bcb2d75
--- /dev/null
+++ b/cluster-mgmt/ssh/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3QgAX4yEcOHaKFgeq/tD2lbGg5VbNvRka1atUSd5q8hhtw5rB8um5Q5Z6+AfL83+Xlez2KonH6JLjhhs8wBHaJCVbzvDnycMEEHg12o+MvlKgKTkkSqP9W+Jejk4YGIr6QOQ/yzZRhRGoNGMaqI6KU7NjtgZyZs8h66GTyoBeXi9TZwGYdxeF5rVqZD80nlb+xlc+PUC4TQ/o2RnGej7S0J/+ES+/X6LiNgHyZPdFK2Pr4BilLwS8c5EyAHHQuW8hIcPhNwXgrx97f5L8yuNKAmW9WSYLk0r4DhnFUZrvIGqh3isxtnJDDf3UZ2U+PtGZ75ZNfk546obsuyc/IwHH ubuntu@onos9vpc
diff --git a/cluster-mgmt/start-mininet.sh b/cluster-mgmt/start-mininet.sh
new file mode 100755
index 0000000..e226c39
--- /dev/null
+++ b/cluster-mgmt/start-mininet.sh
@@ -0,0 +1,21 @@
+#! /bin/bash
+USERNAME=ubuntu
+CASSANDRA_DIR='/home/ubuntu/apache-cassandra-1.1.4'
+ZK_DIR='/home/ubuntu/zookeeper-3.4.5'
+ZK_LIB='/var/lib/zookeeper'
+CASSANDRA_LIB='/var/lib/cassandra'
+
+if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then
+ echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES"
+ exit
+fi
+
+basename=$ONOS_CLUSTER_BASENAME
+NR_NODES=$ONOS_CLUSTER_NR_NODES
+
+dsh -g $basename 'uname -a'
+
+dsh -g ${basename} 'cd ONOS/test-network/mininet; ./tunnel_onsdemo.sh start'
+dsh -g ${basename} 'cd ONOS/test-network/mininet; ./tunnel_onsdemo.sh start'
+dsh -g ${basename} 'cd ONOS/test-network/mininet; sudo mn -c'
+dsh -g ${basename} 'cd ONOS/test-network/mininet; sudo ./onsdemo.py -n'
diff --git a/cluster-mgmt/template/cassandra.yaml b/cluster-mgmt/template/cassandra.yaml
new file mode 100644
index 0000000..ab79cdc
--- /dev/null
+++ b/cluster-mgmt/template/cassandra.yaml
@@ -0,0 +1,568 @@
+# Cassandra storage config YAML
+
+# NOTE:
+# See http://wiki.apache.org/cassandra/StorageConfiguration for
+# full explanations of configuration directives
+# /NOTE
+
+# The name of the cluster. This is mainly used to prevent machines in
+# one logical cluster from joining another.
+cluster_name: 'ONOS Test Cluster'
+
+# You should always specify InitialToken when setting up a production
+# cluster for the first time, and often when adding capacity later.
+# The principle is that each node should be given an equal slice of
+# the token ring; see http://wiki.apache.org/cassandra/Operations
+# for more details.
+#
+# If blank, Cassandra will request a token bisecting the range of
+# the heaviest-loaded existing node. If there is no load information
+# available, such as is the case with a new cluster, it will pick
+# a random token, which will lead to hot spots.
+initial_token:
+
+# See http://wiki.apache.org/cassandra/HintedHandoff
+hinted_handoff_enabled: true
+# this defines the maximum amount of time a dead host will have hints
+# generated. After it has been dead this long, hints will be dropped.
+max_hint_window_in_ms: 3600000 # one hour
+# Sleep this long after delivering each hint
+hinted_handoff_throttle_delay_in_ms: 1
+
+# The following setting populates the page cache on memtable flush and compaction
+# WARNING: Enable this setting only when the whole node's data fits in memory.
+# Defaults to: false
+# populate_io_cache_on_flush: false
+
+# authentication backend, implementing IAuthenticator; used to identify users
+authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
+
+# authorization backend, implementing IAuthority; used to limit access/provide permissions
+authority: org.apache.cassandra.auth.AllowAllAuthority
+
+# The partitioner is responsible for distributing rows (by key) across
+# nodes in the cluster. Any IPartitioner may be used, including your
+# own as long as it is on the classpath. Out of the box, Cassandra
+# provides org.apache.cassandra.dht.RandomPartitioner
+# org.apache.cassandra.dht.ByteOrderedPartitioner,
+# org.apache.cassandra.dht.OrderPreservingPartitioner (deprecated),
+# and org.apache.cassandra.dht.CollatingOrderPreservingPartitioner
+# (deprecated).
+#
+# - RandomPartitioner distributes rows across the cluster evenly by md5.
+# When in doubt, this is the best option.
+# - ByteOrderedPartitioner orders rows lexically by key bytes. BOP allows
+# scanning rows in key order, but the ordering can generate hot spots
+# for sequential insertion workloads.
+# - OrderPreservingPartitioner is an obsolete form of BOP, that stores
+# - keys in a less-efficient format and only works with keys that are
+# UTF8-encoded Strings.
+# - CollatingOPP colates according to EN,US rules rather than lexical byte
+# ordering. Use this as an example if you need custom collation.
+#
+# See http://wiki.apache.org/cassandra/Operations for more on
+# partitioners and token selection.
+partitioner: org.apache.cassandra.dht.RandomPartitioner
+
+# directories where Cassandra should store data on disk.
+data_file_directories:
+ - /var/lib/cassandra/data
+
+# commit log
+commitlog_directory: /var/lib/cassandra/commitlog
+
+# Maximum size of the key cache in memory.
+#
+# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the
+# minimum, sometimes more. The key cache is fairly tiny for the amount of
+# time it saves, so it's worthwhile to use it at large numbers.
+# The row cache saves even more time, but must store the whole values of
+# its rows, so it is extremely space-intensive. It's best to only use the
+# row cache if you have hot rows or static rows.
+#
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache.
+key_cache_size_in_mb:
+
+# Duration in seconds after which Cassandra should
+# safe the keys cache. Caches are saved to saved_caches_directory as
+# specified in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 14400 or 4 hours.
+key_cache_save_period: 14400
+
+# Number of keys from the key cache to save
+# Disabled by default, meaning all keys are going to be saved
+# key_cache_keys_to_save: 100
+
+# Maximum size of the row cache in memory.
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is 0, to disable row caching.
+row_cache_size_in_mb: 0
+
+# Duration in seconds after which Cassandra should
+# safe the row cache. Caches are saved to saved_caches_directory as specified
+# in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 0 to disable saving the row cache.
+row_cache_save_period: 0
+
+# Number of keys from the row cache to save
+# Disabled by default, meaning all keys are going to be saved
+# row_cache_keys_to_save: 100
+
+# The provider for the row cache to use.
+#
+# Supported values are: ConcurrentLinkedHashCacheProvider, SerializingCacheProvider
+#
+# SerializingCacheProvider serialises the contents of the row and stores
+# it in native memory, i.e., off the JVM Heap. Serialized rows take
+# significantly less memory than "live" rows in the JVM, so you can cache
+# more rows in a given memory footprint. And storing the cache off-heap
+# means you can use smaller heap sizes, reducing the impact of GC pauses.
+#
+# It is also valid to specify the fully-qualified class name to a class
+# that implements org.apache.cassandra.cache.IRowCacheProvider.
+#
+# Defaults to SerializingCacheProvider
+row_cache_provider: SerializingCacheProvider
+
+# saved caches
+saved_caches_directory: /var/lib/cassandra/saved_caches
+
+# commitlog_sync may be either "periodic" or "batch."
+# When in batch mode, Cassandra won't ack writes until the commit log
+# has been fsynced to disk. It will wait up to
+# commitlog_sync_batch_window_in_ms milliseconds for other writes, before
+# performing the sync.
+#
+# commitlog_sync: batch
+# commitlog_sync_batch_window_in_ms: 50
+#
+# the other option is "periodic" where writes may be acked immediately
+# and the CommitLog is simply synced every commitlog_sync_period_in_ms
+# milliseconds.
+commitlog_sync: periodic
+commitlog_sync_period_in_ms: 10000
+
+# The size of the individual commitlog file segments. A commitlog
+# segment may be archived, deleted, or recycled once all the data
+# in it (potentally from each columnfamily in the system) has been
+# flushed to sstables.
+#
+# The default size is 32, which is almost always fine, but if you are
+# archiving commitlog segments (see commitlog_archiving.properties),
+# then you probably want a finer granularity of archiving; 8 or 16 MB
+# is reasonable.
+commitlog_segment_size_in_mb: 32
+
+# any class that implements the SeedProvider interface and has a
+# constructor that takes a Map<String, String> of parameters will do.
+seed_provider:
+ # Addresses of hosts that are deemed contact points.
+ # Cassandra nodes use this list of hosts to find each other and learn
+ # the topology of the ring. You must change this if you are running
+ # multiple nodes!
+ - class_name: org.apache.cassandra.locator.SimpleSeedProvider
+ parameters:
+ # seeds is actually a comma-delimited list of addresses.
+ # Ex: "<ip1>,<ip2>,<ip3>"
+# - seeds: "10.0.1.243"
+ - seeds: "__SEED__"
+
+# emergency pressure valve: each time heap usage after a full (CMS)
+# garbage collection is above this fraction of the max, Cassandra will
+# flush the largest memtables.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+#
+# RELYING ON THIS AS YOUR PRIMARY TUNING MECHANISM WILL WORK POORLY:
+# it is most effective under light to moderate load, or read-heavy
+# workloads; under truly massive write load, it will often be too
+# little, too late.
+flush_largest_memtables_at: 0.75
+
+# emergency pressure valve #2: the first time heap usage after a full
+# (CMS) garbage collection is above this fraction of the max,
+# Cassandra will reduce cache maximum _capacity_ to the given fraction
+# of the current _size_. Should usually be set substantially above
+# flush_largest_memtables_at, since that will have less long-term
+# impact on the system.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+reduce_cache_sizes_at: 0.85
+reduce_cache_capacity_to: 0.6
+
+# For workloads with more data than can fit in memory, Cassandra's
+# bottleneck will be reads that need to fetch data from
+# disk. "concurrent_reads" should be set to (16 * number_of_drives) in
+# order to allow the operations to enqueue low enough in the stack
+# that the OS and drives can reorder them.
+#
+# On the other hand, since writes are almost never IO bound, the ideal
+# number of "concurrent_writes" is dependent on the number of cores in
+# your system; (8 * number_of_cores) is a good rule of thumb.
+concurrent_reads: 16
+concurrent_writes: 16
+
+# Total memory to use for memtables. Cassandra will flush the largest
+# memtable when this much memory is used.
+# If omitted, Cassandra will set it to 1/3 of the heap.
+# memtable_total_space_in_mb: 2048
+
+# Total space to use for commitlogs. Since commitlog segments are
+# mmapped, and hence use up address space, the default size is 32
+# on 32-bit JVMs, and 1024 on 64-bit JVMs.
+#
+# If space gets above this value (it will round up to the next nearest
+# segment multiple), Cassandra will flush every dirty CF in the oldest
+# segment and remove it. So a small total commitlog space will tend
+# to cause more flush activity on less-active columnfamilies.
+# commitlog_total_space_in_mb: 4096
+
+# This sets the amount of memtable flush writer threads. These will
+# be blocked by disk io, and each one will hold a memtable in memory
+# while blocked. If you have a large heap and many data directories,
+# you can increase this value for better flush performance.
+# By default this will be set to the amount of data directories defined.
+#memtable_flush_writers: 1
+
+# the number of full memtables to allow pending flush, that is,
+# waiting for a writer thread. At a minimum, this should be set to
+# the maximum number of secondary indexes created on a single CF.
+memtable_flush_queue_size: 4
+
+# Whether to, when doing sequential writing, fsync() at intervals in
+# order to force the operating system to flush the dirty
+# buffers. Enable this to avoid sudden dirty buffer flushing from
+# impacting read latencies. Almost always a good idea on SSD:s; not
+# necessarily on platters.
+trickle_fsync: false
+trickle_fsync_interval_in_kb: 10240
+
+# TCP port, for commands and data
+storage_port: 7000
+
+# SSL port, for encrypted communication. Unused unless enabled in
+# encryption_options
+ssl_storage_port: 7001
+
+# Address to bind to and tell other Cassandra nodes to connect to. You
+# _must_ change this if you want multiple nodes to be able to
+# communicate!
+#
+# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
+# will always do the Right Thing *if* the node is properly configured
+# (hostname, name resolution, etc), and the Right Thing is to use the
+# address associated with the hostname (it might not be).
+#
+# Setting this to 0.0.0.0 is always wrong.
+listen_address:
+
+# Address to broadcast to other Cassandra nodes
+# Leaving this blank will set it to the same value as listen_address
+# broadcast_address: 1.2.3.4
+
+# The address to bind the Thrift RPC service to -- clients connect
+# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
+# you want Thrift to listen on all interfaces.
+#
+# Leaving this blank has the same effect it does for ListenAddress,
+# (i.e. it will be based on the configured hostname of the node).
+rpc_address: 0.0.0.0
+# port for Thrift to listen for clients on
+rpc_port: 9160
+
+# enable or disable keepalive on rpc connections
+rpc_keepalive: true
+
+# Cassandra provides three options for the RPC Server:
+#
+# sync -> One connection per thread in the rpc pool (see below).
+# For a very large number of clients, memory will be your limiting
+# factor; on a 64 bit JVM, 128KB is the minimum stack size per thread.
+# Connection pooling is very, very strongly recommended.
+#
+# async -> Nonblocking server implementation with one thread to serve
+# rpc connections. This is not recommended for high throughput use
+# cases. Async has been tested to be about 50% slower than sync
+# or hsha and is deprecated: it will be removed in the next major release.
+#
+# hsha -> Stands for "half synchronous, half asynchronous." The rpc thread pool
+# (see below) is used to manage requests, but the threads are multiplexed
+# across the different clients.
+#
+# The default is sync because on Windows hsha is about 30% slower. On Linux,
+# sync/hsha performance is about the same, with hsha of course using less memory.
+rpc_server_type: sync
+
+# Uncomment rpc_min|max|thread to set request pool size.
+# You would primarily set max for the sync server to safeguard against
+# misbehaved clients; if you do hit the max, Cassandra will block until one
+# disconnects before accepting more. The defaults for sync are min of 16 and max
+# unlimited.
+#
+# For the Hsha server, the min and max both default to quadruple the number of
+# CPU cores.
+#
+# This configuration is ignored by the async server.
+#
+# rpc_min_threads: 16
+# rpc_max_threads: 2048
+
+# uncomment to set socket buffer sizes on rpc connections
+# rpc_send_buff_size_in_bytes:
+# rpc_recv_buff_size_in_bytes:
+
+# Frame size for thrift (maximum field length).
+# 0 disables TFramedTransport in favor of TSocket. This option
+# is deprecated; we strongly recommend using Framed mode.
+thrift_framed_transport_size_in_mb: 15
+
+# The max length of a thrift message, including all fields and
+# internal thrift overhead.
+thrift_max_message_length_in_mb: 16
+
+# Set to true to have Cassandra create a hard link to each sstable
+# flushed or streamed locally in a backups/ subdirectory of the
+# Keyspace data. Removing these links is the operator's
+# responsibility.
+incremental_backups: false
+
+# Whether or not to take a snapshot before each compaction. Be
+# careful using this option, since Cassandra won't clean up the
+# snapshots for you. Mostly useful if you're paranoid when there
+# is a data format change.
+snapshot_before_compaction: false
+
+# Whether or not a snapshot is taken of the data before keyspace truncation
+# or dropping of column families. The STRONGLY advised default of true
+# should be used to provide data safety. If you set this flag to false, you will
+# lose data on truncation or drop.
+auto_snapshot: true
+
+# Add column indexes to a row after its contents reach this size.
+# Increase if your column values are large, or if you have a very large
+# number of columns. The competing causes are, Cassandra has to
+# deserialize this much of the row to read a single column, so you want
+# it to be small - at least if you do many partial-row reads - but all
+# the index data is read for each access, so you don't want to generate
+# that wastefully either.
+column_index_size_in_kb: 64
+
+# Size limit for rows being compacted in memory. Larger rows will spill
+# over to disk and use a slower two-pass compaction process. A message
+# will be logged specifying the row key.
+in_memory_compaction_limit_in_mb: 64
+
+# Number of simultaneous compactions to allow, NOT including
+# validation "compactions" for anti-entropy repair. Simultaneous
+# compactions can help preserve read performance in a mixed read/write
+# workload, by mitigating the tendency of small sstables to accumulate
+# during a single long running compactions. The default is usually
+# fine and if you experience problems with compaction running too
+# slowly or too fast, you should look at
+# compaction_throughput_mb_per_sec first.
+#
+# This setting has no effect on LeveledCompactionStrategy.
+#
+# concurrent_compactors defaults to the number of cores.
+# Uncomment to make compaction mono-threaded, the pre-0.8 default.
+#concurrent_compactors: 1
+
+# Multi-threaded compaction. When enabled, each compaction will use
+# up to one thread per core, plus one thread per sstable being merged.
+# This is usually only useful for SSD-based hardware: otherwise,
+# your concern is usually to get compaction to do LESS i/o (see:
+# compaction_throughput_mb_per_sec), not more.
+multithreaded_compaction: false
+
+# Throttles compaction to the given total throughput across the entire
+# system. The faster you insert data, the faster you need to compact in
+# order to keep the sstable count down, but in general, setting this to
+# 16 to 32 times the rate you are inserting data is more than sufficient.
+# Setting this to 0 disables throttling. Note that this account for all types
+# of compaction, including validation compaction.
+compaction_throughput_mb_per_sec: 16
+
+# Track cached row keys during compaction, and re-cache their new
+# positions in the compacted sstable. Disable if you use really large
+# key caches.
+compaction_preheat_key_cache: true
+
+# Throttles all outbound streaming file transfers on this node to the
+# given total throughput in Mbps. This is necessary because Cassandra does
+# mostly sequential IO when streaming data during bootstrap or repair, which
+# can lead to saturating the network connection and degrading rpc performance.
+# When unset, the default is 400 Mbps or 50 MB/s.
+# stream_throughput_outbound_megabits_per_sec: 400
+
+# Time to wait for a reply from other nodes before failing the command
+rpc_timeout_in_ms: 10000
+
+# Enable socket timeout for streaming operation.
+# When a timeout occurs during streaming, streaming is retried from the start
+# of the current file. This *can* involve re-streaming an important amount of
+# data, so you should avoid setting the value too low.
+# Default value is 0, which never timeout streams.
+# streaming_socket_timeout_in_ms: 0
+
+# phi value that must be reached for a host to be marked down.
+# most users should never need to adjust this.
+# phi_convict_threshold: 8
+
+# endpoint_snitch -- Set this to a class that implements
+# IEndpointSnitch. The snitch has two functions:
+# - it teaches Cassandra enough about your network topology to route
+# requests efficiently
+# - it allows Cassandra to spread replicas around your cluster to avoid
+# correlated failures. It does this by grouping machines into
+# "datacenters" and "racks." Cassandra will do its best not to have
+# more than one replica on the same "rack" (which may not actually
+# be a physical location)
+#
+# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER,
+# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS
+# ARE PLACED.
+#
+# Out of the box, Cassandra provides
+# - SimpleSnitch:
+# Treats Strategy order as proximity. This improves cache locality
+# when disabling read repair, which can further improve throughput.
+# Only appropriate for single-datacenter deployments.
+# - PropertyFileSnitch:
+# Proximity is determined by rack and data center, which are
+# explicitly configured in cassandra-topology.properties.
+# - GossipingPropertyFileSnitch
+# The rack and datacenter for the local node are defined in
+# cassandra-rackdc.properties and propagated to other nodes via gossip. If
+# cassandra-topology.properties exists, it is used as a fallback, allowing
+# migration from the PropertyFileSnitch.
+# - RackInferringSnitch:
+# Proximity is determined by rack and data center, which are
+# assumed to correspond to the 3rd and 2nd octet of each node's
+# IP address, respectively. Unless this happens to match your
+# deployment conventions (as it did Facebook's), this is best used
+# as an example of writing a custom Snitch class.
+# - Ec2Snitch:
+# Appropriate for EC2 deployments in a single Region. Loads Region
+# and Availability Zone information from the EC2 API. The Region is
+# treated as the Datacenter, and the Availability Zone as the rack.
+# Only private IPs are used, so this will not work across multiple
+# Regions.
+# - Ec2MultiRegionSnitch:
+# Uses public IPs as broadcast_address to allow cross-region
+# connectivity. (Thus, you should set seed addresses to the public
+# IP as well.) You will need to open the storage_port or
+# ssl_storage_port on the public IP firewall. (For intra-Region
+# traffic, Cassandra will switch to the private IP after
+# establishing a connection.)
+#
+# You can use a custom Snitch by setting this to the full class name
+# of the snitch, which will be assumed to be on your classpath.
+endpoint_snitch: SimpleSnitch
+
+# controls how often to perform the more expensive part of host score
+# calculation
+dynamic_snitch_update_interval_in_ms: 100
+# controls how often to reset all host scores, allowing a bad host to
+# possibly recover
+dynamic_snitch_reset_interval_in_ms: 600000
+# if set greater than zero and read_repair_chance is < 1.0, this will allow
+# 'pinning' of replicas to hosts in order to increase cache capacity.
+# The badness threshold will control how much worse the pinned host has to be
+# before the dynamic snitch will prefer other replicas over it. This is
+# expressed as a double which represents a percentage. Thus, a value of
+# 0.2 means Cassandra would continue to prefer the static snitch values
+# until the pinned host was 20% worse than the fastest.
+dynamic_snitch_badness_threshold: 0.1
+
+# request_scheduler -- Set this to a class that implements
+# RequestScheduler, which will schedule incoming client requests
+# according to the specific policy. This is useful for multi-tenancy
+# with a single Cassandra cluster.
+# NOTE: This is specifically for requests from the client and does
+# not affect inter node communication.
+# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
+# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
+# client requests to a node with a separate queue for each
+# request_scheduler_id. The scheduler is further customized by
+# request_scheduler_options as described below.
+request_scheduler: org.apache.cassandra.scheduler.NoScheduler
+
+# Scheduler Options vary based on the type of scheduler
+# NoScheduler - Has no options
+# RoundRobin
+# - throttle_limit -- The throttle_limit is the number of in-flight
+# requests per client. Requests beyond
+# that limit are queued up until
+# running requests can complete.
+# The value of 80 here is twice the number of
+# concurrent_reads + concurrent_writes.
+# - default_weight -- default_weight is optional and allows for
+# overriding the default which is 1.
+# - weights -- Weights are optional and will default to 1 or the
+# overridden default_weight. The weight translates into how
+# many requests are handled during each turn of the
+# RoundRobin, based on the scheduler id.
+#
+# request_scheduler_options:
+# throttle_limit: 80
+# default_weight: 5
+# weights:
+# Keyspace1: 1
+# Keyspace2: 5
+
+# request_scheduler_id -- An identifer based on which to perform
+# the request scheduling. Currently the only valid option is keyspace.
+# request_scheduler_id: keyspace
+
+# index_interval controls the sampling of entries from the primrary
+# row index in terms of space versus time. The larger the interval,
+# the smaller and less effective the sampling will be. In technicial
+# terms, the interval coresponds to the number of index entries that
+# are skipped between taking each sample. All the sampled entries
+# must fit in memory. Generally, a value between 128 and 512 here
+# coupled with a large key cache size on CFs results in the best trade
+# offs. This value is not often changed, however if you have many
+# very small rows (many to an OS page), then increasing this will
+# often lower memory usage without a impact on performance.
+index_interval: 128
+
+# Enable or disable inter-node encryption
+# Default settings are TLS v1, RSA 1024-bit keys (it is imperative that
+# users generate their own keys) TLS_RSA_WITH_AES_128_CBC_SHA as the cipher
+# suite for authentication, key exchange and encryption of the actual data transfers.
+# NOTE: No custom encryption options are enabled at the moment
+# The available internode options are : all, none, dc, rack
+#
+# If set to dc cassandra will encrypt the traffic between the DCs
+# If set to rack cassandra will encrypt the traffic between the racks
+#
+# The passwords used in these options must match the passwords used when generating
+# the keystore and truststore. For instructions on generating these files, see:
+# http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore
+#
+encryption_options:
+ internode_encryption: none
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ truststore: conf/.truststore
+ truststore_password: cassandra
+ # More advanced defaults below:
+ # protocol: TLS
+ # algorithm: SunX509
+ # store_type: JKS
+ # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
diff --git a/cluster-mgmt/template/hosts b/cluster-mgmt/template/hosts
new file mode 100644
index 0000000..220b30f
--- /dev/null
+++ b/cluster-mgmt/template/hosts
@@ -0,0 +1,11 @@
+127.0.0.1 localhost
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
+
+## For ONOS Development
diff --git a/cluster-mgmt/template/onsdemo_core.py b/cluster-mgmt/template/onsdemo_core.py
new file mode 100755
index 0000000..a0e184e
--- /dev/null
+++ b/cluster-mgmt/template/onsdemo_core.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ host1 = self.addHost( 'host1' )
+ host2 = self.addHost( 'host2' )
+ host3 = self.addHost( 'host3' )
+ host4 = self.addHost( 'host4' )
+ host5 = self.addHost( 'host5' )
+ host6 = self.addHost( 'host6' )
+
+ self.addLink( host1, sw1 )
+ self.addLink( host2, sw2 )
+ self.addLink( host3, sw3 )
+ self.addLink( host4, sw4 )
+ self.addLink( host5, sw5 )
+ self.addLink( host6, sw6 )
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+
+ host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ net.start()
+
+ sw2.attach('tap01_2')
+ sw3.attach('tap01_3')
+ sw4.attach('tap01_4')
+ sw4.attach('tap01_5')
+ sw5.attach('tap01_6')
+ sw6.attach('tap01_7')
+ sw1.attach('tap01_8')
+
+ host1.defaultIntf().setIP('192.168.100.141/16')
+ host2.defaultIntf().setIP('192.168.100.142/16')
+ host3.defaultIntf().setIP('192.168.100.143/16')
+ host4.defaultIntf().setIP('192.168.100.144/16')
+ host5.defaultIntf().setIP('192.168.100.145/16')
+ host6.defaultIntf().setIP('192.168.100.146/16')
+
+ hosts = [ host1, host2, host3, host4, host5, host6 ]
+ stopsshd ()
+ startsshds ( hosts )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/cluster-mgmt/template/onsdemo_core.py.devA b/cluster-mgmt/template/onsdemo_core.py.devA
new file mode 100755
index 0000000..ad74e4b
--- /dev/null
+++ b/cluster-mgmt/template/onsdemo_core.py.devA
@@ -0,0 +1,158 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ sw5 = self.addSwitch('sw5', dpid='00000000ba5eba13')
+ sw2 = self.addSwitch('sw2', dpid='00000000ba5eba11')
+ sw3 = self.addSwitch('sw3', dpid='00000008a208f901')
+ sw4 = self.addSwitch('sw4', dpid='000000000000ba12')
+ sw6 = self.addSwitch('sw6', dpid='0000204e7f518a35')
+ sw1 = self.addSwitch('sw1', dpid='0000001697089a46')
+
+ host1 = self.addHost( 'host1' )
+ host2 = self.addHost( 'host2' )
+ host3 = self.addHost( 'host3' )
+ host4 = self.addHost( 'host4' )
+ host5 = self.addHost( 'host5' )
+ host6 = self.addHost( 'host6' )
+
+ self.addLink( host1, sw1 )
+ self.addLink( host2, sw2 )
+ self.addLink( host3, sw3 )
+ self.addLink( host4, sw4 )
+ self.addLink( host5, sw5 )
+ self.addLink( host6, sw6 )
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+
+ host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ net.start()
+
+ sw2.attach('tap01_2')
+ sw3.attach('tap01_3')
+ sw4.attach('tap01_4')
+ sw4.attach('tap01_5')
+ sw5.attach('tap01_6')
+ sw6.attach('tap01_7')
+ sw1.attach('tap01_8')
+
+ host1.defaultIntf().setIP('192.168.100.141/16')
+ host2.defaultIntf().setIP('192.168.100.142/16')
+ host3.defaultIntf().setIP('192.168.100.143/16')
+ host4.defaultIntf().setIP('192.168.100.144/16')
+ host5.defaultIntf().setIP('192.168.100.145/16')
+ host6.defaultIntf().setIP('192.168.100.146/16')
+
+ hosts = [ host1, host2, host3, host4, host5, host6 ]
+ stopsshd ()
+ startsshds ( hosts )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/cluster-mgmt/template/onsdemo_edge_template.py b/cluster-mgmt/template/onsdemo_edge_template.py
new file mode 100755
index 0000000..c3d0287
--- /dev/null
+++ b/cluster-mgmt/template/onsdemo_edge_template.py
@@ -0,0 +1,154 @@
+#!/usr/bin/python
+NWID=__NWID__
+NR_NODES=__NRSW__
+Controllers=[{"ip":"127.0.0.1", "port":6633}]
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ switch = []
+ host = []
+
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (NWID, int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def startiperf( host ):
+ host.cmd( '/usr/bin/iperf', '-s &' )
+
+def startiperfs ( hosts ):
+ for h in hosts:
+ startiperf( h )
+
+def stopiperf( ):
+ quietRun( "pkill -9 iperf" )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+ #net = Mininet( topo=topo, link=TCLink, build=False)
+ #controllers=[]
+ #for c in Controllers:
+ # rc = RemoteController('c%d' % Controllers.index(c), ip=c['ip'],port=c['port'])
+ # print "controller ip %s port %s" % (c['ip'], c['port'])
+ # controllers.append(rc)
+
+ #net.controllers=controllers
+ net.build()
+
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (NWID, (int(i)+1)) ))
+
+ net.start()
+
+ sw=net.get('sw%02x.%02x' % (NWID,1))
+ print "center sw", sw
+ sw.attach('tap%02x_1' % NWID)
+
+ for i in range (NR_NODES):
+ host[i].defaultIntf().setIP('192.168.%d.%d/16' % (NWID,(int(i)+1)))
+ host[i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,NWID,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for n in range (2,9):
+ for h in range (25):
+ host[i].setARP('192.168.%d.%d' % (n, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(h)+1)))
+
+ stopsshd ()
+# stopiperf ()
+ startsshds ( host )
+# startiperfs ( host )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/cluster-mgmt/template/tunnel_onsdemo_core_template.sh b/cluster-mgmt/template/tunnel_onsdemo_core_template.sh
new file mode 100755
index 0000000..d697c6c
--- /dev/null
+++ b/cluster-mgmt/template/tunnel_onsdemo_core_template.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+TUNNEL=( "2 2 __basename__2" "3 3 __basename__3" "4 4 __basename__4" "5 5 __basename__5" "6 6 __basename__6" "7 7 __basename__7" "8 8 __basename__8")
+NW_ID=01
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ ifconfig tap${NW_ID}_${ifnr}
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo ./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/cluster-mgmt/template/tunnel_onsdemo_edge_template.sh b/cluster-mgmt/template/tunnel_onsdemo_edge_template.sh
new file mode 100755
index 0000000..bbd7274
--- /dev/null
+++ b/cluster-mgmt/template/tunnel_onsdemo_edge_template.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#TUNNEL=("0 1 VIP_ONOS10" "1 2 VIP_ONOS10")
+__TUNNEL__
+NW_ID=0__NWID__
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ ifconfig tap${NW_ID}_${ifnr}
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo ./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/cluster-mgmt/template/zoo.cfg b/cluster-mgmt/template/zoo.cfg
new file mode 100644
index 0000000..e1ab8c3
--- /dev/null
+++ b/cluster-mgmt/template/zoo.cfg
@@ -0,0 +1,41 @@
+# The number of milliseconds of each tick
+tickTime=2000
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=10
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=5
+# the directory where the snapshot is stored.
+# do not use /tmp for storage, /tmp here is just
+# example sakes.
+dataDir=/var/lib/zookeeper
+# the port at which the clients will connect
+clientPort=2181
+#
+# specify all servers in the Zookeeper ensemble
+
+#server.1=onosgui1:2888:3888
+#server.2=onosgui2:2888:3888
+#server.3=onosgui3:2888:3888
+#server.4=onosgui4:2888:3888
+#server.5=onosgui5:2888:3888
+#server.6=onosgui6:2888:3888
+#server.7=onosgui7:2888:3888
+#server.8=onosgui8:2888:3888
+#
+#
+# Be sure to read the maintenance section of the
+# administrator guide before turning on autopurge.
+#
+#
+# Be sure to read the maintenance section of the
+# administrator guide before turning on autopurge.
+#
+# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
+#
+# The number of snapshots to retain in dataDir
+#autopurge.snapRetainCount=3
+# Purge task interval in hours
+# Set to "0" to disable auto purge feature
+#autopurge.purgeInterval=1
diff --git a/conf/README b/conf/README
new file mode 100644
index 0000000..f43d67b
--- /dev/null
+++ b/conf/README
@@ -0,0 +1 @@
+Please use onos-embedded.properties to start onos with embedded cassandra.
diff --git a/conf/cassandra-repair.sh b/conf/cassandra-repair.sh
new file mode 100755
index 0000000..2c2638e
--- /dev/null
+++ b/conf/cassandra-repair.sh
@@ -0,0 +1 @@
+<cassandra_dir>/bin/nodetool repair
diff --git a/conf/cassandra.titan b/conf/cassandra.titan
new file mode 100644
index 0000000..c36ecc0
--- /dev/null
+++ b/conf/cassandra.titan
@@ -0,0 +1,7 @@
+storage.backend=cassandrathrift
+storage.hostname=localhost
+storage.keyspace=onos
+storage.connection-pool-size=4096
+storage.replication-factor=3
+storage.write-consistency-level=ALL
+storage.read-consistency-level=ONE
diff --git a/conf/cassandra.titan.nothrift b/conf/cassandra.titan.nothrift
new file mode 100644
index 0000000..04f9fd7
--- /dev/null
+++ b/conf/cassandra.titan.nothrift
@@ -0,0 +1,7 @@
+storage.backend=cassandra
+storage.hostname=localhost
+storage.keyspace=onos
+storage.connection-pool-size=4096
+storage.replication-factor=3
+storage.write-consistency-level=ALL
+storage.read-consistency-level=ONE
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
new file mode 100644
index 0000000..277f03a
--- /dev/null
+++ b/conf/cassandra.yaml
@@ -0,0 +1,643 @@
+# Cassandra storage config YAML
+
+# NOTE:
+# See http://wiki.apache.org/cassandra/StorageConfiguration for
+# full explanations of configuration directives
+# /NOTE
+
+# The name of the cluster. This is mainly used to prevent machines in
+# one logical cluster from joining another.
+cluster_name: 'Test Cluster'
+
+# This defines the number of tokens randomly assigned to this node on the ring
+# The more tokens, relative to other nodes, the larger the proportion of data
+# that this node will store. You probably want all nodes to have the same number
+# of tokens assuming they have equal hardware capability.
+#
+# If you leave this unspecified, Cassandra will use the default of 1 token for legacy compatibility,
+# and will use the initial_token as described below.
+#
+# Specifying initial_token will override this setting.
+#
+# If you already have a cluster with 1 token per node, and wish to migrate to
+# multiple tokens per node, see http://wiki.apache.org/cassandra/Operations
+# num_tokens: 256
+
+# If you haven't specified num_tokens, or have set it to the default of 1 then
+# you should always specify InitialToken when setting up a production
+# cluster for the first time, and often when adding capacity later.
+# The principle is that each node should be given an equal slice of
+# the token ring; see http://wiki.apache.org/cassandra/Operations
+# for more details.
+#
+# If blank, Cassandra will request a token bisecting the range of
+# the heaviest-loaded existing node. If there is no load information
+# available, such as is the case with a new cluster, it will pick
+# a random token, which will lead to hot spots.
+initial_token:
+
+# See http://wiki.apache.org/cassandra/HintedHandoff
+hinted_handoff_enabled: true
+# this defines the maximum amount of time a dead host will have hints
+# generated. After it has been dead this long, hints will be dropped.
+max_hint_window_in_ms: 10800000 # 3 hours
+# throttle in KB's per second, per delivery thread
+hinted_handoff_throttle_in_kb: 1024
+# Number of threads with which to deliver hints;
+# Consider increasing this number when you have multi-dc deployments, since
+# cross-dc handoff tends to be slower
+max_hints_delivery_threads: 2
+
+# The following setting populates the page cache on memtable flush and compaction
+# WARNING: Enable this setting only when the whole node's data fits in memory.
+# Defaults to: false
+# populate_io_cache_on_flush: false
+
+# authentication backend, implementing IAuthenticator; used to identify users
+authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
+
+# authorization backend, implementing IAuthorizer; used to limit access/provide permissions
+authorizer: org.apache.cassandra.auth.AllowAllAuthorizer
+
+# The partitioner is responsible for distributing rows (by key) across
+# nodes in the cluster. Any IPartitioner may be used, including your
+# own as long as it is on the classpath. Out of the box, Cassandra
+# provides org.apache.cassandra.dht.{Murmur3Partitioner, RandomPartitioner
+# ByteOrderedPartitioner, OrderPreservingPartitioner (deprecated)}.
+#
+# - RandomPartitioner distributes rows across the cluster evenly by md5.
+# This is the default prior to 1.2 and is retained for compatibility.
+# - Murmur3Partitioner is similar to RandomPartioner but uses Murmur3_128
+# Hash Function instead of md5. When in doubt, this is the best option.
+# - ByteOrderedPartitioner orders rows lexically by key bytes. BOP allows
+# scanning rows in key order, but the ordering can generate hot spots
+# for sequential insertion workloads.
+# - OrderPreservingPartitioner is an obsolete form of BOP, that stores
+# - keys in a less-efficient format and only works with keys that are
+# UTF8-encoded Strings.
+# - CollatingOPP colates according to EN,US rules rather than lexical byte
+# ordering. Use this as an example if you need custom collation.
+#
+# See http://wiki.apache.org/cassandra/Operations for more on
+# partitioners and token selection.
+partitioner: org.apache.cassandra.dht.RandomPartitioner
+
+# directories where Cassandra should store data on disk.
+data_file_directories:
+ - /tmp/cassandra/data
+
+# commit log
+commitlog_directory: /tmp/cassandra/commitlog
+
+# policy for data disk failures:
+# stop: shut down gossip and Thrift, leaving the node effectively dead, but
+# still inspectable via JMX.
+# best_effort: stop using the failed disk and respond to requests based on
+# remaining available sstables. This means you WILL see obsolete
+# data at CL.ONE!
+# ignore: ignore fatal errors and let requests fail, as in pre-1.2 Cassandra
+disk_failure_policy: stop
+
+# Maximum size of the key cache in memory.
+#
+# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the
+# minimum, sometimes more. The key cache is fairly tiny for the amount of
+# time it saves, so it's worthwhile to use it at large numbers.
+# The row cache saves even more time, but must store the whole values of
+# its rows, so it is extremely space-intensive. It's best to only use the
+# row cache if you have hot rows or static rows.
+#
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache.
+key_cache_size_in_mb:
+
+# Duration in seconds after which Cassandra should
+# safe the keys cache. Caches are saved to saved_caches_directory as
+# specified in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 14400 or 4 hours.
+key_cache_save_period: 14400
+
+# Number of keys from the key cache to save
+# Disabled by default, meaning all keys are going to be saved
+# key_cache_keys_to_save: 100
+
+# Maximum size of the row cache in memory.
+# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
+#
+# Default value is 0, to disable row caching.
+row_cache_size_in_mb: 0
+
+# Duration in seconds after which Cassandra should
+# safe the row cache. Caches are saved to saved_caches_directory as specified
+# in this configuration file.
+#
+# Saved caches greatly improve cold-start speeds, and is relatively cheap in
+# terms of I/O for the key cache. Row cache saving is much more expensive and
+# has limited use.
+#
+# Default is 0 to disable saving the row cache.
+row_cache_save_period: 0
+
+# Number of keys from the row cache to save
+# Disabled by default, meaning all keys are going to be saved
+# row_cache_keys_to_save: 100
+
+# The provider for the row cache to use.
+#
+# Supported values are: ConcurrentLinkedHashCacheProvider, SerializingCacheProvider
+#
+# SerializingCacheProvider serialises the contents of the row and stores
+# it in native memory, i.e., off the JVM Heap. Serialized rows take
+# significantly less memory than "live" rows in the JVM, so you can cache
+# more rows in a given memory footprint. And storing the cache off-heap
+# means you can use smaller heap sizes, reducing the impact of GC pauses.
+#
+# It is also valid to specify the fully-qualified class name to a class
+# that implements org.apache.cassandra.cache.IRowCacheProvider.
+#
+# Defaults to SerializingCacheProvider
+row_cache_provider: SerializingCacheProvider
+
+# saved caches
+saved_caches_directory: /tmp/cassandra/saved_caches
+
+# commitlog_sync may be either "periodic" or "batch."
+# When in batch mode, Cassandra won't ack writes until the commit log
+# has been fsynced to disk. It will wait up to
+# commitlog_sync_batch_window_in_ms milliseconds for other writes, before
+# performing the sync.
+#
+# commitlog_sync: batch
+# commitlog_sync_batch_window_in_ms: 50
+#
+# the other option is "periodic" where writes may be acked immediately
+# and the CommitLog is simply synced every commitlog_sync_period_in_ms
+# milliseconds.
+commitlog_sync: periodic
+commitlog_sync_period_in_ms: 10000
+
+# The size of the individual commitlog file segments. A commitlog
+# segment may be archived, deleted, or recycled once all the data
+# in it (potentally from each columnfamily in the system) has been
+# flushed to sstables.
+#
+# The default size is 32, which is almost always fine, but if you are
+# archiving commitlog segments (see commitlog_archiving.properties),
+# then you probably want a finer granularity of archiving; 8 or 16 MB
+# is reasonable.
+commitlog_segment_size_in_mb: 32
+
+# any class that implements the SeedProvider interface and has a
+# constructor that takes a Map<String, String> of parameters will do.
+seed_provider:
+ # Addresses of hosts that are deemed contact points.
+ # Cassandra nodes use this list of hosts to find each other and learn
+ # the topology of the ring. You must change this if you are running
+ # multiple nodes!
+ - class_name: org.apache.cassandra.locator.SimpleSeedProvider
+ parameters:
+ # seeds is actually a comma-delimited list of addresses.
+ # Ex: "<ip1>,<ip2>,<ip3>"
+ - seeds: "127.0.0.1"
+
+# emergency pressure valve: each time heap usage after a full (CMS)
+# garbage collection is above this fraction of the max, Cassandra will
+# flush the largest memtables.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+#
+# RELYING ON THIS AS YOUR PRIMARY TUNING MECHANISM WILL WORK POORLY:
+# it is most effective under light to moderate load, or read-heavy
+# workloads; under truly massive write load, it will often be too
+# little, too late.
+flush_largest_memtables_at: 0.75
+
+# emergency pressure valve #2: the first time heap usage after a full
+# (CMS) garbage collection is above this fraction of the max,
+# Cassandra will reduce cache maximum _capacity_ to the given fraction
+# of the current _size_. Should usually be set substantially above
+# flush_largest_memtables_at, since that will have less long-term
+# impact on the system.
+#
+# Set to 1.0 to disable. Setting this lower than
+# CMSInitiatingOccupancyFraction is not likely to be useful.
+reduce_cache_sizes_at: 0.85
+reduce_cache_capacity_to: 0.6
+
+# For workloads with more data than can fit in memory, Cassandra's
+# bottleneck will be reads that need to fetch data from
+# disk. "concurrent_reads" should be set to (16 * number_of_drives) in
+# order to allow the operations to enqueue low enough in the stack
+# that the OS and drives can reorder them.
+#
+# On the other hand, since writes are almost never IO bound, the ideal
+# number of "concurrent_writes" is dependent on the number of cores in
+# your system; (8 * number_of_cores) is a good rule of thumb.
+concurrent_reads: 32
+concurrent_writes: 32
+
+# Total memory to use for memtables. Cassandra will flush the largest
+# memtable when this much memory is used.
+# If omitted, Cassandra will set it to 1/3 of the heap.
+# memtable_total_space_in_mb: 2048
+
+# Total space to use for commitlogs. Since commitlog segments are
+# mmapped, and hence use up address space, the default size is 32
+# on 32-bit JVMs, and 1024 on 64-bit JVMs.
+#
+# If space gets above this value (it will round up to the next nearest
+# segment multiple), Cassandra will flush every dirty CF in the oldest
+# segment and remove it. So a small total commitlog space will tend
+# to cause more flush activity on less-active columnfamilies.
+# commitlog_total_space_in_mb: 4096
+
+# This sets the amount of memtable flush writer threads. These will
+# be blocked by disk io, and each one will hold a memtable in memory
+# while blocked. If you have a large heap and many data directories,
+# you can increase this value for better flush performance.
+# By default this will be set to the amount of data directories defined.
+#memtable_flush_writers: 1
+
+# the number of full memtables to allow pending flush, that is,
+# waiting for a writer thread. At a minimum, this should be set to
+# the maximum number of secondary indexes created on a single CF.
+memtable_flush_queue_size: 4
+
+# Whether to, when doing sequential writing, fsync() at intervals in
+# order to force the operating system to flush the dirty
+# buffers. Enable this to avoid sudden dirty buffer flushing from
+# impacting read latencies. Almost always a good idea on SSD:s; not
+# necessarily on platters.
+trickle_fsync: false
+trickle_fsync_interval_in_kb: 10240
+
+# TCP port, for commands and data
+storage_port: 7000
+
+# SSL port, for encrypted communication. Unused unless enabled in
+# encryption_options
+ssl_storage_port: 7001
+
+# Address to bind to and tell other Cassandra nodes to connect to. You
+# _must_ change this if you want multiple nodes to be able to
+# communicate!
+#
+# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
+# will always do the Right Thing *if* the node is properly configured
+# (hostname, name resolution, etc), and the Right Thing is to use the
+# address associated with the hostname (it might not be).
+#
+# Setting this to 0.0.0.0 is always wrong.
+listen_address: localhost
+
+# Address to broadcast to other Cassandra nodes
+# Leaving this blank will set it to the same value as listen_address
+# broadcast_address: 1.2.3.4
+
+
+# Whether to start the native transport server.
+# Currently, only the thrift server is started by default because the native
+# transport is considered beta.
+# Please note that the address on which the native transport is bound is the
+# same as the rpc_address. The port however is different and specified below.
+start_native_transport: false
+# port for the CQL native transport to listen for clients on
+native_transport_port: 9042
+# The minimum and maximum threads for handling requests when the native
+# transport is used. The meaning is those is similar to the one of
+# rpc_min_threads and rpc_max_threads, though the default differ slightly and
+# are the ones below:
+# native_transport_min_threads: 16
+# native_transport_max_threads: 128
+
+
+# Whether to start the thrift rpc server.
+start_rpc: true
+# The address to bind the Thrift RPC service to -- clients connect
+# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
+# you want Thrift to listen on all interfaces.
+#
+# Leaving this blank has the same effect it does for ListenAddress,
+# (i.e. it will be based on the configured hostname of the node).
+rpc_address: localhost
+# port for Thrift to listen for clients on
+rpc_port: 9160
+
+# enable or disable keepalive on rpc connections
+rpc_keepalive: true
+
+# Cassandra provides three out-of-the-box options for the RPC Server:
+#
+# sync -> One thread per thrift connection. For a very large number of clients, memory
+# will be your limiting factor. On a 64 bit JVM, 128KB is the minimum stack size
+# per thread, and that will correspond to your use of virtual memory (but physical memory
+# may be limited depending on use of stack space).
+#
+# hsha -> Stands for "half synchronous, half asynchronous." All thrift clients are handled
+# asynchronously using a small number of threads that does not vary with the amount
+# of thrift clients (and thus scales well to many clients). The rpc requests are still
+# synchronous (one thread per active request).
+#
+# The default is sync because on Windows hsha is about 30% slower. On Linux,
+# sync/hsha performance is about the same, with hsha of course using less memory.
+#
+# Alternatively, can provide your own RPC server by providing the fully-qualified class name
+# of an o.a.c.t.TServerFactory that can create an instance of it.
+rpc_server_type: sync
+
+# Uncomment rpc_min|max_thread to set request pool size limits.
+#
+# Regardless of your choice of RPC server (see above), the number of maximum requests in the
+# RPC thread pool dictates how many concurrent requests are possible (but if you are using the sync
+# RPC server, it also dictates the number of clients that can be connected at all).
+#
+# The default is unlimited and thus provide no protection against clients overwhelming the server. You are
+# encouraged to set a maximum that makes sense for you in production, but do keep in mind that
+# rpc_max_threads represents the maximum number of client requests this server may execute concurrently.
+#
+# rpc_min_threads: 16
+# rpc_max_threads: 2048
+
+# uncomment to set socket buffer sizes on rpc connections
+# rpc_send_buff_size_in_bytes:
+# rpc_recv_buff_size_in_bytes:
+
+# Frame size for thrift (maximum field length).
+thrift_framed_transport_size_in_mb: 15
+
+# The max length of a thrift message, including all fields and
+# internal thrift overhead.
+thrift_max_message_length_in_mb: 16
+
+# Set to true to have Cassandra create a hard link to each sstable
+# flushed or streamed locally in a backups/ subdirectory of the
+# Keyspace data. Removing these links is the operator's
+# responsibility.
+incremental_backups: false
+
+# Whether or not to take a snapshot before each compaction. Be
+# careful using this option, since Cassandra won't clean up the
+# snapshots for you. Mostly useful if you're paranoid when there
+# is a data format change.
+snapshot_before_compaction: false
+
+# Whether or not a snapshot is taken of the data before keyspace truncation
+# or dropping of column families. The STRONGLY advised default of true
+# should be used to provide data safety. If you set this flag to false, you will
+# lose data on truncation or drop.
+auto_snapshot: true
+
+# Add column indexes to a row after its contents reach this size.
+# Increase if your column values are large, or if you have a very large
+# number of columns. The competing causes are, Cassandra has to
+# deserialize this much of the row to read a single column, so you want
+# it to be small - at least if you do many partial-row reads - but all
+# the index data is read for each access, so you don't want to generate
+# that wastefully either.
+column_index_size_in_kb: 64
+
+# Size limit for rows being compacted in memory. Larger rows will spill
+# over to disk and use a slower two-pass compaction process. A message
+# will be logged specifying the row key.
+in_memory_compaction_limit_in_mb: 64
+
+# Number of simultaneous compactions to allow, NOT including
+# validation "compactions" for anti-entropy repair. Simultaneous
+# compactions can help preserve read performance in a mixed read/write
+# workload, by mitigating the tendency of small sstables to accumulate
+# during a single long running compactions. The default is usually
+# fine and if you experience problems with compaction running too
+# slowly or too fast, you should look at
+# compaction_throughput_mb_per_sec first.
+#
+# concurrent_compactors defaults to the number of cores.
+# Uncomment to make compaction mono-threaded, the pre-0.8 default.
+#concurrent_compactors: 1
+
+# Multi-threaded compaction. When enabled, each compaction will use
+# up to one thread per core, plus one thread per sstable being merged.
+# This is usually only useful for SSD-based hardware: otherwise,
+# your concern is usually to get compaction to do LESS i/o (see:
+# compaction_throughput_mb_per_sec), not more.
+multithreaded_compaction: false
+
+# Throttles compaction to the given total throughput across the entire
+# system. The faster you insert data, the faster you need to compact in
+# order to keep the sstable count down, but in general, setting this to
+# 16 to 32 times the rate you are inserting data is more than sufficient.
+# Setting this to 0 disables throttling. Note that this account for all types
+# of compaction, including validation compaction.
+compaction_throughput_mb_per_sec: 16
+
+# Track cached row keys during compaction, and re-cache their new
+# positions in the compacted sstable. Disable if you use really large
+# key caches.
+compaction_preheat_key_cache: true
+
+# Throttles all outbound streaming file transfers on this node to the
+# given total throughput in Mbps. This is necessary because Cassandra does
+# mostly sequential IO when streaming data during bootstrap or repair, which
+# can lead to saturating the network connection and degrading rpc performance.
+# When unset, the default is 400 Mbps or 50 MB/s.
+# stream_throughput_outbound_megabits_per_sec: 400
+
+# How long the coordinator should wait for read operations to complete
+read_request_timeout_in_ms: 10000
+# How long the coordinator should wait for seq or index scans to complete
+range_request_timeout_in_ms: 10000
+# How long the coordinator should wait for writes to complete
+write_request_timeout_in_ms: 10000
+# How long the coordinator should wait for truncates to complete
+# (This can be much longer, because unless auto_snapshot is disabled
+# we need to flush first so we can snapshot before removing the data.)
+truncate_request_timeout_in_ms: 60000
+# The default timeout for other, miscellaneous operations
+request_timeout_in_ms: 10000
+
+# Enable operation timeout information exchange between nodes to accurately
+# measure request timeouts, If disabled cassandra will assuming the request
+# was forwarded to the replica instantly by the coordinator
+#
+# Warning: before enabling this property make sure to ntp is installed
+# and the times are synchronized between the nodes.
+cross_node_timeout: false
+
+# Enable socket timeout for streaming operation.
+# When a timeout occurs during streaming, streaming is retried from the start
+# of the current file. This *can* involve re-streaming an important amount of
+# data, so you should avoid setting the value too low.
+# Default value is 0, which never timeout streams.
+# streaming_socket_timeout_in_ms: 0
+
+# phi value that must be reached for a host to be marked down.
+# most users should never need to adjust this.
+# phi_convict_threshold: 8
+
+# endpoint_snitch -- Set this to a class that implements
+# IEndpointSnitch. The snitch has two functions:
+# - it teaches Cassandra enough about your network topology to route
+# requests efficiently
+# - it allows Cassandra to spread replicas around your cluster to avoid
+# correlated failures. It does this by grouping machines into
+# "datacenters" and "racks." Cassandra will do its best not to have
+# more than one replica on the same "rack" (which may not actually
+# be a physical location)
+#
+# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER,
+# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS
+# ARE PLACED.
+#
+# Out of the box, Cassandra provides
+# - SimpleSnitch:
+# Treats Strategy order as proximity. This improves cache locality
+# when disabling read repair, which can further improve throughput.
+# Only appropriate for single-datacenter deployments.
+# - PropertyFileSnitch:
+# Proximity is determined by rack and data center, which are
+# explicitly configured in cassandra-topology.properties.
+# - GossipingPropertyFileSnitch
+# The rack and datacenter for the local node are defined in
+# cassandra-rackdc.properties and propagated to other nodes via gossip. If
+# cassandra-topology.properties exists, it is used as a fallback, allowing
+# migration from the PropertyFileSnitch.
+# - RackInferringSnitch:
+# Proximity is determined by rack and data center, which are
+# assumed to correspond to the 3rd and 2nd octet of each node's
+# IP address, respectively. Unless this happens to match your
+# deployment conventions (as it did Facebook's), this is best used
+# as an example of writing a custom Snitch class.
+# - Ec2Snitch:
+# Appropriate for EC2 deployments in a single Region. Loads Region
+# and Availability Zone information from the EC2 API. The Region is
+# treated as the Datacenter, and the Availability Zone as the rack.
+# Only private IPs are used, so this will not work across multiple
+# Regions.
+# - Ec2MultiRegionSnitch:
+# Uses public IPs as broadcast_address to allow cross-region
+# connectivity. (Thus, you should set seed addresses to the public
+# IP as well.) You will need to open the storage_port or
+# ssl_storage_port on the public IP firewall. (For intra-Region
+# traffic, Cassandra will switch to the private IP after
+# establishing a connection.)
+#
+# You can use a custom Snitch by setting this to the full class name
+# of the snitch, which will be assumed to be on your classpath.
+endpoint_snitch: SimpleSnitch
+
+# controls how often to perform the more expensive part of host score
+# calculation
+dynamic_snitch_update_interval_in_ms: 100
+# controls how often to reset all host scores, allowing a bad host to
+# possibly recover
+dynamic_snitch_reset_interval_in_ms: 600000
+# if set greater than zero and read_repair_chance is < 1.0, this will allow
+# 'pinning' of replicas to hosts in order to increase cache capacity.
+# The badness threshold will control how much worse the pinned host has to be
+# before the dynamic snitch will prefer other replicas over it. This is
+# expressed as a double which represents a percentage. Thus, a value of
+# 0.2 means Cassandra would continue to prefer the static snitch values
+# until the pinned host was 20% worse than the fastest.
+dynamic_snitch_badness_threshold: 0.1
+
+# request_scheduler -- Set this to a class that implements
+# RequestScheduler, which will schedule incoming client requests
+# according to the specific policy. This is useful for multi-tenancy
+# with a single Cassandra cluster.
+# NOTE: This is specifically for requests from the client and does
+# not affect inter node communication.
+# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
+# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
+# client requests to a node with a separate queue for each
+# request_scheduler_id. The scheduler is further customized by
+# request_scheduler_options as described below.
+request_scheduler: org.apache.cassandra.scheduler.NoScheduler
+
+# Scheduler Options vary based on the type of scheduler
+# NoScheduler - Has no options
+# RoundRobin
+# - throttle_limit -- The throttle_limit is the number of in-flight
+# requests per client. Requests beyond
+# that limit are queued up until
+# running requests can complete.
+# The value of 80 here is twice the number of
+# concurrent_reads + concurrent_writes.
+# - default_weight -- default_weight is optional and allows for
+# overriding the default which is 1.
+# - weights -- Weights are optional and will default to 1 or the
+# overridden default_weight. The weight translates into how
+# many requests are handled during each turn of the
+# RoundRobin, based on the scheduler id.
+#
+# request_scheduler_options:
+# throttle_limit: 80
+# default_weight: 5
+# weights:
+# Keyspace1: 1
+# Keyspace2: 5
+
+# request_scheduler_id -- An identifer based on which to perform
+# the request scheduling. Currently the only valid option is keyspace.
+# request_scheduler_id: keyspace
+
+# index_interval controls the sampling of entries from the primrary
+# row index in terms of space versus time. The larger the interval,
+# the smaller and less effective the sampling will be. In technicial
+# terms, the interval coresponds to the number of index entries that
+# are skipped between taking each sample. All the sampled entries
+# must fit in memory. Generally, a value between 128 and 512 here
+# coupled with a large key cache size on CFs results in the best trade
+# offs. This value is not often changed, however if you have many
+# very small rows (many to an OS page), then increasing this will
+# often lower memory usage without a impact on performance.
+index_interval: 128
+
+# Enable or disable inter-node encryption
+# Default settings are TLS v1, RSA 1024-bit keys (it is imperative that
+# users generate their own keys) TLS_RSA_WITH_AES_128_CBC_SHA as the cipher
+# suite for authentication, key exchange and encryption of the actual data transfers.
+# NOTE: No custom encryption options are enabled at the moment
+# The available internode options are : all, none, dc, rack
+#
+# If set to dc cassandra will encrypt the traffic between the DCs
+# If set to rack cassandra will encrypt the traffic between the racks
+#
+# The passwords used in these options must match the passwords used when generating
+# the keystore and truststore. For instructions on generating these files, see:
+# http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore
+#
+server_encryption_options:
+ internode_encryption: none
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ truststore: conf/.truststore
+ truststore_password: cassandra
+ # More advanced defaults below:
+ # protocol: TLS
+ # algorithm: SunX509
+ # store_type: JKS
+ # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
+
+# enable or disable client/server encryption.
+client_encryption_options:
+ enabled: false
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ # More advanced defaults below:
+ # protocol: TLS
+ # algorithm: SunX509
+ # store_type: JKS
+ # cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
+
+# internode_compression controls whether traffic between nodes is
+# compressed.
+# can be: all - all traffic is compressed
+# dc - traffic between different datacenters is compressed
+# none - nothing is compressed.
+internode_compression: all
diff --git a/conf/hazelcast.xml b/conf/hazelcast.xml
new file mode 100644
index 0000000..11bef59
--- /dev/null
+++ b/conf/hazelcast.xml
@@ -0,0 +1,105 @@
+<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config
+ http://www.hazelcast.com/schema/config/hazelcast-config-3.0.xsd"
+ xmlns="http://www.hazelcast.com/schema/config"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <map name="*">
+
+ <!--
+ Number of sync-backups. If 1 is set as the backup-count for example,
+ then all entries of the map will be copied to another JVM for
+ ail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+ -->
+ <backup-count>0</backup-count>
+
+ <!--
+ Number of async-backups. If 1 is set as the backup-count for example,
+ then all entries of the map will be copied to another JVM for
+ fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+ -->
+ <async-backup-count>3</async-backup-count>
+
+ <!--
+ Can we read the local backup entries? Default value is false for
+ strong consistency. Being able to read backup data will give you
+ greater performance.
+ -->
+ <read-backup-data>true</read-backup-data>
+
+ <near-cache>
+ <!--
+ Maximum size of the near cache. When max size is reached,
+ cache is evicted based on the policy defined.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means
+ Integer.MAX_VALUE. Default is 0.
+ -->
+ <max-size>0</max-size>
+ <!--
+ Maximum number of seconds for each entry to stay in the near cache.
+ Entries that are older than <time-to-live-seconds> will get
+ automatically evicted from the near cache.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means infinite.
+ Default is 0.
+ -->
+ <time-to-live-seconds>0</time-to-live-seconds>
+
+ <!--
+ Maximum number of seconds each entry can stay in the near cache as
+ untouched (not-read).
+ Entries that are not read (touched) more than <max-idle-seconds>
+ value will get removed from the near cache.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means
+ Integer.MAX_VALUE. Default is 0.
+ -->
+ <max-idle-seconds>0</max-idle-seconds>
+
+ <!--
+ Valid values are:
+ NONE (no extra eviction, <time-to-live-seconds> may still apply),
+ LRU (Least Recently Used),
+ LFU (Least Frequently Used).
+ LRU is the default.
+ Regardless of the eviction policy used, <time-to-live-seconds> will
+ still apply.
+ -->
+ <eviction-policy>NONE</eviction-policy>
+
+ <!--
+ Should the cached entries get evicted if the entries are changed
+ (updated or removed).
+ true of false. Default is true.
+ -->
+ <invalidate-on-change>true</invalidate-on-change>
+
+ </near-cache>
+ </map>
+
+ <topic name="*">
+ <global-ordering-enabled>false</global-ordering-enabled>
+ </topic>
+
+ <network>
+ <port auto-increment="true">5701</port>
+ <join>
+ <multicast enabled="true">
+ <multicast-group>224.2.2.3</multicast-group>
+ <multicast-port>54327</multicast-port>
+ </multicast>
+ <!--
+ <tcp-ip enabled="false">
+ <member>machine1</member>
+ <member>machine2</member>
+ <member>machine3:5799</member>
+ <member>192.168.1.0-7</member>
+ <member>192.168.1.21</member>
+ </tcp-ip>
+ -->
+ <aws enabled="false">
+ </aws>
+ </join>
+ </network>
+
+ <properties>
+ <property name="hazelcast.logging.type">slf4j</property>
+ </properties>
+</hazelcast>
diff --git a/conf/logback-deployment.xml b/conf/logback-deployment.xml
new file mode 100644
index 0000000..3877f65
--- /dev/null
+++ b/conf/logback-deployment.xml
@@ -0,0 +1,37 @@
+<configuration scan="true" debug="true">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%level [%logger:%thread] %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>./onos-logs/onos.ubuntu.log</file>
+ <encoder>
+ <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>./onos-logs/onos.ubuntu.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- Roll over to a new log file every day -->
+ <fileNamePattern>./onos-logs/onos.ubuntu.%d{yyyy-MM-dd}.log</fileNamePattern>
+ <!-- Keep 10 days worth of logs -->
+ <maxHistory>10</maxHistory>
+ </rollingPolicy>
+
+ <encoder>
+ <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+ </encoder>
+
+ </appender>
+
+ <logger name="org" level="WARN"/>
+ <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
+ <logger name="net.floodlightcontroller.logging" level="WARN"/>
+
+ <root level="DEBUG">
+ <appender-ref ref="ROLLINGFILE" />
+ </root>
+</configuration>
diff --git a/conf/onos-embedded.properties b/conf/onos-embedded.properties
new file mode 100644
index 0000000..e280e41
--- /dev/null
+++ b/conf/onos-embedded.properties
@@ -0,0 +1,22 @@
+floodlight.modules = net.floodlightcontroller.storage.memory.MemoryStorageSource,\
+net.floodlightcontroller.core.FloodlightProvider,\
+net.floodlightcontroller.threadpool.ThreadPool,\
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
+net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl,\
+net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
+net.floodlightcontroller.counter.CounterStore,\
+net.floodlightcontroller.perfmon.PktInProcessingTime,\
+net.floodlightcontroller.ui.web.StaticWebRoutable,\
+net.onrc.onos.datagrid.HazelcastDatagrid,\
+net.onrc.onos.ofcontroller.flowmanager.FlowManager,\
+net.onrc.onos.ofcontroller.flowprogrammer.FlowProgrammer,\
+net.onrc.onos.ofcontroller.topology.TopologyManager,\
+net.onrc.onos.registry.controller.ZookeeperRegistry
+net.floodlightcontroller.restserver.RestApiServer.port = 8080
+net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
+net.floodlightcontroller.core.FloodlightProvider.workerthreads = 48
+net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
+net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = conf/titan-embedded.properties
+net.onrc.onos.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
+
diff --git a/conf/onos.properties b/conf/onos.properties
new file mode 100644
index 0000000..f7bffb2
--- /dev/null
+++ b/conf/onos.properties
@@ -0,0 +1,21 @@
+floodlight.modules = net.floodlightcontroller.storage.memory.MemoryStorageSource,\
+net.floodlightcontroller.core.FloodlightProvider,\
+net.floodlightcontroller.threadpool.ThreadPool,\
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
+net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl,\
+net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
+net.floodlightcontroller.counter.CounterStore,\
+net.floodlightcontroller.perfmon.PktInProcessingTime,\
+net.floodlightcontroller.ui.web.StaticWebRoutable,\
+net.onrc.onos.datagrid.HazelcastDatagrid,\
+net.onrc.onos.ofcontroller.flowmanager.FlowManager,\
+net.onrc.onos.ofcontroller.flowprogrammer.FlowProgrammer,\
+net.onrc.onos.ofcontroller.topology.TopologyManager,\
+net.onrc.onos.registry.controller.ZookeeperRegistry
+net.floodlightcontroller.restserver.RestApiServer.port = 8080
+net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
+net.floodlightcontroller.core.FloodlightProvider.workerthreads = 16
+net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
+net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
diff --git a/conf/titan-embedded.properties b/conf/titan-embedded.properties
new file mode 100644
index 0000000..7a28afb
--- /dev/null
+++ b/conf/titan-embedded.properties
@@ -0,0 +1,6 @@
+storage.backend=embeddedcassandra
+storage.cassandra-config-dir=file:conf/cassandra.yaml
+storage.keyspace=onos
+storage.replication-factor=1
+storage.write-consistency-level=ALL
+storage.read-consistency-level=ONE
diff --git a/kryo2/.gitignore b/kryo2/.gitignore
new file mode 100644
index 0000000..916e17c
--- /dev/null
+++ b/kryo2/.gitignore
@@ -0,0 +1 @@
+dependency-reduced-pom.xml
diff --git a/kryo2/pom.xml b/kryo2/pom.xml
new file mode 100644
index 0000000..788f952
--- /dev/null
+++ b/kryo2/pom.xml
@@ -0,0 +1,68 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>net.onrc.onos</groupId>
+ <artifactId>kryo2</artifactId>
+ <version>2.22</version>
+ <packaging>jar</packaging>
+
+ <name>kryo2</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.esotericsoftware.kryo</groupId>
+ <artifactId>kryo</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <relocations>
+ <relocation>
+ <pattern>com.esotericsoftware.kryo</pattern>
+ <shadedPattern>com.esotericsoftware.kryo2</shadedPattern>
+ <excludes>
+ </excludes>
+ </relocation>
+ </relocations>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <executions>
+ <execution>
+ <id>kryo2</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>mvn</executable>
+ <commandlineArgs>install:install-file -DlocalRepositoryPath=${basedir}/../repo -DcreateChecksum=true -Dpackaging=jar -Dfile=${basedir}/target/${project.build.finalName}.jar -DgroupId=${project.groupId} -DartifactId=${project.artifactId} -Dversion=${project.version}</commandlineArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Constants.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Constants.java
deleted file mode 100644
index d1ef80b..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Constants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class Constants {
-
- public static final String VERSION = "0.1.0";
-
-}
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Message.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Message.java
deleted file mode 100644
index 8e4d989..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Message.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class Message implements org.apache.thrift.TBase<Message, Message._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Message");
-
- 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);
- 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);
-
- public List<String> sessionIDs; // required
- public Packet packet; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SESSION_IDS((short)1, "sessionIDs"),
- PACKET((short)2, "packet");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // SESSION_IDS
- return SESSION_IDS;
- case 2: // PACKET
- return PACKET;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SESSION_IDS, new org.apache.thrift.meta_data.FieldMetaData("sessionIDs", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Packet.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Message.class, metaDataMap);
- }
-
- public Message() {
- }
-
- public Message(
- List<String> sessionIDs,
- Packet packet)
- {
- this();
- this.sessionIDs = sessionIDs;
- this.packet = packet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public Message(Message other) {
- if (other.isSetSessionIDs()) {
- List<String> __this__sessionIDs = new ArrayList<String>();
- for (String other_element : other.sessionIDs) {
- __this__sessionIDs.add(other_element);
- }
- this.sessionIDs = __this__sessionIDs;
- }
- if (other.isSetPacket()) {
- this.packet = new Packet(other.packet);
- }
- }
-
- public Message deepCopy() {
- return new Message(this);
- }
-
- @Override
- public void clear() {
- this.sessionIDs = null;
- this.packet = null;
- }
-
- public int getSessionIDsSize() {
- return (this.sessionIDs == null) ? 0 : this.sessionIDs.size();
- }
-
- public java.util.Iterator<String> getSessionIDsIterator() {
- return (this.sessionIDs == null) ? null : this.sessionIDs.iterator();
- }
-
- public void addToSessionIDs(String elem) {
- if (this.sessionIDs == null) {
- this.sessionIDs = new ArrayList<String>();
- }
- this.sessionIDs.add(elem);
- }
-
- public List<String> getSessionIDs() {
- return this.sessionIDs;
- }
-
- public Message setSessionIDs(List<String> sessionIDs) {
- this.sessionIDs = sessionIDs;
- return this;
- }
-
- public void unsetSessionIDs() {
- this.sessionIDs = null;
- }
-
- /** Returns true if field sessionIDs is set (has been assigned a value) and false otherwise */
- public boolean isSetSessionIDs() {
- return this.sessionIDs != null;
- }
-
- public void setSessionIDsIsSet(boolean value) {
- if (!value) {
- this.sessionIDs = null;
- }
- }
-
- public Packet getPacket() {
- return this.packet;
- }
-
- public Message setPacket(Packet packet) {
- this.packet = packet;
- return this;
- }
-
- public void unsetPacket() {
- this.packet = null;
- }
-
- /** Returns true if field packet is set (has been assigned a value) and false otherwise */
- public boolean isSetPacket() {
- return this.packet != null;
- }
-
- public void setPacketIsSet(boolean value) {
- if (!value) {
- this.packet = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SESSION_IDS:
- if (value == null) {
- unsetSessionIDs();
- } else {
- setSessionIDs((List<String>)value);
- }
- break;
-
- case PACKET:
- if (value == null) {
- unsetPacket();
- } else {
- setPacket((Packet)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SESSION_IDS:
- return getSessionIDs();
-
- case PACKET:
- return getPacket();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SESSION_IDS:
- return isSetSessionIDs();
- case PACKET:
- return isSetPacket();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof Message)
- return this.equals((Message)that);
- return false;
- }
-
- public boolean equals(Message that) {
- if (that == null)
- return false;
-
- boolean this_present_sessionIDs = true && this.isSetSessionIDs();
- boolean that_present_sessionIDs = true && that.isSetSessionIDs();
- if (this_present_sessionIDs || that_present_sessionIDs) {
- if (!(this_present_sessionIDs && that_present_sessionIDs))
- return false;
- if (!this.sessionIDs.equals(that.sessionIDs))
- return false;
- }
-
- boolean this_present_packet = true && this.isSetPacket();
- boolean that_present_packet = true && that.isSetPacket();
- if (this_present_packet || that_present_packet) {
- if (!(this_present_packet && that_present_packet))
- return false;
- if (!this.packet.equals(that.packet))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(Message other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- Message typedOther = (Message)other;
-
- lastComparison = Boolean.valueOf(isSetSessionIDs()).compareTo(typedOther.isSetSessionIDs());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSessionIDs()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionIDs, typedOther.sessionIDs);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPacket()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SESSION_IDS
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
- this.sessionIDs = new ArrayList<String>(_list0.size);
- for (int _i1 = 0; _i1 < _list0.size; ++_i1)
- {
- String _elem2; // required
- _elem2 = iprot.readString();
- this.sessionIDs.add(_elem2);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // PACKET
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.packet = new Packet();
- this.packet.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.sessionIDs != null) {
- oprot.writeFieldBegin(SESSION_IDS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.sessionIDs.size()));
- for (String _iter3 : this.sessionIDs)
- {
- oprot.writeString(_iter3);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.packet != null) {
- oprot.writeFieldBegin(PACKET_FIELD_DESC);
- this.packet.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("Message(");
- boolean first = true;
-
- sb.append("sessionIDs:");
- if (this.sessionIDs == null) {
- sb.append("null");
- } else {
- sb.append(this.sessionIDs);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("packet:");
- if (this.packet == null) {
- sb.append("null");
- } else {
- sb.append(this.packet);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
-}
-
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/OFMessageType.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/OFMessageType.java
deleted file mode 100644
index b9b2843..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/OFMessageType.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.thrift.TEnum;
-
-/**
- * OFMessage type
- *
- */
-@SuppressWarnings("all") public enum OFMessageType implements org.apache.thrift.TEnum {
- HELLO(0),
- ERROR(1),
- ECHO_REQUEST(2),
- ECHO_REPLY(3),
- VENDOR(4),
- FEATURES_REQUEST(5),
- FEATURES_REPLY(6),
- GET_CONFIG_REQUEST(7),
- GET_CONFIG_REPLY(8),
- SET_CONFIG(9),
- PACKET_IN(10),
- FLOW_REMOVED(11),
- PORT_STATUS(12),
- PACKET_OUT(13),
- FLOW_MOD(14),
- PORT_MOD(15),
- STATS_REQUEST(16),
- STATS_REPLY(17),
- BARRIER_REQUEST(18),
- BARRIER_REPLY(19);
-
- private final int value;
-
- private OFMessageType(int value) {
- this.value = value;
- }
-
- /**
- * Get the integer value of this enum value, as defined in the Thrift IDL.
- */
- public int getValue() {
- return value;
- }
-
- /**
- * Find a the enum type by its integer value, as defined in the Thrift IDL.
- * @return null if the value is not found.
- */
- public static OFMessageType findByValue(int value) {
- switch (value) {
- case 0:
- return HELLO;
- case 1:
- return ERROR;
- case 2:
- return ECHO_REQUEST;
- case 3:
- return ECHO_REPLY;
- case 4:
- return VENDOR;
- case 5:
- return FEATURES_REQUEST;
- case 6:
- return FEATURES_REPLY;
- case 7:
- return GET_CONFIG_REQUEST;
- case 8:
- return GET_CONFIG_REPLY;
- case 9:
- return SET_CONFIG;
- case 10:
- return PACKET_IN;
- case 11:
- return FLOW_REMOVED;
- case 12:
- return PORT_STATUS;
- case 13:
- return PACKET_OUT;
- case 14:
- return FLOW_MOD;
- case 15:
- return PORT_MOD;
- case 16:
- return STATS_REQUEST;
- case 17:
- return STATS_REPLY;
- case 18:
- return BARRIER_REQUEST;
- case 19:
- return BARRIER_REPLY;
- default:
- return null;
- }
- }
-}
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Packet.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Packet.java
deleted file mode 100644
index 65c140f..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/Packet.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class Packet implements org.apache.thrift.TBase<Packet, Packet._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Packet");
-
- 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);
- 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);
- 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);
-
- /**
- *
- * @see OFMessageType
- */
- public OFMessageType messageType; // required
- public SwitchPortTuple swPortTuple; // required
- public ByteBuffer data; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- /**
- *
- * @see OFMessageType
- */
- MESSAGE_TYPE((short)1, "messageType"),
- SW_PORT_TUPLE((short)2, "swPortTuple"),
- DATA((short)3, "data");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // MESSAGE_TYPE
- return MESSAGE_TYPE;
- case 2: // SW_PORT_TUPLE
- return SW_PORT_TUPLE;
- case 3: // DATA
- return DATA;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.MESSAGE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("messageType", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, OFMessageType.class)));
- tmpMap.put(_Fields.SW_PORT_TUPLE, new org.apache.thrift.meta_data.FieldMetaData("swPortTuple", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SwitchPortTuple.class)));
- tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Packet.class, metaDataMap);
- }
-
- public Packet() {
- }
-
- public Packet(
- OFMessageType messageType,
- SwitchPortTuple swPortTuple,
- ByteBuffer data)
- {
- this();
- this.messageType = messageType;
- this.swPortTuple = swPortTuple;
- this.data = data;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public Packet(Packet other) {
- if (other.isSetMessageType()) {
- this.messageType = other.messageType;
- }
- if (other.isSetSwPortTuple()) {
- this.swPortTuple = new SwitchPortTuple(other.swPortTuple);
- }
- if (other.isSetData()) {
- this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data);
-;
- }
- }
-
- public Packet deepCopy() {
- return new Packet(this);
- }
-
- @Override
- public void clear() {
- this.messageType = null;
- this.swPortTuple = null;
- this.data = null;
- }
-
- /**
- *
- * @see OFMessageType
- */
- public OFMessageType getMessageType() {
- return this.messageType;
- }
-
- /**
- *
- * @see OFMessageType
- */
- public Packet setMessageType(OFMessageType messageType) {
- this.messageType = messageType;
- return this;
- }
-
- public void unsetMessageType() {
- this.messageType = null;
- }
-
- /** Returns true if field messageType is set (has been assigned a value) and false otherwise */
- public boolean isSetMessageType() {
- return this.messageType != null;
- }
-
- public void setMessageTypeIsSet(boolean value) {
- if (!value) {
- this.messageType = null;
- }
- }
-
- public SwitchPortTuple getSwPortTuple() {
- return this.swPortTuple;
- }
-
- public Packet setSwPortTuple(SwitchPortTuple swPortTuple) {
- this.swPortTuple = swPortTuple;
- return this;
- }
-
- public void unsetSwPortTuple() {
- this.swPortTuple = null;
- }
-
- /** Returns true if field swPortTuple is set (has been assigned a value) and false otherwise */
- public boolean isSetSwPortTuple() {
- return this.swPortTuple != null;
- }
-
- public void setSwPortTupleIsSet(boolean value) {
- if (!value) {
- this.swPortTuple = null;
- }
- }
-
- public byte[] getData() {
- setData(org.apache.thrift.TBaseHelper.rightSize(data));
- return data == null ? null : data.array();
- }
-
- public ByteBuffer bufferForData() {
- return data;
- }
-
- public Packet setData(byte[] data) {
- setData(data == null ? (ByteBuffer)null : ByteBuffer.wrap(data));
- return this;
- }
-
- public Packet setData(ByteBuffer data) {
- this.data = data;
- return this;
- }
-
- public void unsetData() {
- this.data = null;
- }
-
- /** Returns true if field data is set (has been assigned a value) and false otherwise */
- public boolean isSetData() {
- return this.data != null;
- }
-
- public void setDataIsSet(boolean value) {
- if (!value) {
- this.data = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case MESSAGE_TYPE:
- if (value == null) {
- unsetMessageType();
- } else {
- setMessageType((OFMessageType)value);
- }
- break;
-
- case SW_PORT_TUPLE:
- if (value == null) {
- unsetSwPortTuple();
- } else {
- setSwPortTuple((SwitchPortTuple)value);
- }
- break;
-
- case DATA:
- if (value == null) {
- unsetData();
- } else {
- setData((ByteBuffer)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case MESSAGE_TYPE:
- return getMessageType();
-
- case SW_PORT_TUPLE:
- return getSwPortTuple();
-
- case DATA:
- return getData();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case MESSAGE_TYPE:
- return isSetMessageType();
- case SW_PORT_TUPLE:
- return isSetSwPortTuple();
- case DATA:
- return isSetData();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof Packet)
- return this.equals((Packet)that);
- return false;
- }
-
- public boolean equals(Packet that) {
- if (that == null)
- return false;
-
- boolean this_present_messageType = true && this.isSetMessageType();
- boolean that_present_messageType = true && that.isSetMessageType();
- if (this_present_messageType || that_present_messageType) {
- if (!(this_present_messageType && that_present_messageType))
- return false;
- if (!this.messageType.equals(that.messageType))
- return false;
- }
-
- boolean this_present_swPortTuple = true && this.isSetSwPortTuple();
- boolean that_present_swPortTuple = true && that.isSetSwPortTuple();
- if (this_present_swPortTuple || that_present_swPortTuple) {
- if (!(this_present_swPortTuple && that_present_swPortTuple))
- return false;
- if (!this.swPortTuple.equals(that.swPortTuple))
- return false;
- }
-
- boolean this_present_data = true && this.isSetData();
- boolean that_present_data = true && that.isSetData();
- if (this_present_data || that_present_data) {
- if (!(this_present_data && that_present_data))
- return false;
- if (!this.data.equals(that.data))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(Packet other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- Packet typedOther = (Packet)other;
-
- lastComparison = Boolean.valueOf(isSetMessageType()).compareTo(typedOther.isSetMessageType());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMessageType()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageType, typedOther.messageType);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetSwPortTuple()).compareTo(typedOther.isSetSwPortTuple());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSwPortTuple()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.swPortTuple, typedOther.swPortTuple);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetData()).compareTo(typedOther.isSetData());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetData()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, typedOther.data);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // MESSAGE_TYPE
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.messageType = OFMessageType.findByValue(iprot.readI32());
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // SW_PORT_TUPLE
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.swPortTuple = new SwitchPortTuple();
- this.swPortTuple.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // DATA
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.data = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.messageType != null) {
- oprot.writeFieldBegin(MESSAGE_TYPE_FIELD_DESC);
- oprot.writeI32(this.messageType.getValue());
- oprot.writeFieldEnd();
- }
- if (this.swPortTuple != null) {
- oprot.writeFieldBegin(SW_PORT_TUPLE_FIELD_DESC);
- this.swPortTuple.write(oprot);
- oprot.writeFieldEnd();
- }
- if (this.data != null) {
- oprot.writeFieldBegin(DATA_FIELD_DESC);
- oprot.writeBinary(this.data);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("Packet(");
- boolean first = true;
-
- sb.append("messageType:");
- if (this.messageType == null) {
- sb.append("null");
- } else {
- sb.append(this.messageType);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("swPortTuple:");
- if (this.swPortTuple == null) {
- sb.append("null");
- } else {
- sb.append(this.swPortTuple);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("data:");
- if (this.data == null) {
- sb.append("null");
- } else {
- org.apache.thrift.TBaseHelper.toString(this.data, sb);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
-}
-
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/PacketStreamer.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/PacketStreamer.java
deleted file mode 100644
index f4e8ae5..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/PacketStreamer.java
+++ /dev/null
@@ -1,2427 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class PacketStreamer {
-
- /**
- * Packetstreamer API
- */
- public interface Iface {
-
- /**
- * Synchronous method to get packets for a given sessionid
- *
- * @param sessionid
- */
- public List<ByteBuffer> getPackets(String sessionid) throws org.apache.thrift.TException;
-
- /**
- * Synchronous method to publish a packet.
- * It ensure the order that the packets are pushed
- *
- * @param packet
- */
- public int pushMessageSync(Message packet) throws org.apache.thrift.TException;
-
- /**
- * Asynchronous method to publish a packet.
- * Order is not guaranteed.
- *
- * @param packet
- */
- public void pushMessageAsync(Message packet) throws org.apache.thrift.TException;
-
- /**
- * Terminate a session
- *
- * @param sessionid
- */
- public void terminateSession(String sessionid) throws org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void getPackets(String sessionid, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.getPackets_call> resultHandler) throws org.apache.thrift.TException;
-
- public void pushMessageSync(Message packet, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.pushMessageSync_call> resultHandler) throws org.apache.thrift.TException;
-
- public void pushMessageAsync(Message packet, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.pushMessageAsync_call> resultHandler) throws org.apache.thrift.TException;
-
- public void terminateSession(String sessionid, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.terminateSession_call> resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public List<ByteBuffer> getPackets(String sessionid) throws org.apache.thrift.TException
- {
- send_getPackets(sessionid);
- return recv_getPackets();
- }
-
- public void send_getPackets(String sessionid) throws org.apache.thrift.TException
- {
- getPackets_args args = new getPackets_args();
- args.setSessionid(sessionid);
- sendBase("getPackets", args);
- }
-
- public List<ByteBuffer> recv_getPackets() throws org.apache.thrift.TException
- {
- getPackets_result result = new getPackets_result();
- receiveBase(result, "getPackets");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPackets failed: unknown result");
- }
-
- public int pushMessageSync(Message packet) throws org.apache.thrift.TException
- {
- send_pushMessageSync(packet);
- return recv_pushMessageSync();
- }
-
- public void send_pushMessageSync(Message packet) throws org.apache.thrift.TException
- {
- pushMessageSync_args args = new pushMessageSync_args();
- args.setPacket(packet);
- sendBase("pushMessageSync", args);
- }
-
- public int recv_pushMessageSync() throws org.apache.thrift.TException
- {
- pushMessageSync_result result = new pushMessageSync_result();
- receiveBase(result, "pushMessageSync");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "pushMessageSync failed: unknown result");
- }
-
- public void pushMessageAsync(Message packet) throws org.apache.thrift.TException
- {
- send_pushMessageAsync(packet);
- }
-
- public void send_pushMessageAsync(Message packet) throws org.apache.thrift.TException
- {
- pushMessageAsync_args args = new pushMessageAsync_args();
- args.setPacket(packet);
- sendBase("pushMessageAsync", args);
- }
-
- public void terminateSession(String sessionid) throws org.apache.thrift.TException
- {
- send_terminateSession(sessionid);
- recv_terminateSession();
- }
-
- public void send_terminateSession(String sessionid) throws org.apache.thrift.TException
- {
- terminateSession_args args = new terminateSession_args();
- args.setSessionid(sessionid);
- sendBase("terminateSession", args);
- }
-
- public void recv_terminateSession() throws org.apache.thrift.TException
- {
- terminateSession_result result = new terminateSession_result();
- receiveBase(result, "terminateSession");
- return;
- }
-
- }
- public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
- public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void getPackets(String sessionid, org.apache.thrift.async.AsyncMethodCallback<getPackets_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getPackets_call method_call = new getPackets_call(sessionid, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getPackets_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String sessionid;
- public getPackets_call(String sessionid, org.apache.thrift.async.AsyncMethodCallback<getPackets_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.sessionid = sessionid;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPackets", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getPackets_args args = new getPackets_args();
- args.setSessionid(sessionid);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public List<ByteBuffer> getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getPackets();
- }
- }
-
- public void pushMessageSync(Message packet, org.apache.thrift.async.AsyncMethodCallback<pushMessageSync_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- pushMessageSync_call method_call = new pushMessageSync_call(packet, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class pushMessageSync_call extends org.apache.thrift.async.TAsyncMethodCall {
- private Message packet;
- public pushMessageSync_call(Message packet, org.apache.thrift.async.AsyncMethodCallback<pushMessageSync_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.packet = packet;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("pushMessageSync", org.apache.thrift.protocol.TMessageType.CALL, 0));
- pushMessageSync_args args = new pushMessageSync_args();
- args.setPacket(packet);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public int getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_pushMessageSync();
- }
- }
-
- public void pushMessageAsync(Message packet, org.apache.thrift.async.AsyncMethodCallback<pushMessageAsync_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- pushMessageAsync_call method_call = new pushMessageAsync_call(packet, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class pushMessageAsync_call extends org.apache.thrift.async.TAsyncMethodCall {
- private Message packet;
- public pushMessageAsync_call(Message packet, org.apache.thrift.async.AsyncMethodCallback<pushMessageAsync_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, true);
- this.packet = packet;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("pushMessageAsync", org.apache.thrift.protocol.TMessageType.CALL, 0));
- pushMessageAsync_args args = new pushMessageAsync_args();
- args.setPacket(packet);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public void getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- }
- }
-
- public void terminateSession(String sessionid, org.apache.thrift.async.AsyncMethodCallback<terminateSession_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- terminateSession_call method_call = new terminateSession_call(sessionid, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class terminateSession_call extends org.apache.thrift.async.TAsyncMethodCall {
- private String sessionid;
- public terminateSession_call(String sessionid, org.apache.thrift.async.AsyncMethodCallback<terminateSession_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.sessionid = sessionid;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("terminateSession", org.apache.thrift.protocol.TMessageType.CALL, 0));
- terminateSession_args args = new terminateSession_args();
- args.setSessionid(sessionid);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public void getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- (new Client(prot)).recv_terminateSession();
- }
- }
-
- }
-
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
- }
-
- protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- processMap.put("getPackets", new getPackets());
- processMap.put("pushMessageSync", new pushMessageSync());
- processMap.put("pushMessageAsync", new pushMessageAsync());
- processMap.put("terminateSession", new terminateSession());
- return processMap;
- }
-
- private static class getPackets<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPackets_args> {
- public getPackets() {
- super("getPackets");
- }
-
- protected getPackets_args getEmptyArgsInstance() {
- return new getPackets_args();
- }
-
- protected getPackets_result getResult(I iface, getPackets_args args) throws org.apache.thrift.TException {
- getPackets_result result = new getPackets_result();
- result.success = iface.getPackets(args.sessionid);
- return result;
- }
- }
-
- private static class pushMessageSync<I extends Iface> extends org.apache.thrift.ProcessFunction<I, pushMessageSync_args> {
- public pushMessageSync() {
- super("pushMessageSync");
- }
-
- protected pushMessageSync_args getEmptyArgsInstance() {
- return new pushMessageSync_args();
- }
-
- protected pushMessageSync_result getResult(I iface, pushMessageSync_args args) throws org.apache.thrift.TException {
- pushMessageSync_result result = new pushMessageSync_result();
- result.success = iface.pushMessageSync(args.packet);
- result.setSuccessIsSet(true);
- return result;
- }
- }
-
- private static class pushMessageAsync<I extends Iface> extends org.apache.thrift.ProcessFunction<I, pushMessageAsync_args> {
- public pushMessageAsync() {
- super("pushMessageAsync");
- }
-
- protected pushMessageAsync_args getEmptyArgsInstance() {
- return new pushMessageAsync_args();
- }
-
- protected org.apache.thrift.TBase getResult(I iface, pushMessageAsync_args args) throws org.apache.thrift.TException {
- iface.pushMessageAsync(args.packet);
- return null;
- }
- }
-
- private static class terminateSession<I extends Iface> extends org.apache.thrift.ProcessFunction<I, terminateSession_args> {
- public terminateSession() {
- super("terminateSession");
- }
-
- protected terminateSession_args getEmptyArgsInstance() {
- return new terminateSession_args();
- }
-
- protected terminateSession_result getResult(I iface, terminateSession_args args) throws org.apache.thrift.TException {
- terminateSession_result result = new terminateSession_result();
- iface.terminateSession(args.sessionid);
- return result;
- }
- }
-
- }
-
- public static class getPackets_args implements org.apache.thrift.TBase<getPackets_args, getPackets_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPackets_args");
-
- private static final org.apache.thrift.protocol.TField SESSIONID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionid", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- public String sessionid; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SESSIONID((short)1, "sessionid");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // SESSIONID
- return SESSIONID;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SESSIONID, new org.apache.thrift.meta_data.FieldMetaData("sessionid", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPackets_args.class, metaDataMap);
- }
-
- public getPackets_args() {
- }
-
- public getPackets_args(
- String sessionid)
- {
- this();
- this.sessionid = sessionid;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getPackets_args(getPackets_args other) {
- if (other.isSetSessionid()) {
- this.sessionid = other.sessionid;
- }
- }
-
- public getPackets_args deepCopy() {
- return new getPackets_args(this);
- }
-
- @Override
- public void clear() {
- this.sessionid = null;
- }
-
- public String getSessionid() {
- return this.sessionid;
- }
-
- public getPackets_args setSessionid(String sessionid) {
- this.sessionid = sessionid;
- return this;
- }
-
- public void unsetSessionid() {
- this.sessionid = null;
- }
-
- /** Returns true if field sessionid is set (has been assigned a value) and false otherwise */
- public boolean isSetSessionid() {
- return this.sessionid != null;
- }
-
- public void setSessionidIsSet(boolean value) {
- if (!value) {
- this.sessionid = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SESSIONID:
- if (value == null) {
- unsetSessionid();
- } else {
- setSessionid((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SESSIONID:
- return getSessionid();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SESSIONID:
- return isSetSessionid();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getPackets_args)
- return this.equals((getPackets_args)that);
- return false;
- }
-
- public boolean equals(getPackets_args that) {
- if (that == null)
- return false;
-
- boolean this_present_sessionid = true && this.isSetSessionid();
- boolean that_present_sessionid = true && that.isSetSessionid();
- if (this_present_sessionid || that_present_sessionid) {
- if (!(this_present_sessionid && that_present_sessionid))
- return false;
- if (!this.sessionid.equals(that.sessionid))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(getPackets_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- getPackets_args typedOther = (getPackets_args)other;
-
- lastComparison = Boolean.valueOf(isSetSessionid()).compareTo(typedOther.isSetSessionid());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSessionid()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionid, typedOther.sessionid);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SESSIONID
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.sessionid = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.sessionid != null) {
- oprot.writeFieldBegin(SESSIONID_FIELD_DESC);
- oprot.writeString(this.sessionid);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getPackets_args(");
- boolean first = true;
-
- sb.append("sessionid:");
- if (this.sessionid == null) {
- sb.append("null");
- } else {
- sb.append(this.sessionid);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class getPackets_result implements org.apache.thrift.TBase<getPackets_result, getPackets_result._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPackets_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
-
- public List<ByteBuffer> success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPackets_result.class, metaDataMap);
- }
-
- public getPackets_result() {
- }
-
- public getPackets_result(
- List<ByteBuffer> success)
- {
- this();
- this.success = success;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getPackets_result(getPackets_result other) {
- if (other.isSetSuccess()) {
- List<ByteBuffer> __this__success = new ArrayList<ByteBuffer>();
- for (ByteBuffer other_element : other.success) {
- ByteBuffer temp_binary_element = org.apache.thrift.TBaseHelper.copyBinary(other_element);
-;
- __this__success.add(temp_binary_element);
- }
- this.success = __this__success;
- }
- }
-
- public getPackets_result deepCopy() {
- return new getPackets_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- }
-
- public int getSuccessSize() {
- return (this.success == null) ? 0 : this.success.size();
- }
-
- public java.util.Iterator<ByteBuffer> getSuccessIterator() {
- return (this.success == null) ? null : this.success.iterator();
- }
-
- public void addToSuccess(ByteBuffer elem) {
- if (this.success == null) {
- this.success = new ArrayList<ByteBuffer>();
- }
- this.success.add(elem);
- }
-
- public List<ByteBuffer> getSuccess() {
- return this.success;
- }
-
- public getPackets_result setSuccess(List<ByteBuffer> success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((List<ByteBuffer>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getPackets_result)
- return this.equals((getPackets_result)that);
- return false;
- }
-
- public boolean equals(getPackets_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(getPackets_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- getPackets_result typedOther = (getPackets_result)other;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 0: // SUCCESS
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
- this.success = new ArrayList<ByteBuffer>(_list4.size);
- for (int _i5 = 0; _i5 < _list4.size; ++_i5)
- {
- ByteBuffer _elem6; // required
- _elem6 = iprot.readBinary();
- this.success.add(_elem6);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- if (this.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.success.size()));
- for (ByteBuffer _iter7 : this.success)
- {
- oprot.writeBinary(_iter7);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getPackets_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class pushMessageSync_args implements org.apache.thrift.TBase<pushMessageSync_args, pushMessageSync_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("pushMessageSync_args");
-
- 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)1);
-
- public Message packet; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PACKET((short)1, "packet");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PACKET
- return PACKET;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Message.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(pushMessageSync_args.class, metaDataMap);
- }
-
- public pushMessageSync_args() {
- }
-
- public pushMessageSync_args(
- Message packet)
- {
- this();
- this.packet = packet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public pushMessageSync_args(pushMessageSync_args other) {
- if (other.isSetPacket()) {
- this.packet = new Message(other.packet);
- }
- }
-
- public pushMessageSync_args deepCopy() {
- return new pushMessageSync_args(this);
- }
-
- @Override
- public void clear() {
- this.packet = null;
- }
-
- public Message getPacket() {
- return this.packet;
- }
-
- public pushMessageSync_args setPacket(Message packet) {
- this.packet = packet;
- return this;
- }
-
- public void unsetPacket() {
- this.packet = null;
- }
-
- /** Returns true if field packet is set (has been assigned a value) and false otherwise */
- public boolean isSetPacket() {
- return this.packet != null;
- }
-
- public void setPacketIsSet(boolean value) {
- if (!value) {
- this.packet = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PACKET:
- if (value == null) {
- unsetPacket();
- } else {
- setPacket((Message)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PACKET:
- return getPacket();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PACKET:
- return isSetPacket();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof pushMessageSync_args)
- return this.equals((pushMessageSync_args)that);
- return false;
- }
-
- public boolean equals(pushMessageSync_args that) {
- if (that == null)
- return false;
-
- boolean this_present_packet = true && this.isSetPacket();
- boolean that_present_packet = true && that.isSetPacket();
- if (this_present_packet || that_present_packet) {
- if (!(this_present_packet && that_present_packet))
- return false;
- if (!this.packet.equals(that.packet))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(pushMessageSync_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- pushMessageSync_args typedOther = (pushMessageSync_args)other;
-
- lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPacket()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // PACKET
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.packet = new Message();
- this.packet.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.packet != null) {
- oprot.writeFieldBegin(PACKET_FIELD_DESC);
- this.packet.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("pushMessageSync_args(");
- boolean first = true;
-
- sb.append("packet:");
- if (this.packet == null) {
- sb.append("null");
- } else {
- sb.append(this.packet);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class pushMessageSync_result implements org.apache.thrift.TBase<pushMessageSync_result, pushMessageSync_result._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("pushMessageSync_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
-
- public int success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __SUCCESS_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(pushMessageSync_result.class, metaDataMap);
- }
-
- public pushMessageSync_result() {
- }
-
- public pushMessageSync_result(
- int success)
- {
- this();
- this.success = success;
- setSuccessIsSet(true);
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public pushMessageSync_result(pushMessageSync_result other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
- this.success = other.success;
- }
-
- public pushMessageSync_result deepCopy() {
- return new pushMessageSync_result(this);
- }
-
- @Override
- public void clear() {
- setSuccessIsSet(false);
- this.success = 0;
- }
-
- public int getSuccess() {
- return this.success;
- }
-
- public pushMessageSync_result setSuccess(int success) {
- this.success = success;
- setSuccessIsSet(true);
- return this;
- }
-
- public void unsetSuccess() {
- __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
- }
-
- public void setSuccessIsSet(boolean value) {
- __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((Integer)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return Integer.valueOf(getSuccess());
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof pushMessageSync_result)
- return this.equals((pushMessageSync_result)that);
- return false;
- }
-
- public boolean equals(pushMessageSync_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true;
- boolean that_present_success = true;
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (this.success != that.success)
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(pushMessageSync_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- pushMessageSync_result typedOther = (pushMessageSync_result)other;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 0: // SUCCESS
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.success = iprot.readI32();
- setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- if (this.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeI32(this.success);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("pushMessageSync_result(");
- boolean first = true;
-
- sb.append("success:");
- sb.append(this.success);
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class pushMessageAsync_args implements org.apache.thrift.TBase<pushMessageAsync_args, pushMessageAsync_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("pushMessageAsync_args");
-
- 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)1);
-
- public Message packet; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PACKET((short)1, "packet");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PACKET
- return PACKET;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PACKET, new org.apache.thrift.meta_data.FieldMetaData("packet", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Message.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(pushMessageAsync_args.class, metaDataMap);
- }
-
- public pushMessageAsync_args() {
- }
-
- public pushMessageAsync_args(
- Message packet)
- {
- this();
- this.packet = packet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public pushMessageAsync_args(pushMessageAsync_args other) {
- if (other.isSetPacket()) {
- this.packet = new Message(other.packet);
- }
- }
-
- public pushMessageAsync_args deepCopy() {
- return new pushMessageAsync_args(this);
- }
-
- @Override
- public void clear() {
- this.packet = null;
- }
-
- public Message getPacket() {
- return this.packet;
- }
-
- public pushMessageAsync_args setPacket(Message packet) {
- this.packet = packet;
- return this;
- }
-
- public void unsetPacket() {
- this.packet = null;
- }
-
- /** Returns true if field packet is set (has been assigned a value) and false otherwise */
- public boolean isSetPacket() {
- return this.packet != null;
- }
-
- public void setPacketIsSet(boolean value) {
- if (!value) {
- this.packet = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PACKET:
- if (value == null) {
- unsetPacket();
- } else {
- setPacket((Message)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PACKET:
- return getPacket();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PACKET:
- return isSetPacket();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof pushMessageAsync_args)
- return this.equals((pushMessageAsync_args)that);
- return false;
- }
-
- public boolean equals(pushMessageAsync_args that) {
- if (that == null)
- return false;
-
- boolean this_present_packet = true && this.isSetPacket();
- boolean that_present_packet = true && that.isSetPacket();
- if (this_present_packet || that_present_packet) {
- if (!(this_present_packet && that_present_packet))
- return false;
- if (!this.packet.equals(that.packet))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(pushMessageAsync_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- pushMessageAsync_args typedOther = (pushMessageAsync_args)other;
-
- lastComparison = Boolean.valueOf(isSetPacket()).compareTo(typedOther.isSetPacket());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPacket()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.packet, typedOther.packet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // PACKET
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.packet = new Message();
- this.packet.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.packet != null) {
- oprot.writeFieldBegin(PACKET_FIELD_DESC);
- this.packet.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("pushMessageAsync_args(");
- boolean first = true;
-
- sb.append("packet:");
- if (this.packet == null) {
- sb.append("null");
- } else {
- sb.append(this.packet);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class terminateSession_args implements org.apache.thrift.TBase<terminateSession_args, terminateSession_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("terminateSession_args");
-
- private static final org.apache.thrift.protocol.TField SESSIONID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionid", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- public String sessionid; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SESSIONID((short)1, "sessionid");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // SESSIONID
- return SESSIONID;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SESSIONID, new org.apache.thrift.meta_data.FieldMetaData("sessionid", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(terminateSession_args.class, metaDataMap);
- }
-
- public terminateSession_args() {
- }
-
- public terminateSession_args(
- String sessionid)
- {
- this();
- this.sessionid = sessionid;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public terminateSession_args(terminateSession_args other) {
- if (other.isSetSessionid()) {
- this.sessionid = other.sessionid;
- }
- }
-
- public terminateSession_args deepCopy() {
- return new terminateSession_args(this);
- }
-
- @Override
- public void clear() {
- this.sessionid = null;
- }
-
- public String getSessionid() {
- return this.sessionid;
- }
-
- public terminateSession_args setSessionid(String sessionid) {
- this.sessionid = sessionid;
- return this;
- }
-
- public void unsetSessionid() {
- this.sessionid = null;
- }
-
- /** Returns true if field sessionid is set (has been assigned a value) and false otherwise */
- public boolean isSetSessionid() {
- return this.sessionid != null;
- }
-
- public void setSessionidIsSet(boolean value) {
- if (!value) {
- this.sessionid = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SESSIONID:
- if (value == null) {
- unsetSessionid();
- } else {
- setSessionid((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SESSIONID:
- return getSessionid();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SESSIONID:
- return isSetSessionid();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof terminateSession_args)
- return this.equals((terminateSession_args)that);
- return false;
- }
-
- public boolean equals(terminateSession_args that) {
- if (that == null)
- return false;
-
- boolean this_present_sessionid = true && this.isSetSessionid();
- boolean that_present_sessionid = true && that.isSetSessionid();
- if (this_present_sessionid || that_present_sessionid) {
- if (!(this_present_sessionid && that_present_sessionid))
- return false;
- if (!this.sessionid.equals(that.sessionid))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(terminateSession_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- terminateSession_args typedOther = (terminateSession_args)other;
-
- lastComparison = Boolean.valueOf(isSetSessionid()).compareTo(typedOther.isSetSessionid());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSessionid()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionid, typedOther.sessionid);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // SESSIONID
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.sessionid = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.sessionid != null) {
- oprot.writeFieldBegin(SESSIONID_FIELD_DESC);
- oprot.writeString(this.sessionid);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("terminateSession_args(");
- boolean first = true;
-
- sb.append("sessionid:");
- if (this.sessionid == null) {
- sb.append("null");
- } else {
- sb.append(this.sessionid);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
- public static class terminateSession_result implements org.apache.thrift.TBase<terminateSession_result, terminateSession_result._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("terminateSession_result");
-
-
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-;
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(terminateSession_result.class, metaDataMap);
- }
-
- public terminateSession_result() {
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public terminateSession_result(terminateSession_result other) {
- }
-
- public terminateSession_result deepCopy() {
- return new terminateSession_result(this);
- }
-
- @Override
- public void clear() {
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof terminateSession_result)
- return this.equals((terminateSession_result)that);
- return false;
- }
-
- public boolean equals(terminateSession_result that) {
- if (that == null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(terminateSession_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- terminateSession_result typedOther = (terminateSession_result)other;
-
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- oprot.writeStructBegin(STRUCT_DESC);
-
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("terminateSession_result(");
- boolean first = true;
-
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- }
-
-}
diff --git a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/SwitchPortTuple.java b/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/SwitchPortTuple.java
deleted file mode 100644
index 8fe8191..0000000
--- a/lib/gen-java/net/floodlightcontroller/packetstreamer/thrift/SwitchPortTuple.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.7.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
-package net.floodlightcontroller.packetstreamer.thrift;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A struct that defines switch port tuple
- */
-@SuppressWarnings("all") public class SwitchPortTuple implements org.apache.thrift.TBase<SwitchPortTuple, SwitchPortTuple._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SwitchPortTuple");
-
- private static final org.apache.thrift.protocol.TField DPID_FIELD_DESC = new org.apache.thrift.protocol.TField("dpid", org.apache.thrift.protocol.TType.I64, (short)1);
- private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I16, (short)2);
-
- public long dpid; // required
- public short port; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- DPID((short)1, "dpid"),
- PORT((short)2, "port");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // DPID
- return DPID;
- case 2: // PORT
- return PORT;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __DPID_ISSET_ID = 0;
- private static final int __PORT_ISSET_ID = 1;
- private BitSet __isset_bit_vector = new BitSet(2);
-
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.DPID, new org.apache.thrift.meta_data.FieldMetaData("dpid", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SwitchPortTuple.class, metaDataMap);
- }
-
- public SwitchPortTuple() {
- }
-
- public SwitchPortTuple(
- long dpid,
- short port)
- {
- this();
- this.dpid = dpid;
- setDpidIsSet(true);
- this.port = port;
- setPortIsSet(true);
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public SwitchPortTuple(SwitchPortTuple other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
- this.dpid = other.dpid;
- this.port = other.port;
- }
-
- public SwitchPortTuple deepCopy() {
- return new SwitchPortTuple(this);
- }
-
- @Override
- public void clear() {
- setDpidIsSet(false);
- this.dpid = 0;
- setPortIsSet(false);
- this.port = 0;
- }
-
- public long getDpid() {
- return this.dpid;
- }
-
- public SwitchPortTuple setDpid(long dpid) {
- this.dpid = dpid;
- setDpidIsSet(true);
- return this;
- }
-
- public void unsetDpid() {
- __isset_bit_vector.clear(__DPID_ISSET_ID);
- }
-
- /** Returns true if field dpid is set (has been assigned a value) and false otherwise */
- public boolean isSetDpid() {
- return __isset_bit_vector.get(__DPID_ISSET_ID);
- }
-
- public void setDpidIsSet(boolean value) {
- __isset_bit_vector.set(__DPID_ISSET_ID, value);
- }
-
- public short getPort() {
- return this.port;
- }
-
- public SwitchPortTuple setPort(short port) {
- this.port = port;
- setPortIsSet(true);
- return this;
- }
-
- public void unsetPort() {
- __isset_bit_vector.clear(__PORT_ISSET_ID);
- }
-
- /** Returns true if field port is set (has been assigned a value) and false otherwise */
- public boolean isSetPort() {
- return __isset_bit_vector.get(__PORT_ISSET_ID);
- }
-
- public void setPortIsSet(boolean value) {
- __isset_bit_vector.set(__PORT_ISSET_ID, value);
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case DPID:
- if (value == null) {
- unsetDpid();
- } else {
- setDpid((Long)value);
- }
- break;
-
- case PORT:
- if (value == null) {
- unsetPort();
- } else {
- setPort((Short)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case DPID:
- return Long.valueOf(getDpid());
-
- case PORT:
- return Short.valueOf(getPort());
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case DPID:
- return isSetDpid();
- case PORT:
- return isSetPort();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof SwitchPortTuple)
- return this.equals((SwitchPortTuple)that);
- return false;
- }
-
- public boolean equals(SwitchPortTuple that) {
- if (that == null)
- return false;
-
- boolean this_present_dpid = true;
- boolean that_present_dpid = true;
- if (this_present_dpid || that_present_dpid) {
- if (!(this_present_dpid && that_present_dpid))
- return false;
- if (this.dpid != that.dpid)
- return false;
- }
-
- boolean this_present_port = true;
- boolean that_present_port = true;
- if (this_present_port || that_present_port) {
- if (!(this_present_port && that_present_port))
- return false;
- if (this.port != that.port)
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(SwitchPortTuple other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- SwitchPortTuple typedOther = (SwitchPortTuple)other;
-
- lastComparison = Boolean.valueOf(isSetDpid()).compareTo(typedOther.isSetDpid());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDpid()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dpid, typedOther.dpid);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPort()).compareTo(typedOther.isSetPort());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPort()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, typedOther.port);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // DPID
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.dpid = iprot.readI64();
- setDpidIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // PORT
- if (field.type == org.apache.thrift.protocol.TType.I16) {
- this.port = iprot.readI16();
- setPortIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(DPID_FIELD_DESC);
- oprot.writeI64(this.dpid);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(PORT_FIELD_DESC);
- oprot.writeI16(this.port);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("SwitchPortTuple(");
- boolean first = true;
-
- sb.append("dpid:");
- sb.append(this.dpid);
- first = false;
- if (!first) sb.append(", ");
- sb.append("port:");
- sb.append(this.port);
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
-}
-
diff --git a/lib/jamm-0.2.5.jar b/lib/jamm-0.2.5.jar
new file mode 100644
index 0000000..e9baf75
--- /dev/null
+++ b/lib/jamm-0.2.5.jar
Binary files differ
diff --git a/mastership-test.sh b/mastership-test.sh
deleted file mode 100755
index 209ffb7..0000000
--- a/mastership-test.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#java -Dlogback.configurationFile=logback.xml -cp target/floodlight-only.jar:lib/*:lib/titan/* net.onrc.onos.registry.controller.RegistryRunner $1
-java -Dlogback.configurationFile=logback.xml -cp target/floodlight-only.jar:lib/*:lib/titan/* net.floodlightcontroller.core.Main -cf onos.properties
diff --git a/onos-embedded.sh b/onos-embedded.sh
index b5cfed6..fe0db44 100755
--- a/onos-embedded.sh
+++ b/onos-embedded.sh
@@ -1,9 +1,9 @@
#!/bin/sh
# Set paths
-FL_HOME=`dirname $0`
-FL_JAR="${FL_HOME}/target/floodlight.jar"
-FL_LOGBACK="${FL_HOME}/logback.xml"
+ONOS_HOME=`dirname $0`
+ONOS_JAR="${ONOS_HOME}/target/floodlight.jar"
+ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
TITAN_CONFIG="/tmp/cassandra.titan"
CASSANDRA_CONFIG="/home/`whoami`/apache-cassandra-1.1.4/conf/cassandra.yaml"
@@ -17,15 +17,15 @@
#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
# Set classpath to include titan libs
-#CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
-CLASSPATH="${FL_HOME}/lib/*.jar:${FL_HOME}/lib/titan/*.jar"
+#CLASSPATH=`echo ${ONOS_HOME}/lib/*.jar ${ONOS_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
+CLASSPATH="${ONOS_HOME}/lib/*.jar:${ONOS_HOME}/lib/titan/*.jar"
CASSANDRA_OPTS="-Dcom.sun.management.jmxremote.port=7199"
CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
# Create a logback file if required
-cat <<EOF_LOGBACK >${FL_LOGBACK}
+cat <<EOF_LOGBACK >${ONOS_LOGBACK}
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
@@ -64,5 +64,5 @@
# Run floodlight
echo "Starting ONOS controller ..."
echo
-#java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${FL_JAR} -cf ./onos.properties
-java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR}
+#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${ONOS_JAR} -cf ./onos.properties
+java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR}
diff --git a/onos.sh b/onos.sh
deleted file mode 100755
index 5667114..0000000
--- a/onos.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-# Set paths
-FL_HOME=`dirname $0`
-FL_JAR="${FL_HOME}/target/floodlight.jar"
-FL_LOGBACK="${FL_HOME}/logback.xml"
-
-# Set JVM options
-JVM_OPTS=""
-#JVM_OPTS="$JVM_OPTS -server -d64"
-#JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m"
-#JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
-#JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
-#JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8"
-#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
-
-# Set classpath to include titan libs
-CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
-
-
-# Create a logback file if required
-cat <<EOF_LOGBACK >${FL_LOGBACK}
-<configuration scan="true" debug="true">
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%level [%logger:%thread] %msg%n</pattern>
- </encoder>
- </appender>
-
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>onos.log</file>
- <encoder>
- <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
- </encoder>
- </appender>
-
- <logger name="org" level="WARN"/>
- <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
- <logger name="net.floodlightcontroller.logging" level="WARN"/>
-
- <root level="DEBUG">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- </root>
-</configuration>
-EOF_LOGBACK
-
-# Delete and recreate /tmp/netmap
-#rm -rf /tmp/cassandra.titan
-#mkdir /tmp/cassandra.titan
-
-# Clear logs
-rm onos.log
-
-# Run floodlight
-echo "Starting ONOS controller ..."
-echo
-#java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${FL_JAR} -cf ./onos.properties
-java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR} -cf ./onos.properties
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a8730a5
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,428 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.0.4</maven>
+ </prerequisites>
+ <groupId>net.onrc.onos</groupId>
+ <artifactId>onos</artifactId>
+ <version>0.1.0</version>
+ <packaging>jar</packaging>
+ <name>ONOS</name>
+ <url>http://onlab.us/</url>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Maven Central repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ <repository>
+ <id>maven-restlet</id>
+ <name>Public online Restlet repository</name>
+ <url>http://maven.restlet.org</url>
+ </repository>
+ <!-- In Project repository -->
+ <repository>
+ <id>in-project</id>
+ <name>In Project Repo</name>
+ <url>file://${project.basedir}/repo</url>
+ </repository>
+ </repositories>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <powermock.version>1.5.1</powermock.version>
+ <restlet.version>2.1-RC1</restlet.version>
+ <github.global.server>github</github.global.server>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ </executions>
+ </plugin>
+ <!-- guice maven plugin for dependency injection inside maven -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>guice-maven-plugin</artifactId>
+ <version>2.11.0</version>
+ </plugin>
+ <!-- compile -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ <executions>
+ </executions>
+ </plugin>
+ <!-- test -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12</version>
+ <configuration>
+ <excludes>
+ <!-- exclude all test cases for now -->
+ <!-- <exclude>**/storage/tests/StorageTest.java</exclude> -->
+ <!-- <exclude>**/test/*</exclude> -->
+ <!--
+ <exclude>**/test/*</exclude>
+ <exclude>**/Test*.java</exclude>
+ <exclude>**/*Test.java</exclude>
+ <exclude>**/*TestCase.java</exclude>
+ -->
+ </excludes>
+ <argLine>-XX:MaxPermSize=256m</argLine>
+ </configuration>
+ </plugin>
+ <!-- exec:java -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <configuration>
+ <mainClass>net.onrc.onos.ofcontroller.core.Main</mainClass>
+ </configuration>
+ <executions>
+ </executions>
+ </plugin>
+ <!--<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>lib/gen-java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <charset>UTF-8</charset>
+ <locale>en</locale>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.6.3.201306030806</version>
+ <configuration>
+ <destfile>${basedir}/target/jacoco/jacoco.exec</destfile>
+ <datafile>${basedir}/target/jacoco/jacoco.exec</datafile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>jacoco-initialize</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>jacoco-site</id>
+ <phase>package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.github.github</groupId>
+ <artifactId>site-maven-plugin</artifactId>
+ <version>0.8</version>
+ <configuration>
+ <message>Creating site for ${project.version}</message>
+ <dryRun>true</dryRun>
+ <repositoryName>ONOS</repositoryName>
+ <repositoryOwner>OPENNETWORKINGLAB</repositoryOwner>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>site</goal>
+ </goals>
+ <phase>site</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <!-- for getting visualization reporting -->
+ <reporting>
+ <excludeDefaults>true</excludeDefaults>
+ <outputDirectory>${project.build.directory}/site</outputDirectory>
+ <plugins>
+ <!--
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>guice-maven-plugin</artifactId>
+ <version>2.11.0</version>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>dependencies</report>
+ <!--report>maven-emma-plugin</report-->
+ <report>scm</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <charset>UTF-8</charset>
+ <locale>en</locale>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <dependencies>
+ <!--
+ <dependency>
+ <groupId>com.esotericsoftware.kryo</groupId>
+ <artifactId>kryo</artifactId>
+ <version>2.22</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>net.onrc.onos</groupId>
+ <artifactId>kryo2</artifactId>
+ <version>2.22</version>
+ </dependency>
+ <!-- ONOS's direct dependencies -->
+ <dependency>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>apache-cassandra</artifactId>
+ <version>1.2.4</version>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>com.thinkaurelius.titan</groupId>
+ <artifactId>titan-all</artifactId>
+ <version>0.2.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop</groupId>
+ <artifactId>frames</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-core</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.hazelcast</groupId>
+ <artifactId>hazelcast</artifactId>
+ <version>3.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.restlet.jse</groupId>
+ <artifactId>org.restlet</artifactId>
+ <version>${restlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.restlet.jse</groupId>
+ <artifactId>org.restlet.ext.slf4j</artifactId>
+ <version>${restlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.0.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- Floodlight's dependencies -->
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>13.0.1</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.restlet.jse</groupId>
+ <artifactId>org.restlet.ext.jackson</artifactId>
+ <version>${restlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.restlet.jse</groupId>
+ <artifactId>org.restlet.ext.simple</artifactId>
+ <version>${restlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.simpleframework</groupId>
+ <artifactId>simple</artifactId>
+ <version>4.1.21</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>4.0.8.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>args4j</groupId>
+ <artifactId>args4j</artifactId>
+ <version>2.0.16</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
+ <artifactId>concurrentlinkedhashmap-lru</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <!--<dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython-standalone</artifactId>
+ <version>2.5.2</version>
+ </dependency>-->
+ <!--<dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.7.0</version>
+ </dependency>-->
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <version>3.0</version>
+ </dependency>
+ <!-- Dependency for libraries used for testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>3.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-easymock</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+ -->
+ <!-- dependency to locally modified version -->
+ <dependency>
+ <groupId>com.netflix.curator</groupId>
+ <artifactId>curator-framework</artifactId>
+ <version>1.3.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.netflix.curator</groupId>
+ <artifactId>curator-client</artifactId>
+ <version>1.3.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.netflix.curator</groupId>
+ <artifactId>curator-recipes</artifactId>
+ <version>1.3.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.netflix.curator</groupId>
+ <artifactId>curator-x-discovery</artifactId>
+ <version>1.3.5-SNAPSHOT</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>net.floodlightcontroller</groupId>
+ <artifactId>packetstreamer-thrift</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ -->
+ </dependencies>
+</project>
diff --git a/scripts/all-linkup-hw.sh b/scripts/all-linkup-hw.sh
new file mode 100755
index 0000000..41d6be8
--- /dev/null
+++ b/scripts/all-linkup-hw.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# BRINGS BACK UP ALL THE LINKS FOR THE HARDWARE DEMO AS SHOWN IN ONS 2013
+# link-hw.sh %s %s %s % (src_dpid, port1, cmd)
+
+./link-hw.sh 00:00:00:00:ba:5e:ba:11 24 up
+./link-hw.sh 00:00:00:00:ba:5e:ba:11 23 up
+
+./link-hw.sh 00:00:00:00:ba:5e:ba:13 22 up
+./link-hw.sh 00:00:00:00:ba:5e:ba:13 23 up
+
+./link-hw.sh 00:00:00:00:00:00:ba:12 23 up
+./link-hw.sh 00:00:00:00:00:00:ba:12 22 up
+./link-hw.sh 00:00:00:00:00:00:ba:12 24 up
+
+./link-hw.sh 00:01:00:16:97:08:9a:46 23 up
+./link-hw.sh 00:01:00:16:97:08:9a:46 24 up
+
+./link-hw.sh 00:00:20:4e:7f:51:8a:35 21 up
+./link-hw.sh 00:00:20:4e:7f:51:8a:35 22 up
+./link-hw.sh 00:00:20:4e:7f:51:8a:35 24 up
+./link-hw.sh 00:00:20:4e:7f:51:8a:35 23 up
diff --git a/scripts/all-linkup.sh b/scripts/all-linkup.sh
new file mode 100755
index 0000000..9067012
--- /dev/null
+++ b/scripts/all-linkup.sh
@@ -0,0 +1,16 @@
+#! /bin/bash
+
+controller=`hostname`
+switches=`sudo ovs-vsctl list-br`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+for s in $switches; do
+ ports=`sudo ovs-vsctl --pretty list-ports $s`
+ for p in $ports; do
+ sudo ifconfig $p up
+ done
+done
diff --git a/scripts/check-cluster-hw.sh b/scripts/check-cluster-hw.sh
new file mode 100755
index 0000000..1243e3a
--- /dev/null
+++ b/scripts/check-cluster-hw.sh
@@ -0,0 +1,30 @@
+#! /bin/bash
+
+# This checks the overall status of Cassandra, onos, zookeeper, and the web server
+# Checks status on all 8 onos nodes.
+# Built to run only on the hw testbed from ONOS1.
+#
+
+echo ""
+echo "****************************"
+echo "***** CASSANDRA STATUS *****"
+echo "****************************"
+dsh -w onos1 'cd ONOS; ./start-cassandra.sh status'
+
+echo ""
+echo "***********************"
+echo "***** ONOS STATUS *****"
+echo "***********************"
+dsh -g onos 'cd ONOS; ./start-onos.sh status; echo "Open ports on 9160: "; netstat -nat | grep 9160 | wc -l'
+
+echo ""
+echo "****************************"
+echo "***** ZOOKEEPER STATUS *****"
+echo "****************************"
+dsh -g onos '~/zookeeper-3.4.5/bin/zkServer.sh status'
+
+echo ""
+echo "**************************"
+echo "***** WEB GUI STATUS *****"
+echo "**************************"
+~/ONOS/start-rest.sh status
diff --git a/scripts/check-db-clean b/scripts/check-db-clean
new file mode 100644
index 0000000..e49d267
--- /dev/null
+++ b/scripts/check-db-clean
@@ -0,0 +1,6 @@
+g = TitanFactory.open('cassandra.local')
+g.stopTransaction(SUCCESS);
+g.V('type', 'port').each{println it.type};
+g.V('type', 'switch').each{println it.type};
+g.V('type', 'flow').each{println it.type};
+g.V('type', 'flow_entry').each{println it.type};
diff --git a/scripts/check-db-status.sh b/scripts/check-db-status.sh
new file mode 100755
index 0000000..b81e02d
--- /dev/null
+++ b/scripts/check-db-status.sh
@@ -0,0 +1,8 @@
+#! /bin/bash
+DIR=~/ONOS
+status=`~/titan-0.2.0/bin/gremlin.sh -e $DIR/scripts/check-db-clean | grep null | wc -l`
+if [ $status == 0 ]; then
+ echo "OK"
+else
+ echo "BAD"
+fi
diff --git a/scripts/cleanup-cassandra.sh b/scripts/cleanup-cassandra.sh
new file mode 100755
index 0000000..4553fd1
--- /dev/null
+++ b/scripts/cleanup-cassandra.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+DIR=~/ONOS
+~/ONOS/titan/gremlin.sh -e $DIR/scripts/cleanup-onos-db
diff --git a/scripts/cleanup-onos-db b/scripts/cleanup-onos-db
new file mode 100644
index 0000000..1725051
--- /dev/null
+++ b/scripts/cleanup-onos-db
@@ -0,0 +1,7 @@
+g=TitanFactory.open('/tmp/cassandra.titan')
+g.V('type','device').each{g.removeVertex(it)}
+g.V('type','port').each{g.removeVertex(it)}
+g.V('type','switch').each{g.removeVertex(it)}
+g.V('type','flow').each{g.removeVertex(it)}
+g.V('type','flow_entry').each{g.removeVertex(it)}
+g.stopTransaction(SUCCESS)
diff --git a/scripts/ctrl-add-ext.sh b/scripts/ctrl-add-ext.sh
new file mode 100755
index 0000000..88be2f3
--- /dev/null
+++ b/scripts/ctrl-add-ext.sh
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+import sys
+import time
+import os
+import re
+import json
+import socket
+
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+
+def read_config():
+ global controllers
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ controllers = conf['controllers']
+ f.close()
+
+if __name__ == "__main__":
+ read_config()
+ controllers.pop(0)
+ url = ""
+ for c in controllers:
+ url += " " + "tcp:%s:6633" % socket.gethostbyname(c)
+
+ switches = os.popen("sudo ovs-vsctl list-br").read().split("\n");
+ switches.remove('')
+ for s in switches:
+ print "set switch %s controller %s" % (s, url)
+ os.popen("sudo ovs-vsctl set-controller %s %s" % (s, url) )
diff --git a/ctrl-local.sh b/scripts/ctrl-local.sh
similarity index 93%
rename from ctrl-local.sh
rename to scripts/ctrl-local.sh
index 79b421b..023a9db 100755
--- a/ctrl-local.sh
+++ b/scripts/ctrl-local.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-controller="localhost"
+controller=`hostname`
switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
function host2ip (){
diff --git a/ctrl-none.sh b/scripts/ctrl-none.sh
similarity index 100%
rename from ctrl-none.sh
rename to scripts/ctrl-none.sh
diff --git a/ctrl-local.sh b/scripts/ctrl-one.sh
similarity index 75%
copy from ctrl-local.sh
copy to scripts/ctrl-one.sh
index 79b421b..207d3f2 100755
--- a/ctrl-local.sh
+++ b/scripts/ctrl-one.sh
@@ -1,5 +1,13 @@
#! /bin/bash
-controller="localhost"
+
+if [ "x$1" == "x" ];
+then
+ echo "No controller specified"
+ exit 1
+fi
+
+#controller=`hostname`
+controller=$1
switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
function host2ip (){
diff --git a/scripts/ctrl-sw.sh b/scripts/ctrl-sw.sh
new file mode 100755
index 0000000..401b7fa
--- /dev/null
+++ b/scripts/ctrl-sw.sh
@@ -0,0 +1,31 @@
+#! /usr/bin/env python
+import sys
+import time
+import os
+import re
+import json
+import socket
+
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+
+def read_config():
+ global controllers
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ controllers = conf['controllers']
+ f.close()
+
+if __name__ == "__main__":
+ read_config()
+
+ url = ""
+ for idx in sys.argv[1:]:
+ url += "tcp:%s:6633" % socket.gethostbyname(controllers[int(idx)-1]) + " "
+
+ print url[:-1]
+
+ switches = os.popen("sudo ovs-vsctl list-br").read().split("\n");
+ switches.remove('')
+ for s in switches:
+ print "set switch %s controller %s" % (s, url)
+ os.popen("sudo ovs-vsctl set-controller %s %s" % (s, url) )
diff --git a/ctrl-local.sh b/scripts/delflow.sh
similarity index 72%
copy from ctrl-local.sh
copy to scripts/delflow.sh
index 79b421b..f9ec506 100755
--- a/ctrl-local.sh
+++ b/scripts/delflow.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-controller="localhost"
+controller=""
switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
function host2ip (){
@@ -13,6 +13,5 @@
done
echo $url
for s in $switches; do
- echo "set switch $s controller $url"
- sudo ovs-vsctl set-controller $s $url
+ sudo ovs-ofctl del-flows $s
done
diff --git a/scripts/demo-reset-sw.sh b/scripts/demo-reset-sw.sh
new file mode 100755
index 0000000..e6cabae
--- /dev/null
+++ b/scripts/demo-reset-sw.sh
@@ -0,0 +1,22 @@
+#! /bin/bash
+basename=$ONOS_CLUSTER_BASENAME
+DIR=${HOME}/ONOS
+tstart=`date +"%s"`
+echo "All Link Up"
+$DIR/scripts/all-linkup.sh
+echo "Delete Flows"
+$DIR/web/delete_flow.py 201 300
+echo "Adding Flows"
+$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_start.txt
+ssh -i ~/.ssh/onlabkey.pem ${basename}5 'ONOS/start-onos.sh stop'
+ssh -i ~/.ssh/onlabkey.pem ${basename}7 'ONOS/start-onos.sh stop'
+for i in 1 2 3 4 6 8; do
+ ssh -i ~/.ssh/onlabkey.pem ${basename}$i 'ONOS/start-onos.sh startifdown'
+done
+sleep 2
+for i in 1 2 3 4 5 6 7 8; do
+ ssh -i ~/.ssh/onlabkey.pem ${basename}$i 'cd ONOS/scripts; ./ctrl-local.sh'
+done
+tend=`date +"%s"`
+(( delta = tend - tstart ))
+echo "Demo Reset Done: took $delta sec"
diff --git a/scripts/demo-scale-out-sw.sh b/scripts/demo-scale-out-sw.sh
new file mode 100755
index 0000000..887a025
--- /dev/null
+++ b/scripts/demo-scale-out-sw.sh
@@ -0,0 +1,14 @@
+#! /bin/bash
+basename=$ONOS_CLUSTER_BASENAME
+DIR=${HOME}/ONOS
+start=`date +"%s"`
+echo "bring up two nodes"
+ssh -i ~/.ssh/onlabkey.pem ${basename}5 'ONOS/start-onos.sh start'
+ssh -i ~/.ssh/onlabkey.pem ${basename}7 'ONOS/start-onos.sh start'
+sleep 2
+echo "Adding more flows"
+$DIR/web/add_flow.py -m onos -f $DIR/web/flowdef_demo_add.txt
+endt=`date +"%s"`
+(( delta = endt -start ))
+echo "Scale Up Done: took $delta sec"
+
diff --git a/clean-cassandra.sh b/scripts/drop-keyspace.sh
similarity index 100%
rename from clean-cassandra.sh
rename to scripts/drop-keyspace.sh
diff --git a/scripts/iperf b/scripts/iperf
new file mode 100755
index 0000000..bf1f490
--- /dev/null
+++ b/scripts/iperf
Binary files differ
diff --git a/scripts/link-hw.sh b/scripts/link-hw.sh
new file mode 100755
index 0000000..129da36
--- /dev/null
+++ b/scripts/link-hw.sh
@@ -0,0 +1,93 @@
+#! /bin/bash
+
+#controller=`hostname`
+switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+# link.sh 00:00:00:00:ba:5e:ba:11 1 up
+
+if [ $# != 3 ];then
+ echo "usage: $0 <dpid> <port> <up|down>"
+fi
+
+src_dpid="dpid:"`echo $1 | sed s'/://g'`
+src_port=$2
+cmd=$3
+
+if [ "x00:00:00:00:ba:5e:ba:11" == "x$1" ]; then
+ if [ x$cmd == "xup" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.61 $src_port 1
+ elif [ x$cmd == "xdown" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.61 $src_port 0
+ else
+ echo "no cmd"
+ fi
+elif [ "x00:00:00:00:00:00:ba:12" == "x$1" ]; then
+ if [ x$cmd == "xup" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.62 $src_port 1
+ elif [ x$cmd == "xdown" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.62 $src_port 0
+ else
+ echo "no cmd"
+ fi
+elif [ "x00:00:00:00:ba:5e:ba:13" == "x$1" ]; then
+ if [ x$cmd == "xup" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.63 $src_port 1
+ elif [ x$cmd == "xdown" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.63 $src_port 0
+ else
+ echo "no cmd"
+ fi
+elif [ "x00:00:20:4e:7f:51:8a:35" == "x$1" ]; then
+ if [ x$cmd == "xup" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.50 $src_port 1
+ elif [ x$cmd == "xdown" ]; then
+ ~/ONOS/scripts/prontolink.exp 10.128.0.50 $src_port 0
+ else
+ echo "no cmd"
+ fi
+
+elif [ "x00:01:00:16:97:08:9a:46" == "x$1" ]; then
+ if [ x$cmd == "xup" ]; then
+ ~/ONOS/scripts/neclink.exp $src_port no
+ elif [ x$cmd == "xdown" ]; then
+ ~/ONOS/scripts/neclink.exp $src_port
+ else
+ echo "no cmd"
+ fi
+
+
+fi
+
+
+
+#for s in $switches; do
+# dpid=`sudo ovs-ofctl show $s |grep dpid | awk '{print $4}'`
+# if [ "x$dpid" == "x$src_dpid" ]; then
+#
+## intf=`sudo ovs-ofctl show $s |grep addr | awk -v p=$src_port 'BEGIN {pat="^ "p"\("}
+## $0 ~ pat {w=match ($0, /\(.*\)/); if (w) print substr($0, RSTART+1, RLENGTH-2)}'`
+#
+# sudo ovs-ofctl show $s |grep addr | sed 's/[\(\)]/,/g'>/tmp/baz.out
+# intf=`cat /tmp/baz.out | awk -v p=$src_port 'BEGIN {pat="^ "p","}
+# $0 ~ pat {w=match($0, /,.*,/); if (w) print substr($0, RSTART+1, RLENGTH-2)}'`
+#
+# if [ x$intf != "x" ]; then
+# if [ x$cmd == "xup" ]; then
+# echo "sudo ifconfig ${intf} up"
+# sudo ifconfig ${intf} up
+# elif [ x$cmd == "xdown" ]; then
+# echo "sudo ifconfig ${intf} down"
+# sudo ifconfig ${intf} down
+# else
+# echo "sudo ifconfig ${intf}"
+# sudo ifconfig ${intf}
+# fi
+# break
+# fi
+# fi
+#done
diff --git a/scripts/link.sh b/scripts/link.sh
new file mode 100755
index 0000000..dc202e7
--- /dev/null
+++ b/scripts/link.sh
@@ -0,0 +1,46 @@
+#! /bin/bash
+
+controller=`hostname`
+switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+# link.sh 00:00:00:00:ba:5e:ba:11 1 up
+
+if [ $# != 3 ];then
+ echo "usage: $0 <dpid> <port> <up|down>"
+fi
+
+src_dpid="dpid:"`echo $1 | sed s'/://g'`
+src_port=$2
+cmd=$3
+
+for s in $switches; do
+ dpid=`sudo ovs-ofctl show $s |grep dpid | awk '{print $4}'`
+ if [ "x$dpid" == "x$src_dpid" ]; then
+
+# intf=`sudo ovs-ofctl show $s |grep addr | awk -v p=$src_port 'BEGIN {pat="^ "p"\("}
+# $0 ~ pat {w=match ($0, /\(.*\)/); if (w) print substr($0, RSTART+1, RLENGTH-2)}'`
+
+ sudo ovs-ofctl show $s |grep addr | sed 's/[\(\)]/,/g'>/tmp/baz.out
+ intf=`cat /tmp/baz.out | awk -v p=$src_port 'BEGIN {pat="^ "p","}
+ $0 ~ pat {w=match($0, /,.*,/); if (w) print substr($0, RSTART+1, RLENGTH-2)}'`
+
+ if [ x$intf != "x" ]; then
+ if [ x$cmd == "xup" ]; then
+ echo "sudo ifconfig ${intf} up"
+ sudo ifconfig ${intf} up
+ elif [ x$cmd == "xdown" ]; then
+ echo "sudo ifconfig ${intf} down"
+ sudo ifconfig ${intf} down
+ else
+ echo "sudo ifconfig ${intf}"
+ sudo ifconfig ${intf}
+ fi
+ break
+ fi
+ fi
+done
diff --git a/scripts/listports.sh b/scripts/listports.sh
new file mode 100755
index 0000000..792ea37
--- /dev/null
+++ b/scripts/listports.sh
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+controller=`hostname`
+switches=`sudo ovs-vsctl list-br`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+for s in $switches; do
+ sudo ovs-vsctl --pretty list-ports $s
+done
diff --git a/scripts/localssh.sh b/scripts/localssh.sh
new file mode 100755
index 0000000..666330f
--- /dev/null
+++ b/scripts/localssh.sh
@@ -0,0 +1,2 @@
+#! /bin/sh
+ssh -i ~/.ssh/onlabkey.pem 1.1.$1.1
diff --git a/scripts/neclink.exp b/scripts/neclink.exp
new file mode 100755
index 0000000..0815843
--- /dev/null
+++ b/scripts/neclink.exp
@@ -0,0 +1,28 @@
+#!/usr/bin/expect -f
+# ./neclink.exp <ip of port> <'no' or blank>
+set timeout 5
+set port [lindex $argv 0]
+set no [lindex $argv 1]
+
+spawn ssh ons@10.128.0.11
+expect ": "
+send "onos_test\r"
+expect ">"
+send "enable\r"
+expect ":"
+send "onos_test\r"
+expect "#"
+send "configure\r"
+expect "(config)# "
+send "interface gigabitethernet 0/$port\r"
+expect "if)# "
+send "$no shutdown\r"
+expect "# "
+send "exit\r"
+expect "# "
+send "exit\r"
+expect ": "
+send "y\r"
+expect "#"
+send "exit\r"
+expect "closed."
diff --git a/scripts/parse-classpath.py b/scripts/parse-classpath.py
new file mode 100755
index 0000000..2e60a1d
--- /dev/null
+++ b/scripts/parse-classpath.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys
+from os import path
+from xml.dom import minidom
+
+# Location of the .classpath file relative to this script
+classpath_filename = "../.classpath"
+m2_repository = "~/.m2/repository"
+
+def parse_classpath_xml(classpath_file, abs_m2_repository):
+ xmldoc = minidom.parse(classpath_file)
+ classpathentries = xmldoc.getElementsByTagName('classpathentry')
+ classpath = ""
+ for entry in classpathentries:
+ kind = entry.attributes['kind'].value
+ if kind == "output" or kind == "var":
+ cp_entry = entry.attributes['path'].value + ":"
+
+ classpath += cp_entry.replace("M2_REPO", abs_m2_repository)
+
+ print classpath[0:-1]
+
+if __name__ == "__main__":
+ abs_m2_repository = path.expanduser("~/.m2/repository")
+
+ classpath_file = path.abspath(path.join(path.dirname(path.realpath(sys.argv[0])), classpath_filename))
+
+ try:
+ with open(classpath_file) as f:
+ parse_classpath_xml(f, abs_m2_repository)
+ except IOError:
+ print "Error reading classpath file from %s" % classpath_file
+ print "- Please check path is correct then run 'mvn eclipse:eclipse' to generate file"
diff --git a/scripts/prontolink.exp b/scripts/prontolink.exp
new file mode 100755
index 0000000..501cccd
--- /dev/null
+++ b/scripts/prontolink.exp
@@ -0,0 +1,19 @@
+#!/usr/bin/expect -f
+# ./prontolink.exp <ip of switch> <port> <0 or 1 (on or off)>
+set timeout 5
+set arg0 [lindex $argv 0]
+set port [lindex $argv 1]
+set onoff [lindex $argv 2]
+
+spawn ssh root@$arg0
+expect ": "
+send "OpenFlow\r"
+expect "# "
+send "cli\r"
+expect "CLI# "
+send "port set $port enable=$onoff\r"
+expect "CLI# "
+send "quit\r"
+expect "# "
+send "exit\r"
+expect "closed."
diff --git a/scripts/read-topology-loop.py b/scripts/read-topology-loop.py
new file mode 100755
index 0000000..7354b80
--- /dev/null
+++ b/scripts/read-topology-loop.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+"""
+Small script to run a stress test on a Cassandra cluster.
+The script will periodically query data from Cassandra via ONOS
+and time the request duration.
+"""
+
+import os
+import sys
+import json
+import time
+import timeit
+from datetime import datetime
+
+host = "localhost"
+port = "9000"
+
+url="http://%s:%s/wm/core/topology/switches/all/json" % (host, port)
+command = "curl -m 5 -s %s" % url
+
+if len(sys.argv) < 2:
+ print "usage: %s output_file" % sys.argv[0]
+ sys.exit(1)
+
+output_filename = sys.argv[1]
+output_file = open(output_filename, 'w')
+output_file.write("Time" + os.linesep)
+
+def do_request():
+ try:
+ result = os.popen(command).read()
+ parsedResult = json.loads(result)
+ return True
+ except Exception as e:
+ print "Curl call failed at %s: %s" % (datetime.now(), e)
+ return False
+
+if __name__ == "__main__":
+ while (True):
+ #time_elapsed = timeit.timeit('do_request()', 'from __main__ import do_request, last_call_successful', number=1)
+ start_time = time.time()
+ result = do_request()
+ end_time = time.time()
+
+ if result:
+ output_file.write("%s%s" % (end_time - start_time, os.linesep))
+ else:
+ output_file.write("%s%s" % (0, os.linesep))
+
+ output_file.flush()
+ time.sleep(1)
diff --git a/scripts/runiperf.sh b/scripts/runiperf.sh
new file mode 100755
index 0000000..6233986
--- /dev/null
+++ b/scripts/runiperf.sh
@@ -0,0 +1,70 @@
+#! /usr/bin/env python
+import sys
+import os
+
+ONOSDIR=os.getenv("HOME") + "/ONOS"
+IPERF=ONOSDIR + "/scripts/iperf"
+IPERFLOGDIR=ONOSDIR + "/web/log"
+
+# Usage: flowid src_dpid dst_dpid params
+def usage():
+ print "%s flowid src_dpid dst_dpid hw:svr|sw:svr|hw:client|sw:client <proto>/<duration>/<interval>/<samples>" % sys.argv[0]
+ sys.exit()
+
+
+
+def main():
+ flowid = sys.argv[1]
+ src_dpid = sys.argv[2]
+ dst_dpid = sys.argv[3]
+ (testbed,server) = sys.argv[4].upper().split(':')
+ server = server[0]
+ params = sys.argv[5].split('/')
+ proto = params[0]
+ duration = params[1]
+ interval = params[2]
+ samples = params[3]
+
+ src_nwid=int(src_dpid.split(':')[-2], 16)
+ dst_nwid=int(dst_dpid.split(':')[-2], 16)
+ src_hostid=int(src_dpid.split(':')[-1], 16)
+ dst_hostid=int(dst_dpid.split(':')[-1], 16)
+
+ if (testbed == "SW"):
+ MRUN=ONOSDIR + "/test-network/mininet/mrun"
+ HOST_FMT="host%d.%d"
+ else:
+ MRUN=ONOSDIR + "$HOME/mininet/util/m"
+ HOST_FMT="g%sh%02d"
+
+ if (proto == "tcp"):
+ mininet_host = HOST_FMT % (dst_nwid, dst_hostid)
+ cmd="%s %s \'%s -t%s -i%s -k%s -yJ -o %s/iperf_%s.out -c 192.168.%d.%d 2>&1 &\' &" % (MRUN, mininet_host, IPERF, src_hostid, duration, interval, samples, IPERFLOGDIR, flowid, dst_nwid, dst_hostid)
+ killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
+ print killcmd
+ print cmd
+ os.popen(killcmd)
+ os.popen(cmd)
+ else:
+ if (server == 'S'):
+ mininet_host = HOST_FMT % (dst_nwid, dst_hostid)
+ cmd="%s %s \'%s -us -i%s -k%s -yJ -o %s/iperfsvr_%s.out 2>&1 &\' &" % (MRUN, mininet_host, IPERF, interval, samples, IPERFLOGDIR, flowid)
+ killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfsvr_%s.out\"' % (flowid)
+ print killcmd
+ print cmd
+ else:
+ mininet_host = HOST_FMT % (src_nwid, src_hostid)
+ cmd="%s %s \'%s -u -t%s -i%s -k%s -yJ -o %s/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &\' &" % (MRUN, mininet_host, IPERF, duration, interval, samples, IPERFLOGDIR, flowid, dst_nwid, dst_hostid)
+ killcmd='sudo pkill -KILL -f \"iperf .* -o .*/iperfclient_%s.out\"' % (flowid)
+ print killcmd
+ print cmd
+
+ os.popen(killcmd)
+ os.popen(cmd)
+
+if __name__ == "__main__":
+ if len(sys.argv) != 6:
+ print len(sys.argv)
+ usage()
+
+ main()
diff --git a/scripts/showdpid.sh b/scripts/showdpid.sh
new file mode 100755
index 0000000..1dff291
--- /dev/null
+++ b/scripts/showdpid.sh
@@ -0,0 +1,19 @@
+#! /bin/bash
+controller=""
+#switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+switches=`sudo ovs-vsctl list-br`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+url=""
+for c in $controller; do
+ url="$url tcp:`host2ip $c`:6633"
+done
+echo $url
+for s in $switches; do
+ echo -n "$s : "
+ sudo ovs-ofctl show $s |grep dpid
+done
diff --git a/scripts/showflow.sh b/scripts/showflow.sh
new file mode 100755
index 0000000..15824d7
--- /dev/null
+++ b/scripts/showflow.sh
@@ -0,0 +1,19 @@
+#! /bin/bash
+controller=""
+switches=`sudo ovs-vsctl list-br`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+dpids=()
+for s in $switches; do
+ i=`sudo ovs-ofctl show $s |grep dpid | awk -F ":" '{print $4}'`
+ dpids+=($i)
+done
+((j=0))
+for s in $switches; do
+ sudo ovs-ofctl dump-flows $s |grep cookie| awk -vsw=$s -vdpid=${dpids[$j]} '{printf("%s dpid=%s %s\n",sw,dpid,$0)}'
+ ((j ++ ))
+done
diff --git a/scripts/switch.sh b/scripts/switch.sh
new file mode 100755
index 0000000..eba0f34
--- /dev/null
+++ b/scripts/switch.sh
@@ -0,0 +1,29 @@
+#! /bin/bash
+controller=`hostname`
+switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+
+function host2ip (){
+ ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
+ echo $ip
+}
+
+url=""
+for c in $controller; do
+ url="$url tcp:`host2ip $c`:6633"
+done
+
+for s in $switches; do
+ dpid=`sudo ovs-ofctl show $s |grep dpid | awk '{split($4,x,":"); print x[2]}'`
+ if [ "x$dpid" == "x$1" ]; then
+ if [ x$2 == "xup" ]; then
+ sudo ovs-vsctl set-controller $s $url
+ echo "$s up"
+ elif [ x$2 == "xdown" ]; then
+ sudo ovs-vsctl set-controller $s
+ echo "$s down"
+ else
+ echo -n "$s controller: "
+ sudo ovs-vsctl get-controller $s
+ fi
+ fi
+done
diff --git a/ctrl-add-ext-template.sh b/scripts/template/ctrl-add-ext-template.sh
similarity index 88%
rename from ctrl-add-ext-template.sh
rename to scripts/template/ctrl-add-ext-template.sh
index c8e7d25..6cbf565 100755
--- a/ctrl-add-ext-template.sh
+++ b/scripts/template/ctrl-add-ext-template.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-controller="localhost onos9vpc onos10vpc onos11vpc"
+controller="onos9vpc onos10vpc onos11vpc"
me=`hostname`
controller=`echo $controller | sed "s/$me//g"`
switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
diff --git a/setup-eclipse.sh b/setup-eclipse.sh
index a39dc62..8cf8ed3 100755
--- a/setup-eclipse.sh
+++ b/setup-eclipse.sh
@@ -1,50 +1,6 @@
#!/bin/bash
+if [ -z "${MVN}" ]; then
+ MVN="mvn"
+fi
+${MVN} eclipse:eclipse
-d=$(dirname $0)
-MAIN_CLASS=$1
-LIBRARIES=$2
-[ "${MAIN_CLASS}" ] || { echo "Run 'ant eclipse' to generate Eclipse project files"; exit 1; }
-
-
-cat >$d/.project <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>floodlight</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
-EOF
-
-
-cat >$d/.classpath <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java" output="target/bin"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java" output="target/bin-test"/>
- <classpathentry kind="src" path="lib/gen-java" output="target/bin"/>
-EOF
-(
-IFS=":"
-for l in ${LIBRARIES}; do
-cat >>$d/.classpath <<EOF
- <classpathentry exported="true" kind="lib" path="$l"/>
-EOF
-done
-)
-cat >>$d/.classpath <<EOF
- <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="target/bin"/>
-</classpath>
-EOF
diff --git a/setup-local-maven.sh b/setup-local-maven.sh
new file mode 100755
index 0000000..371d50f
--- /dev/null
+++ b/setup-local-maven.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if [ -z "${MVN}" ]; then
+ MVN="mvn"
+fi
+
+# Kryo2 workaround
+${MVN} -f kryo2/pom.xml package exec:exec
+
+${MVN} install:install-file -Dfile=./lib/curator-framework-1.3.5-SNAPSHOT.jar -DgroupId=com.netflix.curator -DartifactId=curator-framework -Dversion=1.3.5-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
+${MVN} install:install-file -Dfile=./lib/curator-client-1.3.5-SNAPSHOT.jar -DgroupId=com.netflix.curator -DartifactId=curator-client -Dversion=1.3.5-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
+${MVN} install:install-file -Dfile=./lib/curator-recipes-1.3.5-SNAPSHOT.jar -DgroupId=com.netflix.curator -DartifactId=curator-recipes -Dversion=1.3.5-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
+${MVN} install:install-file -Dfile=./lib/curator-x-discovery-1.3.5-SNAPSHOT.jar -DgroupId=com.netflix.curator -DartifactId=curator-x-discovery -Dversion=1.3.5-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
+
+# download package dependencies
+${MVN} dependency:go-offline
+
+# run goals to download required plugins
+${MVN} -q test -Dtest=DoNotTest -DfailIfNoTests=false > /dev/null
+${MVN} clean compile
diff --git a/src/main/java/net/floodlightcontroller/bgproute/BgpRoute.java b/src/main/java/net/floodlightcontroller/bgproute/BgpRoute.java
deleted file mode 100644
index 2819253..0000000
--- a/src/main/java/net/floodlightcontroller/bgproute/BgpRoute.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package net.floodlightcontroller.bgproute;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.topology.ITopologyListener;
-import net.floodlightcontroller.topology.ITopologyService;
-import net.floodlightcontroller.restclient.RestClient;
-
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BgpRoute implements IFloodlightModule, IBgpRouteService, ITopologyListener {
-
- protected static Logger log = LoggerFactory.getLogger(BgpRoute.class);
-
- protected IFloodlightProviderService floodlightProvider;
- protected ITopologyService topology;
-
- protected static Ptree ptree;
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IBgpRouteService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
- Map<Class<? extends IFloodlightService>, IFloodlightService> m = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
- m.put(IBgpRouteService.class, this);
- return m;
- }
-
- protected IRestApiService restApi;
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(ITopologyService.class);
- l.add(IBgpRouteService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
-
- ptree = new Ptree(32);
-
- // Register floodlight provider and REST handler.
- floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
- restApi = context.getServiceImpl(IRestApiService.class);
- topology = context.getServiceImpl(ITopologyService.class);
-
- // Test.
- //test();
- }
-
- public Ptree getPtree() {
- return ptree;
- }
-
- // Return nexthop address as byte array.
- public Rib lookupRib(byte[] dest) {
- if (ptree == null) {
- log.debug("lookupRib: ptree null");
- return null;
- }
-
- PtreeNode node = ptree.match(dest, 32);
- if (node == null) {
- log.debug("lookupRib: ptree node null");
- return null;
- }
- if (node.rib == null) {
- log.debug("lookupRib: ptree rib null");
- return null;
- }
- ptree.delReference(node);
-
- return node.rib;
- }
-
- @SuppressWarnings("unused")
- private void test() {
- System.out.println("Here it is");
- Prefix p = new Prefix("128.0.0.0", 8);
- Prefix q = new Prefix("8.0.0.0", 8);
- Prefix r = new Prefix("10.0.0.0", 24);
- Prefix a = new Prefix("10.0.0.1", 32);
-
- ptree.acquire(p.getAddress(), p.masklen);
- ptree.acquire(q.getAddress(), q.masklen);
- ptree.acquire(r.getAddress(), r.masklen);
-
- System.out.println("Traverse start");
- for (PtreeNode node = ptree.begin(); node != null; node = ptree.next(node)) {
- Prefix p_result = new Prefix(node.key, node.keyBits);
- }
-
- PtreeNode n = ptree.match(a.getAddress(), a.masklen);
- if (n != null) {
- System.out.println("Matched prefix for 10.0.0.1:");
- Prefix x = new Prefix(n.key, n.keyBits);
- ptree.delReference(n);
- }
-
- n = ptree.lookup(p.getAddress(), p.masklen);
- if (n != null) {
- ptree.delReference(n);
- ptree.delReference(n);
- }
- System.out.println("Traverse start");
- for (PtreeNode node = ptree.begin(); node != null; node = ptree.next(node)) {
- Prefix p_result = new Prefix(node.key, node.keyBits);
- }
-
- n = ptree.lookup(q.getAddress(), q.masklen);
- if (n != null) {
- ptree.delReference(n);
- ptree.delReference(n);
- }
- System.out.println("Traverse start");
- for (PtreeNode node = ptree.begin(); node != null; node = ptree.next(node)) {
- Prefix p_result = new Prefix(node.key, node.keyBits);
- }
-
- n = ptree.lookup(r.getAddress(), r.masklen);
- if (n != null) {
- ptree.delReference(n);
- ptree.delReference(n);
- }
- System.out.println("Traverse start");
- for (PtreeNode node = ptree.begin(); node != null; node = ptree.next(node)) {
- Prefix p_result = new Prefix(node.key, node.keyBits);
- }
-
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- restApi.addRestletRoutable(new BgpRouteWebRoutable());
- topology.addListener((ITopologyListener) this);
- }
-
- @Override
- public void topologyChanged() {
- boolean change = false;
- String changelog = "";
-
- for (LDUpdate ldu : topology.getLastLinkUpdates()) {
- if (ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.PORT_DOWN)) {
- change = true;
- changelog = changelog + " down ";
- } else if (ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.PORT_UP)) {
- change = true;
- changelog = changelog + " up ";
- }
- }
- log.info ("received topo change" + changelog);
-
- if (change) {
- RestClient.get ("http://localhost:5000/topo_change");
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/BgpRouteResource.java b/src/main/java/net/floodlightcontroller/bgproute/BgpRouteResource.java
deleted file mode 100644
index d5abb5a..0000000
--- a/src/main/java/net/floodlightcontroller/bgproute/BgpRouteResource.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.floodlightcontroller.bgproute;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.Post;
-import org.restlet.resource.Delete;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import net.floodlightcontroller.restclient.RestClient;
-
-public class BgpRouteResource extends ServerResource {
-
- protected static Logger log = LoggerFactory
- .getLogger(BgpRouteResource.class);
-
- private String addrToString(byte [] addr) {
- String str = "";
-
- for (int i = 0; i < 4; i++) {
- int val = (addr[i] & 0xff);
- str += val;
- if (i != 3)
- str += ".";
- }
-
- return str;
- }
-
- @SuppressWarnings("unused")
- @Get
- public String get(String fmJson) {
- String dest = (String) getRequestAttributes().get("dest");
- String output = "";
- IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
- get(IBgpRouteService.class.getCanonicalName());
-
- if (dest != null) {
- Prefix p = new Prefix(dest, 32);
- if (p == null) {
- return "[GET]: dest address format is wrong";
- }
- byte [] nexthop = bgpRoute.lookupRib(p.getAddress()).nextHop.getAddress();
- if (nexthop != null) {
- output += "{\"result\": \"" + addrToString(nexthop) + "\"}\n";
- } else {
- output += "{\"result\": \"Nexthop does not exist\"}\n";
- }
- } else {
- Ptree ptree = bgpRoute.getPtree();
- output += "{\n \"rib\": [\n";
- boolean printed = false;
- for (PtreeNode node = ptree.begin(); node != null; node = ptree.next(node)) {
- if (node.rib == null) {
- continue;
- }
- if (printed == true) {
- output += ",\n";
- }
- output += " {\"prefix\": \"" + addrToString(node.key) + "/" + node.keyBits +"\", ";
- output += "\"nexthop\": \"" + addrToString(node.rib.nextHop.getAddress()) +"\"}";
- printed = true;
- }
- //output += "{\"router_id\": \"" + addrToString(node.rib.routerId.getAddress()) +"\"}\n";
- output += "\n ]\n}\n";
- }
-
- return output;
- }
- @Post
- public String store(String fmJson) {
- IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
- get(IBgpRouteService.class.getCanonicalName());
-
- Ptree ptree = bgpRoute.getPtree();
-
- String router_id = (String) getRequestAttributes().get("routerid");
- String prefix = (String) getRequestAttributes().get("prefix");
- String mask = (String) getRequestAttributes().get("mask");
- String nexthop = (String) getRequestAttributes().get("nexthop");
- String capability = (String) getRequestAttributes().get("capability");
- String reply = null;
-
- if (capability == null) {
- // this is a prefix add
- Prefix p = new Prefix(prefix, Integer.valueOf(mask));
- PtreeNode node = ptree.acquire(p.getAddress(), p.masklen);
- Rib rib = new Rib(router_id, nexthop, p.masklen);
-
- if (node.rib != null) {
- node.rib = null;
- ptree.delReference(node);
- }
- node.rib = rib;
-
- reply = "[POST: " + prefix + "/" + mask + ":" + nexthop + "]";
- log.info(reply);
-
- RestClient.get("http://localhost:5000/bgp_update");
- }
-
- return reply + "\n";
- }
-
- @Delete
- public String delete(String fmJson) {
- IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
- get(IBgpRouteService.class.getCanonicalName());
-
- Ptree ptree = bgpRoute.getPtree();
-
- String routerId = (String) getRequestAttributes().get("routerid");
- String prefix = (String) getRequestAttributes().get("prefix");
- String mask = (String) getRequestAttributes().get("mask");
- String nextHop = (String) getRequestAttributes().get("nexthop");
- String capability = (String) getRequestAttributes().get("capability");
- String reply = null;
-
- if (capability == null) {
- // this is a prefix delete
- Prefix p = new Prefix(prefix, Integer.valueOf(mask));
- PtreeNode node = ptree.lookup(p.getAddress(), p.masklen);
- Rib r = new Rib(routerId, nextHop, p.masklen);
-
- if (node != null && node.rib != null) {
- if (r.equals(node.rib)) {
- node.rib = null;
- ptree.delReference(node);
- }
- }
-
- reply = "[DELE: " + prefix + "/" + mask + ":" + nextHop + "]";
- log.info(reply);
-
- RestClient.get("http://localhost:5000/bgp_update");
- }
-
- return reply + "\n";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/IBgpRouteService.java b/src/main/java/net/floodlightcontroller/bgproute/IBgpRouteService.java
deleted file mode 100644
index 62bdf5e..0000000
--- a/src/main/java/net/floodlightcontroller/bgproute/IBgpRouteService.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.floodlightcontroller.bgproute;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-public interface IBgpRouteService extends IFloodlightService {
-
- public Rib lookupRib(byte[] dest);
-
- public Ptree getPtree();
-
-}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/Prefix.java b/src/main/java/net/floodlightcontroller/bgproute/Prefix.java
deleted file mode 100644
index 7ba014b..0000000
--- a/src/main/java/net/floodlightcontroller/bgproute/Prefix.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.floodlightcontroller.bgproute;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class Prefix {
- public int masklen;
- protected InetAddress address;
-
- Prefix(byte[] addr, int masklen) {
- try {
- address = InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- System.out.println("InetAddress exception");
- return;
- }
- this.masklen = masklen;
- System.out.println(address.toString() + "/" + masklen);
- }
-
- Prefix(String str, int masklen) {
- try {
- address = InetAddress.getByName(str);
- //System.out.println(address.toString());
- } catch (UnknownHostException e) {
- System.out.println("InetAddress exception");
- return;
- }
- this.masklen = masklen;
- }
-
- public byte [] getAddress() {
- return address.getAddress();
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/Rib.java b/src/main/java/net/floodlightcontroller/bgproute/Rib.java
deleted file mode 100644
index 71868ff..0000000
--- a/src/main/java/net/floodlightcontroller/bgproute/Rib.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.floodlightcontroller.bgproute;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class Rib {
- protected InetAddress routerId;
- protected InetAddress nextHop;
- protected int masklen;
-// protected int distance;
-
- Rib(InetAddress router_id, InetAddress nexthop, int masklen) {
- this.routerId = router_id;
- this.nextHop = nexthop;
- this.masklen = masklen;
-// this.distance = distance;
- }
-
- Rib(String router_id, String nexthop, int masklen) {
- try {
- this.routerId = InetAddress.getByName(router_id);
- } catch (UnknownHostException e) {
- System.out.println("InetAddress exception");
- }
- try {
- this.nextHop = InetAddress.getByName(nexthop);
- } catch (UnknownHostException e) {
- System.out.println("InetAddress exception");
- }
- this.masklen = masklen;
- }
-
- public InetAddress getNextHop() {
- return nextHop;
- }
-
- public int getMasklen(){
- return masklen;
- }
-
- public boolean equals(Rib r) {
-
- return this.routerId == r.routerId && this.nextHop == r.nextHop && this.masklen == r.masklen;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
index cd15927..4d85b7d 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
@@ -10,13 +10,12 @@
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
import net.floodlightcontroller.counter.ICounterStoreService;
-import net.floodlightcontroller.flowcache.IFlowService;
import net.floodlightcontroller.perfmon.IPktInProcessingTimeService;
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.registry.controller.IControllerRegistryService;
public class FloodlightProvider implements IFloodlightModule {
@@ -52,9 +51,9 @@
dependencies.add(IRestApiService.class);
dependencies.add(ICounterStoreService.class);
dependencies.add(IThreadPoolService.class);
- dependencies.add(IFlowService.class);
- dependencies.add(ITopoRouteService.class);
+ // Following added by ONOS
dependencies.add(IControllerRegistryService.class);
+ dependencies.add(ILinkDiscoveryService.class);
return dependencies;
}
@@ -71,10 +70,11 @@
context.getServiceImpl(IRestApiService.class));
controller.setThreadPoolService(
context.getServiceImpl(IThreadPoolService.class));
- controller.setFlowService(context.getServiceImpl(IFlowService.class));
- controller.setTopoRouteService(context.getServiceImpl(ITopoRouteService.class));
+ // Following added by ONOS
controller.setMastershipService(
context.getServiceImpl(IControllerRegistryService.class));
+ controller.setLinkDiscoveryService(
+ context.getServiceImpl(ILinkDiscoveryService.class));
controller.init(context.getConfigParams(this));
}
diff --git a/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java b/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
index 1e3ec6f..22ff029 100644
--- a/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
+++ b/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
@@ -206,5 +206,11 @@
* switch over to ACTIVE role
*/
public void setAlwaysClearFlowsOnSwAdd(boolean value);
+
+ /**
+ * Publish updates to Controller updates queue
+ * @param IUpdate
+ */
+ public void publishUpdate(IUpdate update);
}
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapService.java b/src/main/java/net/floodlightcontroller/core/INetMapService.java
deleted file mode 100644
index fcc542a..0000000
--- a/src/main/java/net/floodlightcontroller/core/INetMapService.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.floodlightcontroller.core;
-
-public interface INetMapService {
-
-}
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
deleted file mode 100644
index 8788aa7..0000000
--- a/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package net.floodlightcontroller.core;
-
-import java.util.List;
-
-import net.floodlightcontroller.devicemanager.SwitchPort;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import com.tinkerpop.blueprints.Direction;
-import com.tinkerpop.frames.Adjacency;
-import com.tinkerpop.frames.Incidence;
-import com.tinkerpop.frames.Property;
-import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy;
-import com.tinkerpop.frames.VertexFrame;
-
-public interface INetMapTopologyObjects {
-
-public interface IBaseObject extends VertexFrame {
-
- @JsonProperty("state")
- @Property("state")
- public String getState();
-
- @Property("state")
- public void setState(final String state);
-
- @JsonIgnore
- @Property("type")
- public String getType();
- @Property("type")
- public void setType(final String type);
-
-}
-
-public interface ISwitchObject extends IBaseObject{
-
- @JsonProperty("dpid")
- @Property("dpid")
- public String getDPID();
-
- @Property("dpid")
- public void setDPID(String dpid);
-
- @JsonProperty("ports")
- @Adjacency(label="on")
- public Iterable<IPortObject> getPorts();
-
- @Adjacency(label="on")
- public IPortObject getPort(final short port_num);
-
- @Adjacency(label="on")
- public void addPort(final IPortObject port);
-
- @Adjacency(label="on")
- public void removePort(final IPortObject port);
-
- @JsonIgnore
- @GremlinGroovy("_().out('on').out('host')")
- public Iterable<IDeviceObject> getDevices();
- }
-
- public interface IPortObject extends IBaseObject{
-
- @JsonProperty("number")
- @Property("number")
- public Short getNumber();
-
- @JsonProperty("desc")
- @Property("desc")
- public String getDesc();
-
- @JsonIgnore
- @Incidence(label="on",direction = Direction.IN)
- public ISwitchObject getSwitch();
-
-
- @JsonProperty("devices")
- @Adjacency(label="host")
- public Iterable<IDeviceObject> getDevices();
-
- @Adjacency(label="host")
- public void setDevice(final IDeviceObject device);
-
- @Adjacency(label="host")
- public void removeDevice(final IDeviceObject device);
-
-// @JsonIgnore
-// @Adjacency(label="link")
-// public Iterable<ILinkObject> getLinks();
- }
-
- public interface IDeviceObject extends IBaseObject {
-
- @JsonProperty("mac")
- @Property("dl_addr")
- public String getMACAddress();
- @Property("dl_addr")
- public void setMACAddress(String macaddr);
-
- @JsonProperty("ipv4")
- @Property("nw_addr")
- public String getIPAddress();
- @Property("dl_addr")
- public void setIPAddress(String ipaddr);
-
- @JsonIgnore
- @Incidence(label="host",direction = Direction.IN)
- public Iterable<IPortObject> getAttachedPorts();
-
- @JsonIgnore
- @Incidence(label="host",direction=Direction.IN)
- public void setHostPort(final IPortObject port);
-
- @JsonIgnore
- @Incidence(label="host",direction=Direction.IN)
- public void removeHostPort(final IPortObject port);
-
- @JsonIgnore
- @GremlinGroovy("_().in('host').in('on')")
- public Iterable<ISwitchObject> getSwitch();
-
-/* @JsonProperty("dpid")
- @GremlinGroovy("_().in('host').in('on').next().getProperty('dpid')")
- public Iterable<String> getSwitchDPID();
-
- @JsonProperty("number")
- @GremlinGroovy("_().in('host').transform{it.number}")
- public Iterable<Short> getPortNumber();
-
- @JsonProperty("AttachmentPoint")
- @GremlinGroovy("_().in('host').in('on').path(){it.number}{it.dpid}")
- public Iterable<SwitchPort> getAttachmentPoints();*/
- }
-
-public interface IFlowPath extends IBaseObject {
- @Property("flow_id")
- public String getFlowId();
-
- @Property("flow_id")
- public void setFlowId(String flowId);
-
- @Property("installer_id")
- public String getInstallerId();
-
- @Property("installer_id")
- public void setInstallerId(String installerId);
-
- @Property("src_switch")
- public String getSrcSwitch();
-
- @Property("src_switch")
- public void setSrcSwitch(String srcSwitch);
-
- @Property("src_port")
- public Short getSrcPort();
-
- @Property("src_port")
- public void setSrcPort(Short srcPort);
-
- @Property("dst_switch")
- public String getDstSwitch();
-
- @Property("dst_switch")
- public void setDstSwitch(String dstSwitch);
-
- @Property("dst_port")
- public Short getDstPort();
-
- @Property("dst_port")
- public void setDstPort(Short dstPort);
-
- @Adjacency(label="flow", direction=Direction.IN)
- public Iterable<IFlowEntry> getFlowEntries();
-
- @Adjacency(label="flow", direction=Direction.IN)
- public void addFlowEntry(final IFlowEntry flowEntry);
-
- @Adjacency(label="flow", direction=Direction.IN)
- public void removeFlowEntry(final IFlowEntry flowEntry);
- }
-
-public interface IFlowEntry extends IBaseObject {
- @Property("flow_entry_id")
- public String getFlowEntryId();
-
- @Property("flow_entry_id")
- public void setFlowEntryId(String flowEntryId);
-
- @Property("switch_dpid")
- public String getSwitchDpid();
-
- @Property("switch_dpid")
- public void setSwitchDpid(String switchDpid);
-
- @Property("in_port")
- public Short getInPort();
-
- @Property("in_port")
- public void setInPort(Short inPort);
-
- @Property("out_port")
- public Short getOutPort();
-
- @Property("out_port")
- public void setOutPort(Short outPort);
-
- @Property("user_state")
- public String getUserState();
-
- @Property("user_state")
- public void setUserState(String userState);
-
- @Property("switch_state")
- public String getSwitchState();
-
- @Property("switch_state")
- public void setSwitchState(String switchState);
-
- @Property("error_state_type")
- public String getErrorStateType();
-
- @Property("error_state_type")
- public void setErrorStateType(String errorStateType);
-
- @Property("error_state_code")
- public String getErrorStateCode();
-
- @Property("error_state_code")
- public void setErrorStateCode(String errorStateCode);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java b/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java
deleted file mode 100644
index b16e4a9..0000000
--- a/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package net.floodlightcontroller.core;
-
-import java.util.List;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.routing.Link;
-import net.floodlightcontroller.topology.NodePortTuple;
-import net.floodlightcontroller.util.DataPath;
-import net.floodlightcontroller.util.SwitchPort;
-
-public interface INetMapTopologyService extends INetMapService {
-
- public interface ITopoSwitchService {
- Iterable<ISwitchObject> getActiveSwitches();
- Iterable<ISwitchObject> getAllSwitches();
- Iterable<ISwitchObject> getInactiveSwitches();
- Iterable<IPortObject> getPortsOnSwitch(String dpid);
- IPortObject getPortOnSwitch(String dpid, short port_num);
-
- }
-
- public interface ITopoLinkService {
- List<Link> getActiveLinks();
- List<Link> getLinksOnSwitch(String dpid);
- }
- public interface ITopoDeviceService {
- Iterable<IDeviceObject> getActiveDevices();
- Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
- Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
- }
-
- public interface ITopoRouteService extends IFloodlightService {
- DataPath getShortestPath(SwitchPort src, SwitchPort dest);
- Boolean routeExists(SwitchPort src, SwitchPort dest);
- }
-
- public interface ITopoFlowService {
- Boolean flowExists(NodePortTuple src, NodePortTuple dest);
- List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest);
-
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/IOFMessageFilterManagerService.java b/src/main/java/net/floodlightcontroller/core/IOFMessageFilterManagerService.java
deleted file mode 100644
index 36b5be3..0000000
--- a/src/main/java/net/floodlightcontroller/core/IOFMessageFilterManagerService.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.floodlightcontroller.core;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-public interface IOFMessageFilterManagerService extends IFloodlightService {
- // empty for now
-}
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
index df609e7..d63624c 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
@@ -338,12 +338,6 @@
Object removeAttribute(String name);
/**
- * Setup an unconnected switch with the info required.
- * @param dpid of the switch
- */
- public void setupRemoteSwitch(Long dpid);
-
- /**
* Clear all flowmods on this switch
*/
public void clearAllFlowMods();
diff --git a/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java b/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java
deleted file mode 100644
index 3646e15..0000000
--- a/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.floodlightcontroller.core;
-
-import java.util.Collection;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-
-import org.openflow.protocol.OFPhysicalPort;
-
-public interface ISwitchStorage extends INetMapStorage {
-
- public enum SwitchState {
- INACTIVE,
- ACTIVE
- }
-
- /*
- * Update the switch details
- */
- public void update(String dpid,SwitchState state, DM_OPERATION op);
- /*
- * Associate a port on switch
- */
- public void addPort(String dpid, OFPhysicalPort port);
- /*
- * Get all ports associated on a switch
- */
- public Collection<OFPhysicalPort> getPorts(long dpid);
- /*
- * Get Port by Number
- */
- public OFPhysicalPort getPort(String dpid, short portnum);
- /*
- * Get port by name
- */
- public OFPhysicalPort getPort(String dpid, String portName);
- /*
- * Add a switch
- */
- public void addSwitch(String dpid);
- /*
- * Delete switch and associated ports
- */
- public void deleteSwitch(String dpid);
- /*
- * Delete a port on a switch by num
- */
- public void deletePort(String dpid, short port);
- /*
- * Delete port on a switch by name
- */
- public void deletePort(String dpid, String portName);
-
- public Iterable<ISwitchObject> getActiveSwitches();
- public Iterable<ISwitchObject> getAllSwitches();
- public Iterable<ISwitchObject> getInactiveSwitches();
-
- /*
- * Initialize
- */
- public void init(String conf);
-
-
-}
diff --git a/src/main/java/net/floodlightcontroller/core/IUpdate.java b/src/main/java/net/floodlightcontroller/core/IUpdate.java
new file mode 100644
index 0000000..950bc0f
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/core/IUpdate.java
@@ -0,0 +1,10 @@
+package net.floodlightcontroller.core;
+
+public interface IUpdate {
+
+ /**
+ * Calls the appropriate listeners
+ */
+ public void dispatch();
+
+}
diff --git a/src/main/java/net/floodlightcontroller/core/OFMessageFilterManager.java b/src/main/java/net/floodlightcontroller/core/OFMessageFilterManager.java
deleted file mode 100644
index 391c002..0000000
--- a/src/main/java/net/floodlightcontroller/core/OFMessageFilterManager.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/**
- * Copyright 2011, Big Switch Networks, Inc.
- * Originally created by David Erickson, Stanford University
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License. You may obtain
- * a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- **/
-
-package net.floodlightcontroller.core;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFType;
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.ArrayList;
-import org.apache.thrift.TException;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-
-import net.floodlightcontroller.core.annotations.LogMessageCategory;
-import net.floodlightcontroller.core.annotations.LogMessageDoc;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packetstreamer.thrift.*;
-import net.floodlightcontroller.threadpool.IThreadPoolService;
-
-@LogMessageCategory("OpenFlow Message Tracing")
-public class OFMessageFilterManager
- implements IOFMessageListener, IFloodlightModule, IOFMessageFilterManagerService {
-
- /**
- * @author Srini
- */
- protected static Logger log = LoggerFactory.getLogger(OFMessageFilterManager.class);
-
- // The port and client reference for packet streaming
- protected int serverPort = 9090;
- protected final int MaxRetry = 1;
- protected static TTransport transport = null;
- protected static PacketStreamer.Client packetClient = null;
-
- protected IFloodlightProviderService floodlightProvider = null;
- protected IThreadPoolService threadPool = null;
- // filter List is a key value pair. Key is the session id,
- // value is the filter rules.
- protected ConcurrentHashMap<String,
- ConcurrentHashMap<String,
- String>> filterMap = null;
- protected ConcurrentHashMap<String, Long> filterTimeoutMap = null;
- protected Timer timer = null;
-
- protected int MAX_FILTERS=5;
- protected long MAX_FILTER_TIME= 300000; // maximum filter time is 5 minutes.
- protected int TIMER_INTERVAL = 1000; // 1 second time interval.
-
- public static final String SUCCESS = "0";
- public static final String FILTER_SETUP_FAILED = "-1001";
- public static final String FILTER_NOT_FOUND = "-1002";
- public static final String FILTER_LIMIT_REACHED = "-1003";
- public static final String FILTER_SESSION_ID_NOT_FOUND = "-1004";
- public static final String SERVICE_UNAVAILABLE = "-1005";
-
- public enum FilterResult {
- /*
- * FILTER_NOT_DEFINED: Filter is not defined
- * FILTER_NO_MATCH: Filter is defined and the packet doesn't
- * match the filter
- * FILTER_MATCH: Filter is defined and the packet matches
- * the filter
- */
- FILTER_NOT_DEFINED, FILTER_NO_MATCH, FILTER_MATCH
- }
-
- protected String addFilter(ConcurrentHashMap<String,String> f, long delta) {
-
- // Create unique session ID.
- int prime = 33791;
- String s = null;
- int i;
-
- if ((filterMap == null) || (filterTimeoutMap == null))
- return String.format("%d", FILTER_SETUP_FAILED);
-
- for (i=0; i<MAX_FILTERS; ++i) {
- Integer x = prime + i;
- s = String.format("%d", x.hashCode());
- // implies you can use this key for session id.
- if (!filterMap.containsKey(s)) break;
- }
-
- if (i==MAX_FILTERS) {
- return FILTER_LIMIT_REACHED;
- }
-
- filterMap.put(s, f);
- if (filterTimeoutMap.containsKey(s)) filterTimeoutMap.remove(s);
- filterTimeoutMap.put(s, delta);
-
- // set the timer as there will be no existing timers.
- if (filterMap.size() == 1) {
- TimeoutFilterTask task = new TimeoutFilterTask(this);
- Timer timer = new Timer();
- timer.schedule (task, TIMER_INTERVAL);
- // Keep the listeners to avoid race condition
- //startListening();
- }
- return s; // the return string is the session ID.
- }
-
- public String setupFilter(String sid,
- ConcurrentHashMap<String,String> f,
- int deltaInMilliSeconds) {
-
- if (sid == null) {
- // Delta in filter needs to be milliseconds
- log.debug("Adding new filter: {} for {} ms", f, deltaInMilliSeconds);
- return addFilter(f, deltaInMilliSeconds);
- } else {// this is the session id.
- // we will ignore the hash map features.
- if (deltaInMilliSeconds > 0)
- return refreshFilter(sid, deltaInMilliSeconds);
- else
- return deleteFilter(sid);
- }
- }
-
- public int timeoutFilters() {
- Iterator<String> i = filterTimeoutMap.keySet().iterator();
-
- while(i.hasNext()) {
- String s = i.next();
-
- Long t = filterTimeoutMap.get(s);
- if (t != null) {
- i.remove();
- t -= TIMER_INTERVAL;
- if (t > 0) {
- filterTimeoutMap.put(s, t);
- } else deleteFilter(s);
- } else deleteFilter(s);
- }
- return filterMap.size();
- }
-
- protected String refreshFilter(String s, int delta) {
- Long t = filterTimeoutMap.get(s);
- if (t != null) {
- filterTimeoutMap.remove(s);
- t += delta; // time is in milliseconds
- if (t > MAX_FILTER_TIME) t = MAX_FILTER_TIME;
- filterTimeoutMap.put(s, t);
- return SUCCESS;
- } else return FILTER_SESSION_ID_NOT_FOUND;
- }
-
- @LogMessageDoc(level="ERROR",
- message="Error while terminating packet " +
- "filter session",
- explanation="An unknown error occurred while terminating " +
- "a packet filter session.",
- recommendation=LogMessageDoc.GENERIC_ACTION)
- protected String deleteFilter(String sessionId) {
-
- if (filterMap.containsKey(sessionId)) {
- filterMap.remove(sessionId);
- try {
- if (packetClient != null)
- packetClient.terminateSession(sessionId);
- } catch (TException e) {
- log.error("Error while terminating packet " +
- "filter session", e);
- }
- log.debug("Deleted Filter {}. # of filters" +
- " remaining: {}", sessionId, filterMap.size());
- return SUCCESS;
- } else return FILTER_SESSION_ID_NOT_FOUND;
- }
-
- public HashSet<String> getMatchedFilters(OFMessage m, FloodlightContext cntx) {
-
- HashSet<String> matchedFilters = new HashSet<String>();
-
- // This default function is written to match on packet ins and
- // packet outs.
- Ethernet eth = null;
-
- if (m.getType() == OFType.PACKET_IN) {
- eth = IFloodlightProviderService.bcStore.get(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
- } else if (m.getType() == OFType.PACKET_OUT) {
- eth = new Ethernet();
- OFPacketOut p = (OFPacketOut) m;
-
- // No MAC match if packetOut doesn't have the packet.
- if (p.getPacketData() == null) return null;
-
- eth.deserialize(p.getPacketData(), 0, p.getPacketData().length);
- } else if (m.getType() == OFType.FLOW_MOD) {
- // flow-mod can't be matched by mac.
- return null;
- }
-
- if (eth == null) return null;
-
- Iterator<String> filterIt = filterMap.keySet().iterator();
- while (filterIt.hasNext()) { // for every filter
- boolean filterMatch = false;
- String filterSessionId = filterIt.next();
- Map<String,String> filter = filterMap.get(filterSessionId);
-
- // If the filter has empty fields, then it is not considered as a match.
- if (filter == null || filter.isEmpty()) continue;
- Iterator<String> fieldIt = filter.keySet().iterator();
- while (fieldIt.hasNext()) {
- String filterFieldType = fieldIt.next();
- String filterFieldValue = filter.get(filterFieldType);
- if (filterFieldType.equals("mac")) {
-
- String srcMac = HexString.toHexString(eth.getSourceMACAddress());
- String dstMac = HexString.toHexString(eth.getDestinationMACAddress());
- log.debug("srcMac: {}, dstMac: {}", srcMac, dstMac);
-
- if (filterFieldValue.equals(srcMac) ||
- filterFieldValue.equals(dstMac)){
- filterMatch = true;
- } else {
- filterMatch = false;
- break;
- }
- }
- }
- if (filterMatch) {
- matchedFilters.add(filterSessionId);
- }
- }
-
- if (matchedFilters.isEmpty())
- return null;
- else
- return matchedFilters;
- }
-
- @LogMessageDoc(level="ERROR",
- message="Failed to establish connection with the " +
- "packetstreamer server.",
- explanation="The message tracing server is not running " +
- "or otherwise unavailable.",
- recommendation=LogMessageDoc.CHECK_CONTROLLER)
- public boolean connectToPSServer() {
- int numRetries = 0;
- if (transport != null && transport.isOpen()) {
- return true;
- }
-
- while (numRetries++ < MaxRetry) {
- try {
- transport = new TFramedTransport(new TSocket("localhost",
- serverPort));
- transport.open();
-
- TProtocol protocol = new TBinaryProtocol(transport);
- packetClient = new PacketStreamer.Client(protocol);
-
- log.debug("Have a connection to packetstreamer server " +
- "localhost:{}", serverPort);
- break;
- } catch (TException x) {
- try {
- // Wait for 1 second before retry
- if (numRetries < MaxRetry) {
- Thread.sleep(1000);
- }
- } catch (Exception e) {}
- }
- }
-
- if (numRetries > MaxRetry) {
- log.error("Failed to establish connection with the " +
- "packetstreamer server.");
- return false;
- }
- return true;
- }
-
- public void disconnectFromPSServer() {
- if (transport != null && transport.isOpen()) {
- log.debug("Close the connection to packetstreamer server" +
- " localhost:{}", serverPort);
- transport.close();
- }
- }
-
- @Override
- public String getName() {
- return "messageFilterManager";
- }
-
- @Override
- public boolean isCallbackOrderingPrereq(OFType type, String name) {
- return (type == OFType.PACKET_IN && name.equals("devicemanager"));
- }
-
- @Override
- public boolean isCallbackOrderingPostreq(OFType type, String name) {
- return (type == OFType.PACKET_IN && name.equals("learningswitch"));
- }
-
- @Override
- @LogMessageDoc(level="ERROR",
- message="Error while sending packet",
- explanation="Failed to send a message to the message " +
- "tracing server",
- recommendation=LogMessageDoc.CHECK_CONTROLLER)
- public Command receive(IOFSwitch sw, OFMessage msg,
- FloodlightContext cntx) {
-
- if (filterMap == null || filterMap.isEmpty()) return Command.CONTINUE;
-
- HashSet<String> matchedFilters = null;
- if (log.isDebugEnabled()) {
- log.debug("Received packet {} from switch {}",
- msg, sw.getStringId());
- }
-
- matchedFilters = getMatchedFilters(msg, cntx);
- if (matchedFilters == null) {
- return Command.CONTINUE;
- } else {
- try {
- sendPacket(matchedFilters, sw, msg, cntx, true);
- } catch (Exception e) {
- log.error("Error while sending packet", e);
- }
- }
-
- return Command.CONTINUE;
- }
-
-
- public class TimeoutFilterTask extends TimerTask {
-
- OFMessageFilterManager filterManager;
- ScheduledExecutorService ses = threadPool.getScheduledExecutor();
-
- public TimeoutFilterTask(OFMessageFilterManager manager) {
- filterManager = manager;
- }
-
- public void run() {
- int x = filterManager.timeoutFilters();
-
- if (x > 0) { // there's at least one filter still active.
- Timer timer = new Timer();
- timer.schedule(new TimeoutFilterTask(filterManager),
- TIMER_INTERVAL);
- } else {
- // Don't stop the listener to avoid race condition
- //stopListening();
- }
- }
- }
-
- public int getNumberOfFilters() {
- return filterMap.size();
- }
-
- public int getMaxFilterSize() {
- return MAX_FILTERS;
- }
-
- protected void sendPacket(HashSet<String> matchedFilters, IOFSwitch sw,
- OFMessage msg, FloodlightContext cntx, boolean sync)
- throws TException {
- Message sendMsg = new Message();
- Packet packet = new Packet();
- ChannelBuffer bb;
- sendMsg.setPacket(packet);
-
- List<String> sids = new ArrayList<String>(matchedFilters);
-
- sendMsg.setSessionIDs(sids);
- packet.setMessageType(OFMessageType.findByValue((msg.getType().ordinal())));
-
- switch (msg.getType()) {
- case PACKET_IN:
- OFPacketIn pktIn = (OFPacketIn)msg;
- packet.setSwPortTuple(new SwitchPortTuple(sw.getId(),
- pktIn.getInPort()));
- bb = ChannelBuffers.buffer(pktIn.getLength());
- pktIn.writeTo(bb);
- packet.setData(OFMessage.getData(sw, msg, cntx));
- break;
- case PACKET_OUT:
- OFPacketOut pktOut = (OFPacketOut)msg;
- packet.setSwPortTuple(new SwitchPortTuple(sw.getId(),
- pktOut.getInPort()));
- bb = ChannelBuffers.buffer(pktOut.getLength());
- pktOut.writeTo(bb);
- packet.setData(OFMessage.getData(sw, msg, cntx));
- break;
- case FLOW_MOD:
- OFFlowMod offlowMod = (OFFlowMod)msg;
- packet.setSwPortTuple(new SwitchPortTuple(sw.getId(),
- offlowMod.
- getOutPort()));
- bb = ChannelBuffers.buffer(offlowMod.getLength());
- offlowMod.writeTo(bb);
- packet.setData(OFMessage.getData(sw, msg, cntx));
- break;
- default:
- packet.setSwPortTuple(new SwitchPortTuple(sw.getId(),
- (short)0));
- String strData = "Unknown packet";
- packet.setData(strData.getBytes());
- break;
- }
-
- try {
- if (transport == null ||
- !transport.isOpen() ||
- packetClient == null) {
- if (!connectToPSServer()) {
- // No need to sendPacket if can't make connection to
- // the server
- return;
- }
- }
- if (sync) {
- log.debug("Send packet sync: {}", packet.toString());
- packetClient.pushMessageSync(sendMsg);
- } else {
- log.debug("Send packet sync: ", packet.toString());
- packetClient.pushMessageAsync(sendMsg);
- }
- } catch (Exception e) {
- log.error("Error while sending packet", e);
- disconnectFromPSServer();
- connectToPSServer();
- }
- }
-
- // IFloodlightModule methods
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IOFMessageFilterManagerService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- // We are the class that implements the service
- m.put(IOFMessageFilterManagerService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(IThreadPoolService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- this.floodlightProvider =
- context.getServiceImpl(IFloodlightProviderService.class);
- this.threadPool =
- context.getServiceImpl(IThreadPoolService.class);
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // This is our 'constructor'
-
- filterMap = new ConcurrentHashMap<String, ConcurrentHashMap<String,String>>();
- filterTimeoutMap = new ConcurrentHashMap<String, Long>();
- serverPort =
- Integer.parseInt(System.getProperty("net.floodlightcontroller." +
- "packetstreamer.port", "9090"));
-
- floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
- floodlightProvider.addOFMessageListener(OFType.PACKET_OUT, this);
- floodlightProvider.addOFMessageListener(OFType.FLOW_MOD, this);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 3e657d1..31f80cc 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -54,20 +54,17 @@
import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IInfoProvider;
import net.floodlightcontroller.core.IListener.Command;
-import net.floodlightcontroller.core.INetMapStorage.DM_OPERATION;
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
import net.floodlightcontroller.core.IOFMessageListener;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.IOFSwitchFilter;
import net.floodlightcontroller.core.IOFSwitchListener;
-import net.floodlightcontroller.core.ISwitchStorage.SwitchState;
+import net.floodlightcontroller.core.IUpdate;
import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs;
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.util.ListenerDispatcher;
import net.floodlightcontroller.core.web.CoreWebRoutable;
import net.floodlightcontroller.counter.ICounterStoreService;
-import net.floodlightcontroller.flowcache.IFlowService;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.perfmon.IPktInProcessingTimeService;
import net.floodlightcontroller.restserver.IRestApiService;
@@ -77,6 +74,8 @@
import net.floodlightcontroller.storage.OperatorPredicate;
import net.floodlightcontroller.storage.StorageException;
import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.registry.controller.IControllerRegistryService;
import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
import net.onrc.onos.registry.controller.RegistryException;
@@ -140,26 +139,21 @@
import org.slf4j.LoggerFactory;
-
/**
* The main controller class. Handles all setup and network listeners
+ *
+ * Extensions made by ONOS are:
+ * - Detailed Port event: PORTCHANGED -> {PORTCHANGED, PORTADDED, PORTREMOVED}
+ * Available as net.onrc.onos.ofcontroller.core.IOFSwitchPortListener
+ * - Distributed ownership control of switch through RegistryService(IControllerRegistryService)
+ * - Register ONOS services. (IControllerRegistryService)
+ * - Additional DEBUG logs
+ * - Try using hostname as controller ID, when ID was not explicitly given.
*/
public class Controller implements IFloodlightProviderService,
IStorageSourceListener {
-
- ThreadLocal<SwitchStorageImpl> store = new ThreadLocal<SwitchStorageImpl>() {
- @Override
- protected SwitchStorageImpl initialValue() {
- SwitchStorageImpl swStore = new SwitchStorageImpl();
- //TODO: Get the file path from global properties
- swStore.init("/tmp/cassandra.titan");
- return swStore;
- }
- };
-
- protected SwitchStorageImpl swStore = store.get();
-
- protected static Logger log = LoggerFactory.getLogger(Controller.class);
+
+ protected final static Logger log = LoggerFactory.getLogger(Controller.class);
private static final String ERROR_DATABASE =
"The controller could not communicate with the system database.";
@@ -194,10 +188,10 @@
protected IStorageSourceService storageSource;
protected IPktInProcessingTimeService pktinProcTime;
protected IThreadPoolService threadPool;
- protected IFlowService flowService;
- protected ITopoRouteService topoRouteService;
protected IControllerRegistryService registryService;
+ protected ILinkDiscoveryService linkDiscovery;
+
// Configuration options
protected int openFlowPort = 6633;
protected int workerThreads = 0;
@@ -261,32 +255,33 @@
// Perf. related configuration
protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
protected static final int BATCH_MAX_SIZE = 100;
- protected static final boolean ALWAYS_DECODE_ETH = true;
-
- /**
- * Updates handled by the main loop
- */
- protected interface IUpdate {
- /**
- * Calls the appropriate listeners
- */
- public void dispatch();
- }
+ protected static final boolean ALWAYS_DECODE_ETH = true;
+
public enum SwitchUpdateType {
ADDED,
REMOVED,
- PORTCHANGED
+ PORTCHANGED,
+ PORTADDED,
+ PORTREMOVED
}
+
/**
* Update message indicating a switch was added or removed
+ * ONOS: This message extended to indicate Port add or removed event.
*/
protected class SwitchUpdate implements IUpdate {
public IOFSwitch sw;
+ public OFPhysicalPort port; // Added by ONOS
public SwitchUpdateType switchUpdateType;
public SwitchUpdate(IOFSwitch sw, SwitchUpdateType switchUpdateType) {
this.sw = sw;
this.switchUpdateType = switchUpdateType;
}
+ public SwitchUpdate(IOFSwitch sw, OFPhysicalPort port, SwitchUpdateType switchUpdateType) {
+ this.sw = sw;
+ this.port = port;
+ this.switchUpdateType = switchUpdateType;
+ }
public void dispatch() {
if (log.isTraceEnabled()) {
log.trace("Dispatching switch update {} {}",
@@ -304,6 +299,18 @@
case PORTCHANGED:
listener.switchPortChanged(sw.getId());
break;
+ case PORTADDED:
+ if (listener instanceof IOFSwitchPortListener) {
+ ((IOFSwitchPortListener) listener).switchPortAdded(sw.getId(), port);
+ }
+ break;
+ case PORTREMOVED:
+ if (listener instanceof IOFSwitchPortListener) {
+ ((IOFSwitchPortListener) listener).switchPortRemoved(sw.getId(), port);
+ }
+ break;
+ default:
+ break;
}
}
}
@@ -399,18 +406,14 @@
this.threadPool = tp;
}
- public void setFlowService(IFlowService serviceImpl) {
- this.flowService = serviceImpl;
- }
-
- public void setTopoRouteService(ITopoRouteService serviceImpl) {
- this.topoRouteService = serviceImpl;
- }
-
public void setMastershipService(IControllerRegistryService serviceImpl) {
this.registryService = serviceImpl;
}
+ public void setLinkDiscoveryService(ILinkDiscoveryService linkDiscovery) {
+ this.linkDiscovery = linkDiscovery;
+ }
+
@Override
public Role getRole() {
synchronized(roleChanger) {
@@ -452,7 +455,13 @@
}
}
-
+ public void publishUpdate(IUpdate update) {
+ try {
+ this.updates.put(update);
+ } catch (InterruptedException e) {
+ log.error("Failure adding update to queue", e);
+ }
+ }
// **********************
// ChannelUpstreamHandler
@@ -489,36 +498,25 @@
Role role = null;
- if (sw.getRole() == null){
- if (hasControl){
- role = Role.MASTER;
- }
- else {
- role = Role.SLAVE;
- }
- }
- else if (hasControl && sw.getRole() == Role.SLAVE) {
- // Send a MASTER role request to the switch.
- // If this is the first role request,
- // this is a probe that we'll use to determine if the switch
- // actually supports the role request message. If it does we'll
- // get back a role reply message. If it doesn't we'll get back an
- // OFError message.
- // If role is MASTER we will promote switch to active
- // list when we receive the switch's role reply messages
+ /*
+ * issue #229
+ * Cannot rely on sw.getRole() as it can be behind due to pending
+ * role changes in the queue. Just submit it and late the RoleChanger
+ * handle duplicates.
+ */
+
+ if (hasControl){
role = Role.MASTER;
}
- else if (!hasControl && sw.getRole() == Role.MASTER) {
- //Send a SLAVE role request to the switch
+ else {
role = Role.SLAVE;
}
-
- if (role != null) {
- log.debug("Sending role request {} msg to {}", role, sw);
- Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
- swList.add(sw);
- roleChanger.submitRequest(swList, role);
- }
+
+ log.debug("Sending role request {} msg to {}", role, sw);
+ Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
+ swList.add(sw);
+ roleChanger.submitRequest(swList, role);
+
}
}
@@ -571,7 +569,9 @@
removeSwitch(sw);
}
synchronized(roleChanger) {
- registryService.releaseControl(sw.getId());
+ if (controlRequested) {
+ registryService.releaseControl(sw.getId());
+ }
connectedSwitches.remove(sw);
}
sw.setConnected(false);
@@ -753,7 +753,7 @@
}
if (is_core_switch) {
sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH,
- new Boolean(true));
+ true);
}
}
sw.removeAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE);
@@ -778,6 +778,7 @@
*/
void sendHelloConfiguration() throws IOException {
// Send initial Features Request
+ log.debug("Sending FEATURES_REQUEST to {}", sw);
sw.write(factory.getMessage(OFType.FEATURES_REQUEST), null);
}
@@ -787,6 +788,7 @@
* @throws IOException
*/
void sendFeatureReplyConfiguration() throws IOException {
+ log.debug("Sending CONFIG_REQUEST to {}", sw);
// Ensure we receive the full packet via PacketIn
OFSetConfig config = (OFSetConfig) factory
.getMessage(OFType.SET_CONFIG);
@@ -807,11 +809,13 @@
}
+ volatile Boolean controlRequested = Boolean.FALSE;
protected void checkSwitchReady() {
if (state.hsState == HandshakeState.FEATURES_REPLY &&
state.hasDescription && state.hasGetConfigReply) {
state.hsState = HandshakeState.READY;
+ log.debug("Handshake with {} complete", sw);
synchronized(roleChanger) {
// We need to keep track of all of the switches that are connected
@@ -832,10 +836,12 @@
//Request control of the switch from the global registry
try {
+ controlRequested = Boolean.TRUE;
registryService.requestControl(sw.getId(),
new RoleChangeCallback());
} catch (RegistryException e) {
log.debug("Registry error: {}", e.getMessage());
+ controlRequested = Boolean.FALSE;
}
@@ -869,6 +875,18 @@
state.firstRoleReplyReceived = true;
}
}
+ if (!controlRequested) {
+ // yield to allow other thread(s) to release control
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ // Ignore interruptions
+ }
+ // safer to bounce the switch to reconnect here than proceeding further
+ log.debug("Closing {} because we weren't able to request control " +
+ "successfully" + sw);
+ sw.channel.close();
+ }
}
}
@@ -1095,6 +1113,7 @@
shouldHandleMessage = handleVendorMessage((OFVendor)m);
break;
case ERROR:
+ log.debug("Recieved ERROR message from switch {}: {}", sw, m);
// TODO: we need better error handling. Especially for
// request/reply style message (stats, roles) we should have
// a unified way to lookup the xid in the error message.
@@ -1118,6 +1137,7 @@
// is not a spurious error
shouldLogError = !isBadVendorError;
if (isBadVendorError) {
+ log.debug("Handling bad vendor error for {}", sw);
if (state.firstRoleReplyReceived && (role != null)) {
log.warn("Received ERROR from sw {} that "
+"indicates roles are not supported "
@@ -1125,16 +1145,23 @@
+"role reply earlier", sw);
}
state.firstRoleReplyReceived = true;
- sw.deliverRoleRequestNotSupported(error.getXid());
+ Role requestedRole =
+ sw.deliverRoleRequestNotSupportedEx(error.getXid());
synchronized(roleChanger) {
if (sw.role == null && Controller.this.role==Role.SLAVE) {
+ //This will now never happen. The Controller's role
+ //is now never SLAVE, always MASTER.
// the switch doesn't understand role request
// messages and the current controller role is
// slave. We need to disconnect the switch.
// @see RoleChanger for rationale
+ log.warn("Closing {} channel because controller's role " +
+ "is SLAVE", sw);
sw.getChannel().close();
}
- else if (sw.role == null) {
+ else if (sw.role == null && requestedRole == Role.MASTER) {
+ log.debug("Adding switch {} because we got an error" +
+ " returned from a MASTER role request", sw);
// Controller's role is master: add to
// active
// TODO: check if clearing flow table is
@@ -1167,6 +1194,8 @@
// to make sure that the switch eventually accepts one
// of our requests or disconnect the switch. This feels
// cumbersome.
+ log.debug("Closing {} channel because we recieved an " +
+ "error other than BAD_VENDOR", sw);
sw.getChannel().close();
}
}
@@ -1258,23 +1287,49 @@
((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
sw.setPort(port);
if (!portDown) {
- swStore.addPort(sw.getStringId(), port);
+ SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTADDED);
+ try {
+ this.updates.put(update);
+ } catch (InterruptedException e) {
+ log.error("Failure adding update to queue", e);
+ }
} else {
- swStore.deletePort(sw.getStringId(), port.getPortNumber());
+ SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTREMOVED);
+ try {
+ this.updates.put(update);
+ } catch (InterruptedException e) {
+ log.error("Failure adding update to queue", e);
+ }
}
if (updateStorage)
updatePortInfo(sw, port);
log.debug("Port #{} modified for {}", portNumber, sw);
} else if (m.getReason() == (byte)OFPortReason.OFPPR_ADD.ordinal()) {
+ // XXX Workaround to prevent race condition where a link is detected
+ // and attempted to be written to the database before the port is in
+ // the database. We now suppress link discovery on ports until we're
+ // sure they're in the database.
+ linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
+
sw.setPort(port);
- swStore.addPort(sw.getStringId(), port);
+ SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTADDED);
+ try {
+ this.updates.put(update);
+ } catch (InterruptedException e) {
+ log.error("Failure adding update to queue", e);
+ }
if (updateStorage)
updatePortInfo(sw, port);
log.debug("Port #{} added for {}", portNumber, sw);
} else if (m.getReason() ==
(byte)OFPortReason.OFPPR_DELETE.ordinal()) {
sw.deletePort(portNumber);
- swStore.deletePort(sw.getStringId(), portNumber);
+ SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTREMOVED);
+ try {
+ this.updates.put(update);
+ } catch (InterruptedException e) {
+ log.error("Failure adding update to queue", e);
+ }
if (updateStorage)
removePortInfo(sw, portNumber);
log.debug("Port #{} deleted for {}", portNumber, sw);
@@ -1499,6 +1554,14 @@
"network problem that can be ignored."
)
protected void addSwitch(IOFSwitch sw) {
+ // XXX Workaround to prevent race condition where a link is detected
+ // and attempted to be written to the database before the port is in
+ // the database. We now suppress link discovery on ports until we're
+ // sure they're in the database.
+ for (OFPhysicalPort port : sw.getPorts()) {
+ linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
+ }
+
// TODO: is it safe to modify the HashMap without holding
// the old switch's lock?
OFSwitchImpl oldSw = (OFSwitchImpl) this.activeSwitches.put(sw.getId(), sw);
@@ -1538,6 +1601,8 @@
// a "Not removing Switch ... already removed debug message.
// TODO: Figure out a way to handle this that avoids the
// spurious debug message.
+ log.debug("Closing {} because a new IOFSwitch got added " +
+ "for this dpid", oldSw);
oldSw.getChannel().close();
}
finally {
@@ -1546,12 +1611,6 @@
}
updateActiveSwitchInfo(sw);
- if (registryService.hasControl(sw.getId())) {
- swStore.update(sw.getStringId(), SwitchState.ACTIVE, DM_OPERATION.UPDATE);
- for (OFPhysicalPort port: sw.getPorts()) {
- swStore.addPort(sw.getStringId(), port);
- }
- }
SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.ADDED);
try {
this.updates.put(update);
@@ -1571,9 +1630,6 @@
// this method is only called after netty has processed all
// pending messages
log.debug("removeSwitch: {}", sw);
- if (registryService.hasControl(sw.getId())) {
- swStore.update(sw.getStringId(), SwitchState.INACTIVE, DM_OPERATION.UPDATE);
- }
if (!this.activeSwitches.remove(sw.getId(), sw) || !sw.isConnected()) {
log.debug("Not removing switch {}; already removed", sw);
return;
@@ -1583,7 +1639,6 @@
// from slave controllers. Then we need to move this cancelation
// to switch disconnect
sw.cancelAllStatisticsReplies();
-
// FIXME: I think there's a race condition if we call updateInactiveSwitchInfo
// here if role support is enabled. In that case if the switch is being
@@ -1595,7 +1650,6 @@
// of the switch state that's written to storage.
updateInactiveSwitchInfo(sw);
-
SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.REMOVED);
try {
this.updates.put(update);
@@ -2319,7 +2373,7 @@
// new controller node IP
addedControllerNodeIPs.put(controllerID, discoveredIP);
}
- else if (curIP != discoveredIP) {
+ else if (!curIP.equals(discoveredIP)) {
// IP changed
removedControllerNodeIPs.put(controllerID, curIP);
addedControllerNodeIPs.put(controllerID, discoveredIP);
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
index 5ffd9bc..5810967 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
@@ -44,6 +44,7 @@
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.util.TimedCache;
+import net.onrc.onos.ofcontroller.core.IOnosRemoteSwitch;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
@@ -75,10 +76,10 @@
/**
* This is the internal representation of an openflow switch.
*/
-public class OFSwitchImpl implements IOFSwitch {
+public class OFSwitchImpl implements IOFSwitch, IOnosRemoteSwitch {
// TODO: should we really do logging in the class or should we throw
// exception that can then be handled by callers?
- protected static Logger log = LoggerFactory.getLogger(OFSwitchImpl.class);
+ protected final static Logger log = LoggerFactory.getLogger(OFSwitchImpl.class);
private static final String HA_CHECK_SWITCH =
"Check the health of the indicated switch. If the problem " +
@@ -268,7 +269,7 @@
public void disconnectOutputStream() {
channel.close();
}
-
+
@Override
@JsonIgnore
public void setFeaturesReply(OFFeaturesReply featuresReply) {
@@ -401,7 +402,7 @@
*/
@Override
public String toString() {
- return "OFSwitchImpl [" + channel.getRemoteAddress() + " DPID[" + ((stringId != null) ? stringId : "?") + "]]";
+ return "OFSwitchImpl [" + ((channel != null) ? channel.getRemoteAddress() : "?") + " DPID[" + ((stringId != null) ? stringId : "?") + "]]";
}
@Override
@@ -788,14 +789,29 @@
* @param xid
*/
protected void deliverRoleRequestNotSupported(int xid) {
+ deliverRoleRequestNotSupportedEx(xid);
+ }
+
+ /**
+ * ONOS Extension to deliverRoleRequestNotSupported().
+ * This version return the Roll request made.
+ * @see deliverRoleRequestNotSupported
+ * @param xid
+ * @return Role of attempted RoleRequest.
+ */
+ protected Role deliverRoleRequestNotSupportedEx(int xid) {
synchronized(pendingRoleRequests) {
PendingRoleRequestEntry head = pendingRoleRequests.poll();
this.role = null;
if (head!=null && head.xid == xid) {
setAttribute(SWITCH_SUPPORTS_NX_ROLE, false);
+ return head.role;
}
else {
+ log.debug("Closing {} because a role request error didn't match " +
+ "head of pendingRoleRequests queue", this);
this.channel.close();
+ return null;
}
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
index 5fb5c34..4485709 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
@@ -60,7 +60,7 @@
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
pipeline.addLast("handshaketimeout",
- new HandshakeTimeoutHandler(state, timer, 15));
+ new HandshakeTimeoutHandler(state, timer, 60)); // ONOS: was 15 increased it to fix Issue #296
if (pipelineExecutor != null)
pipeline.addLast("pipelineExecutor",
new ExecutionHandler(pipelineExecutor));
diff --git a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
index 6378136..194935c 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
@@ -120,7 +120,7 @@
protected Thread workerThread;
protected long timeout;
protected static long DEFAULT_TIMEOUT = 15L*1000*1000*1000L; // 15s
- protected static Logger log = LoggerFactory.getLogger(RoleChanger.class);
+ protected final static Logger log = LoggerFactory.getLogger(RoleChanger.class);
/**
* A queued task to be handled by the Role changer thread.
*/
@@ -275,10 +275,24 @@
sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE);
if ((supportsNxRole == null) || supportsNxRole) {
// Handle cases #1 and #2
+ log.debug("Sending NxRoleRequest to {}", sw);
sw.sendNxRoleRequest(role, cookie);
} else {
- // Handle case #3
- if (role == Role.SLAVE) {
+ if (role == Role.MASTER) {
+ // ONOS extension:
+ log.debug("Switch {} doesn't support NxRoleRequests, but sending " +
+ "{} request anyway", sw, role);
+ //Send the role request anyway, even though we know the switch
+ //doesn't support it. The switch will give an error and in our
+ //error handling code we will add the switch.
+ //NOTE we *could* just add the switch right away rather than
+ //going through the overhead of sending a role request - however
+ //we then have to deal with concurrency issues resulting from
+ //calling addSwitch outside of a netty handler.
+ sw.sendNxRoleRequest(role, cookie);
+ }
+ // Handle case #3
+ else if (role == Role.SLAVE) {
log.debug("Disconnecting switch {} that doesn't support " +
"role request messages from a controller that went to SLAVE mode");
// Closing the channel should result in a call to
diff --git a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
deleted file mode 100644
index 6be26cb..0000000
--- a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package net.floodlightcontroller.core.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.openflow.protocol.OFPhysicalPort;
-import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
-import org.openflow.protocol.OFPhysicalPort.OFPortState;
-
-import com.thinkaurelius.titan.core.TitanException;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Direction;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.frames.FramedGraph;
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.core.ISwitchStorage;
-
-public class SwitchStorageImpl implements ISwitchStorage {
- public TitanGraph graph;
- protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
-
- @Override
- public void update(String dpid, SwitchState state, DM_OPERATION op) {
- // TODO Auto-generated method stub
- log.info("SwitchStorage:update dpid:{} state: {} ", dpid, state);
- switch(op) {
-
- case UPDATE:
- case INSERT:
- case CREATE:
- addSwitch(dpid);
- if (state != SwitchState.ACTIVE) {
- setStatus(dpid, state);
- }
- break;
- case DELETE:
- deleteSwitch(dpid);
- break;
- default:
- }
- }
-
- private void setStatus(String dpid, SwitchState state) {
- Vertex sw;
- try {
- if ((sw = graph.getVertices("dpid",dpid).iterator().next()) != null) {
- sw.setProperty("state",state.toString());
- graph.stopTransaction(Conclusion.SUCCESS);
- log.info("SwitchStorage:setStatus dpid:{} state: {} done", dpid, state);
- }
- } catch (TitanException e) {
- // TODO: handle exceptions
- graph.stopTransaction(Conclusion.FAILURE);
- log.info("SwitchStorage:setStatus dpid:{} state: {} failed", dpid, state);
- }
-
-
- }
-
- @Override
- public void addPort(String dpid, OFPhysicalPort port) {
- // TODO Auto-generated method stub
- Vertex sw;
-
- boolean portDown = ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
- ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
- if (portDown) {
- deletePort(dpid, port.getPortNumber());
- return;
- }
- try {
- if ((sw = graph.getVertices("dpid",dpid).iterator().next()) != null) {
- log.info("SwitchStorage:addPort dpid:{} port:{}", dpid, port.getPortNumber());
- // TODO: Check if port exists
- if (sw.query().direction(Direction.OUT).labels("on").has("number",port.getPortNumber()).vertices().iterator().hasNext()) {
- //TODO: Do nothing for now
- log.error("SwitchStorage:addPort dpid:{} port:{} exists", dpid, port.getPortNumber());
- } else {
- Vertex p = graph.addVertex(null);
- p.setProperty("type","port");
- p.setProperty("number",port.getPortNumber());
- p.setProperty("state", "ACTIVE");
- p.setProperty("port_state",port.getState());
- p.setProperty("desc",port.getName());
- Edge e = graph.addEdge(null, sw, p, "on");
- e.setProperty("state","ACTIVE");
- e.setProperty("number", port.getPortNumber());
-
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- }
- } catch (TitanException e) {
- // TODO: handle exceptions
- graph.stopTransaction(Conclusion.FAILURE);
- log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, port.getPortNumber());
- }
-
- }
-
- @Override
- public Collection<OFPhysicalPort> getPorts(long dpid) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public OFPhysicalPort getPort(String dpid, short portnum) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public OFPhysicalPort getPort(String dpid, String portName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void addSwitch(String dpid) {
-
- log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
-
- try {
- if (graph.getVertices("dpid",dpid).iterator().hasNext()) {
- /*
- * Do nothing or throw exception?
- */
- Vertex sw = graph.getVertices("dpid",dpid).iterator().next();
-
- log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
- sw.setProperty("state",SwitchState.ACTIVE.toString());
- graph.stopTransaction(Conclusion.SUCCESS);
- } else {
- Vertex sw = graph.addVertex(null);
-
- sw.setProperty("type","switch");
- sw.setProperty("dpid", dpid);
- sw.setProperty("state",SwitchState.ACTIVE.toString());
- graph.stopTransaction(Conclusion.SUCCESS);
- log.info("SwitchStorage:addSwitch dpid:{} added", dpid);
- }
- } catch (TitanException e) {
- /*
- * retry till we succeed?
- */
- graph.stopTransaction(Conclusion.FAILURE);
- log.info("SwitchStorage:addSwitch dpid:{} failed", dpid);
- }
-
-
- }
-
- @Override
- public void deleteSwitch(String dpid) {
- // TODO Setting inactive but we need to eventually remove data
- Vertex sw;
- try {
-
- if ((sw = graph.getVertices("dpid",dpid).iterator().next()) != null) {
- graph.removeVertex(sw);
- graph.stopTransaction(Conclusion.SUCCESS);
- log.info("SwitchStorage:DeleteSwitch dpid:{} done", dpid);
- }
- } catch (TitanException e) {
- // TODO: handle exceptions
- graph.stopTransaction(Conclusion.FAILURE);
- log.error("SwitchStorage:deleteSwitch {} failed", dpid);
- }
-
- }
-
- @Override
- public void deletePort(String dpid, short port) {
- // TODO Auto-generated method stub
- Vertex sw;
- try {
- if ((sw = graph.getVertices("dpid",dpid).iterator().next()) != null) {
- // TODO: Check if port exists
- log.info("SwitchStorage:deletePort dpid:{} port:{}", dpid, port);
- if (sw.query().direction(Direction.OUT).labels("on").has("number",port).vertices().iterator().hasNext()) {
- Vertex p = sw.query().direction(Direction.OUT).labels("on").has("number",port).vertices().iterator().next();
- log.info("SwitchStorage:deletePort dpid:{} port:{} found and deleted", dpid, port);
- graph.removeVertex(p);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- }
- } catch (TitanException e) {
- // TODO: handle exceptions
- graph.stopTransaction(Conclusion.FAILURE);
- log.info("SwitchStorage:deletePort dpid:{} port:{} failed", dpid, port);
- }
- }
-
- @Override
- public void deletePort(String dpid, String portName) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Iterable<ISwitchObject> getActiveSwitches() {
- // TODO Add unit test
- FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
- Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
- List<ISwitchObject> activeSwitches = new ArrayList<ISwitchObject>();
-
- for (ISwitchObject sw: switches) {
- if(sw.getState().equals(SwitchState.ACTIVE.toString())) {
- activeSwitches.add(sw);
- }
- }
-
- return activeSwitches;
- }
-
- @Override
- public void init(String conf) {
-
- graph = TitanFactory.open(conf);
-
- // FIXME: Creation on Indexes should be done only once
- Set<String> s = graph.getIndexedKeys(Vertex.class);
- if (!s.contains("dpid")) {
- graph.createKeyIndex("dpid", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- if (!s.contains("type")) {
- graph.createKeyIndex("type", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- }
-
- @Override
- public Iterable<ISwitchObject> getAllSwitches() {
- // TODO Auto-generated method stub
- FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
- Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
-
- for (ISwitchObject sw: switches) {
- log.debug("switch: {}", sw.getDPID());
- }
-
- return switches;
- }
-
- @Override
- public Iterable<ISwitchObject> getInactiveSwitches() {
- // TODO Auto-generated method stub
- FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
- Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
-
- List<ISwitchObject> inactiveSwitches = new ArrayList<ISwitchObject>();
-
- for (ISwitchObject sw: switches) {
- if(sw.getState().equals(SwitchState.INACTIVE.toString())) {
- inactiveSwitches.add(sw);
- }
- }
- return inactiveSwitches;
- }
-
- public void finalize() {
- close();
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
- graph.shutdown();
-
- }
-
-
-}
diff --git a/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java b/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java
deleted file mode 100644
index e8b1bf8..0000000
--- a/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package net.floodlightcontroller.core.internal;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoSwitchService;
-
-public class TopoSwitchServiceImpl implements ITopoSwitchService {
-
- ThreadLocal<SwitchStorageImpl> store = new ThreadLocal<SwitchStorageImpl>() {
- @Override
- protected SwitchStorageImpl initialValue() {
- SwitchStorageImpl swStore = new SwitchStorageImpl();
- //TODO: Get the file path from global properties
- swStore.init("/tmp/cassandra.titan");
- return swStore;
- }
- };
-
- SwitchStorageImpl swStore = store.get();
-
- @Override
- public Iterable<ISwitchObject> getActiveSwitches() {
- // TODO Auto-generated method stub
- return swStore.getActiveSwitches();
- }
-
- @Override
- public Iterable<ISwitchObject> getAllSwitches() {
- // TODO Auto-generated method stub
- return swStore.getAllSwitches();
- }
-
- @Override
- public Iterable<ISwitchObject> getInactiveSwitches() {
- // TODO Auto-generated method stub
- return swStore.getInactiveSwitches();
- }
-
- @Override
- public Iterable<IPortObject> getPortsOnSwitch(String dpid) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IPortObject getPortOnSwitch(String dpid, short port_num) {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
index 5561327..2686d00 100644
--- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
+++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
@@ -32,7 +32,7 @@
*
*/
public class FloodlightModuleLoader {
- protected static Logger logger =
+ protected final static Logger logger =
LoggerFactory.getLogger(FloodlightModuleLoader.class);
protected static Map<Class<? extends IFloodlightService>,
diff --git a/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java b/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
index a73a17f..7f7b903 100644
--- a/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
+++ b/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
@@ -17,7 +17,7 @@
* @author Rob Sherwood
*/
public class ModuleLoaderResource extends ServerResource {
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(ModuleLoaderResource.class);
/**
diff --git a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
index 58b543c..ea63c25 100644
--- a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
+++ b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
@@ -34,7 +34,7 @@
*
*/
public class ListenerDispatcher<U, T extends IListener<U>> {
- protected static Logger logger = LoggerFactory.getLogger(ListenerDispatcher.class);
+ protected final static Logger logger = LoggerFactory.getLogger(ListenerDispatcher.class);
List<T> listeners = null;
private void visit(List<T> newlisteners, U type, HashSet<T> visited,
diff --git a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
index 07729e5..0e03144 100644
--- a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
+++ b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
@@ -37,7 +37,7 @@
* * If the task has begun, set a bit to restart it after the current task finishes
*/
public class SingletonTask {
- protected static Logger logger = LoggerFactory.getLogger(SingletonTask.class);
+ protected final static Logger logger = LoggerFactory.getLogger(SingletonTask.class);
protected static class SingletonTaskContext {
protected boolean taskShouldRun = false;
diff --git a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
index d012fc8..a014795 100644
--- a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
@@ -39,7 +39,7 @@
* @author readams
*/
public class AllSwitchStatisticsResource extends SwitchResourceBase {
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
@Get("json")
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerRoleResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerRoleResource.java
index 652058e..2ed87cb 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerRoleResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerRoleResource.java
@@ -14,7 +14,7 @@
public class ControllerRoleResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(ControllerRoleResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(ControllerRoleResource.class);
@Get("json")
public RoleInfo getRole() {
diff --git a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
index c110651..7604d7c 100644
--- a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
@@ -18,9 +18,11 @@
package net.floodlightcontroller.core.web;
import net.floodlightcontroller.core.module.ModuleLoaderResource;
-import net.floodlightcontroller.linkdiscovery.web.TopoLinksResource;
-import net.floodlightcontroller.devicemanager.web.TopoDevicesResource;
import net.floodlightcontroller.restserver.RestletRoutable;
+import net.onrc.onos.ofcontroller.core.web.ClearFlowTableResource;
+import net.onrc.onos.ofcontroller.core.web.TopoLinksResource;
+import net.onrc.onos.ofcontroller.core.web.TopoSwitchesResource;
+import net.onrc.onos.ofcontroller.devicemanager.web.TopoDevicesResource;
import org.restlet.Context;
import org.restlet.Restlet;
@@ -49,7 +51,6 @@
router.attach("/counter/{switchId}/{counterName}/json", SwitchCounterResource.class);
router.attach("/counter/categories/{switchId}/{counterName}/{layer}/json", SwitchCounterCategoriesResource.class);
router.attach("/memory/json", ControllerMemoryResource.class);
- router.attach("/packettrace/json", PacketTraceResource.class);
// Get the last {count} events from the event histories
router.attach("/event-history/topology-switch/{count}/json",
EventHistoryTopologySwitchResource.class);
@@ -62,9 +63,11 @@
router.attach("/role/json", ControllerRoleResource.class);
router.attach("/health/json", HealthCheckResource.class);
router.attach("/system/uptime/json", SystemUptimeResource.class);
+ // Following added by ONOS
router.attach("/topology/switches/{filter}/json", TopoSwitchesResource.class);
router.attach("/topology/links/json", TopoLinksResource.class);
router.attach("/topology/devices/json", TopoDevicesResource.class);
+ router.attach("/clearflowtable/json", ClearFlowTableResource.class);
return router;
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
index 1be942c..d1888d3 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologyCluster;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologyCluster;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
@@ -16,7 +16,7 @@
*/
public class EventHistoryTopologyClusterResource extends ServerResource {
// TODO - Move this to the LinkDiscovery rest API
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(EventHistoryTopologyClusterResource.class);
@Get("json")
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
index 4a21070..e497228 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologyLink;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologyLink;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
@@ -16,7 +16,7 @@
*/
public class EventHistoryTopologyLinkResource extends ServerResource {
// TODO - Move this to the DeviceManager Rest API
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(EventHistoryTopologyLinkResource.class);
@Get("json")
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
index 1c95e2c..4a81db4 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologySwitch;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologySwitch;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/floodlightcontroller/core/web/PacketTraceResource.java b/src/main/java/net/floodlightcontroller/core/web/PacketTraceResource.java
deleted file mode 100644
index 85da942..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/PacketTraceResource.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.floodlightcontroller.core.web;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.restlet.data.Status;
-import org.restlet.resource.Post;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.core.OFMessageFilterManager;
-
-public class PacketTraceResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(PacketTraceResource.class);
-
- public static class FilterParameters {
-
- protected String sessionId = null;
- protected String mac = null;
- protected Integer period = null;
- protected String direction = null;
- protected String output = null;
-
- public String getSessionId() {
- return sessionId;
- }
- public void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
- public String getMac() {
- return mac;
- }
- public void setMac(String mac) {
- this.mac = mac;
- }
- public Integer getPeriod() {
- return period;
- }
- public void setPeriod(Integer period) {
- this.period = period;
- }
- public String getDirection() {
- return direction;
- }
- public void setDirection(String direction) {
- this.direction = direction;
- }
- public String getOutput() {
- return output;
- }
- public void setOutput(String output) {
- this.output = output;
- }
-
- public String toString() {
- return "SessionID: " + sessionId +
- "\tmac" + mac +
- "\tperiod" + period +
- "\tdirection" + direction +
- "\toutput" + output;
- }
- }
-
- public static class PacketTraceOutput {
- protected String sessionId = null;
-
- public String getSessionId() {
- return sessionId;
- }
-
- public void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
- }
-
- @Post("json")
- public PacketTraceOutput packettrace(FilterParameters fp) {
-
- ConcurrentHashMap <String,String> filter = new ConcurrentHashMap<String,String> ();
- String sid = null;
- PacketTraceOutput output = new PacketTraceOutput();
- OFMessageFilterManager manager =
- (OFMessageFilterManager)getContext()
- .getAttributes().
- get(OFMessageFilterManager.class.getCanonicalName());
-
- if (manager == null) {
- sid = null;
- setStatus(Status.SERVER_ERROR_SERVICE_UNAVAILABLE);
- }
-
- if (fp.getSessionId() != null) {
- filter.put("sessionId", fp.getSessionId());
- }
- if (fp.getMac() != null) {
- filter.put("mac", fp.getMac());
- }
- if (fp.getDirection() != null) {
- filter.put("direction", fp.getDirection());
- }
-
- if (filter.isEmpty()) {
- setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
- } else {
- if (log.isDebugEnabled()) {
- log.debug ("Call setupFilter: sid:{} filter:{}, period:{}",
- new Object[] {fp.getSessionId(), filter,
- fp.getPeriod()*1000});
- }
- sid = manager.setupFilter(fp.getSessionId(), filter,
- fp.getPeriod()*1000);
- output.setSessionId(sid);
- setStatus(Status.SUCCESS_OK);
- }
-
- return output;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
index d810024..1c138f6 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
@@ -48,7 +48,7 @@
*
*/
public class SwitchResourceBase extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
+ protected final static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
public enum REQUESTTYPE {
OFSTATS,
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
index 0d73f93..944c725 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
@@ -14,7 +14,7 @@
public class SwitchRoleResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(SwitchRoleResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(SwitchRoleResource.class);
@Get("json")
public Object getRole() {
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
index 57771f7..a0cada7 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
@@ -30,7 +30,7 @@
* @author readams
*/
public class SwitchStatisticsResource extends SwitchResourceBase {
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(SwitchStatisticsResource.class);
@Get("json")
diff --git a/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java b/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java
deleted file mode 100644
index 7a8511b..0000000
--- a/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package net.floodlightcontroller.core.web;
-
-import java.util.Iterator;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.core.internal.TopoSwitchServiceImpl;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-
-public class TopoSwitchesResource extends ServerResource {
-
- @Get("json")
- public Iterator<ISwitchObject> retrieve() {
- TopoSwitchServiceImpl impl = new TopoSwitchServiceImpl();
-
- String filter = (String) getRequestAttributes().get("filter");
-
- if (filter.equals("active")) {
- return (Iterator<ISwitchObject>) impl.getActiveSwitches().iterator();
- }
- if (filter.equals("inactive")) {
- return (Iterator<ISwitchObject>) impl.getInactiveSwitches().iterator();
- } else {
- return (Iterator<ISwitchObject>) impl.getAllSwitches().iterator();
- }
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/counter/CounterStore.java b/src/main/java/net/floodlightcontroller/counter/CounterStore.java
index 26d1302..15ce53b 100644
--- a/src/main/java/net/floodlightcontroller/counter/CounterStore.java
+++ b/src/main/java/net/floodlightcontroller/counter/CounterStore.java
@@ -52,7 +52,7 @@
*
*/
public class CounterStore implements IFloodlightModule, ICounterStoreService {
- protected static Logger log = LoggerFactory.getLogger(CounterStore.class);
+ protected final static Logger log = LoggerFactory.getLogger(CounterStore.class);
public enum NetworkLayer {
L2, L3, L4
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
index 645125e..05ebcf3 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
@@ -50,7 +50,7 @@
*/
@JsonSerialize(using=DeviceSerializer.class)
public class Device implements IDevice {
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(Device.class);
protected Long deviceKey;
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
index feccdc4..087756c 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
@@ -39,27 +39,27 @@
import net.floodlightcontroller.core.FloodlightContext;
import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IFloodlightProviderService.Role;
import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IInfoProvider;
import net.floodlightcontroller.core.IOFMessageListener;
import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.IFloodlightProviderService.Role;
+import net.floodlightcontroller.core.IUpdate;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.IDeviceListener;
import net.floodlightcontroller.devicemanager.IDeviceService;
import net.floodlightcontroller.devicemanager.IEntityClass;
import net.floodlightcontroller.devicemanager.IEntityClassListener;
import net.floodlightcontroller.devicemanager.IEntityClassifierService;
-import net.floodlightcontroller.devicemanager.IDeviceListener;
import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.devicemanager.web.DeviceRoutable;
import net.floodlightcontroller.flowcache.IFlowReconcileListener;
import net.floodlightcontroller.flowcache.IFlowReconcileService;
import net.floodlightcontroller.flowcache.OFMatchReconcile;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import net.floodlightcontroller.packet.ARP;
import net.floodlightcontroller.packet.DHCP;
import net.floodlightcontroller.packet.Ethernet;
@@ -71,8 +71,7 @@
import net.floodlightcontroller.topology.ITopologyListener;
import net.floodlightcontroller.topology.ITopologyService;
import net.floodlightcontroller.util.MultiIterator;
-import static net.floodlightcontroller.devicemanager.internal.
-DeviceManagerImpl.DeviceUpdate.Change.*;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import org.openflow.protocol.OFMatchWithSwDpid;
import org.openflow.protocol.OFMessage;
@@ -91,7 +90,7 @@
IDeviceService, IOFMessageListener, ITopologyListener,
IFloodlightModule, IEntityClassListener,
IFlowReconcileListener, IInfoProvider, IHAListener {
- protected static Logger logger =
+ protected final static Logger logger =
LoggerFactory.getLogger(DeviceManagerImpl.class);
protected IFloodlightProviderService floodlightProvider;
@@ -197,14 +196,14 @@
*/
protected Set<IDeviceListener> deviceListeners;
+ public enum DeviceUpdateType {
+ ADD, DELETE, CHANGE, MOVED;
+ }
+
/**
* A device update event to be dispatched
*/
- protected static class DeviceUpdate {
- public enum Change {
- ADD, DELETE, CHANGE;
- }
-
+ protected class DeviceUpdate implements IUpdate {
/**
* The affected device
*/
@@ -213,18 +212,18 @@
/**
* The change that was made
*/
- protected Change change;
+ protected DeviceUpdateType updateType;
/**
* If not added, then this is the list of fields changed
*/
protected EnumSet<DeviceField> fieldsChanged;
- public DeviceUpdate(IDevice device, Change change,
+ public DeviceUpdate(IDevice device, DeviceUpdateType updateType,
EnumSet<DeviceField> fieldsChanged) {
super();
this.device = device;
- this.change = change;
+ this.updateType = updateType;
this.fieldsChanged = fieldsChanged;
}
@@ -232,9 +231,49 @@
public String toString() {
String devIdStr = device.getEntityClass().getName() + "::" +
device.getMACAddressString();
- return "DeviceUpdate [device=" + devIdStr + ", change=" + change
+ return "DeviceUpdate [device=" + devIdStr + ", updateType=" + updateType
+ ", fieldsChanged=" + fieldsChanged + "]";
}
+
+ @Override
+ public void dispatch() {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Dispatching device update: {}", this);
+ }
+ for (IDeviceListener listener : deviceListeners) {
+ switch (updateType) {
+ case ADD:
+ listener.deviceAdded(device);
+ break;
+ case DELETE:
+ listener.deviceRemoved(device);
+ break;
+ case CHANGE:
+ for (DeviceField field : fieldsChanged) {
+ switch (field) {
+ case IPV4:
+ listener.deviceIPV4AddrChanged(device);
+ break;
+ case SWITCH:
+ case PORT:
+ //listener.deviceMoved(update.device);
+ break;
+ case VLAN:
+ listener.deviceVlanChanged(device);
+ break;
+ default:
+ logger.debug("Unknown device field changed {}",
+ fieldsChanged.toString());
+ break;
+ }
+ }
+ break;
+ case MOVED:
+ listener.deviceMoved(device);
+ break;
+ }
+ }
+ }
}
@@ -1104,7 +1143,7 @@
// generate new device update
deviceUpdates =
updateUpdates(deviceUpdates,
- new DeviceUpdate(device, ADD, null));
+ new DeviceUpdate(device, DeviceUpdateType.ADD, null));
break;
}
@@ -1162,7 +1201,7 @@
if (changedFields.size() > 0)
deviceUpdates =
updateUpdates(deviceUpdates,
- new DeviceUpdate(newDevice, CHANGE,
+ new DeviceUpdate(newDevice, DeviceUpdateType.CHANGE,
changedFields));
// update the device map with a replace call
@@ -1211,7 +1250,7 @@
// generate new device update
deviceUpdates =
updateUpdates(deviceUpdates,
- new DeviceUpdate(dev, DELETE, null));
+ new DeviceUpdate(dev, DeviceUpdateType.DELETE, null));
}
}
@@ -1267,6 +1306,15 @@
* @param updates the updates to process.
*/
protected void processUpdates(Queue<DeviceUpdate> updates) {
+ if (updates == null) {
+ return;
+ }
+
+ DeviceUpdate update;
+ while (null != (update = updates.poll())) {
+ floodlightProvider.publishUpdate(update);
+ }
+ /*
if (updates == null) return;
DeviceUpdate update = null;
while (null != (update = updates.poll())) {
@@ -1304,6 +1352,7 @@
}
}
}
+ */
}
/**
@@ -1481,7 +1530,7 @@
changedFields.addAll(findChangedFields(newDevice, e));
}
if (changedFields.size() > 0)
- deviceUpdates.add(new DeviceUpdate(d, CHANGE,
+ deviceUpdates.add(new DeviceUpdate(d, DeviceUpdateType.CHANGE,
changedFields));
if (!deviceMap.replace(newDevice.getDeviceKey(),
@@ -1495,7 +1544,7 @@
continue;
}
} else {
- deviceUpdates.add(new DeviceUpdate(d, DELETE, null));
+ deviceUpdates.add(new DeviceUpdate(d, DeviceUpdateType.DELETE, null));
if (!deviceMap.remove(d.getDeviceKey(), d))
// concurrent modification; try again
// need to use device that is the map now for the next
@@ -1665,9 +1714,11 @@
* @param updates the updates to process.
*/
protected void sendDeviceMovedNotification(Device d) {
- for (IDeviceListener listener : deviceListeners) {
+ /*for (IDeviceListener listener : deviceListeners) {
listener.deviceMoved(d);
- }
+ }*/
+ floodlightProvider.publishUpdate(
+ new DeviceUpdate(d, DeviceUpdateType.MOVED, null));
}
/**
@@ -1705,8 +1756,7 @@
new LinkedList<DeviceUpdate>();
// delete this device and then re-learn all the entities
this.deleteDevice(device);
- deviceUpdates.add(new DeviceUpdate(device,
- DeviceUpdate.Change.DELETE, null));
+ deviceUpdates.add(new DeviceUpdate(device, DeviceUpdateType.DELETE, null));
if (!deviceUpdates.isEmpty())
processUpdates(deviceUpdates);
for (Entity entity: device.entities ) {
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImpl.java
deleted file mode 100644
index 64c12dc..0000000
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImpl.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package net.floodlightcontroller.devicemanager.internal;
-
-import java.util.List;
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-import com.thinkaurelius.titan.core.TitanException;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.floodlightcontroller.core.internal.SwitchStorageImpl;
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.floodlightcontroller.devicemanager.IDeviceStorage;
-import net.floodlightcontroller.devicemanager.SwitchPort;
-import net.onrc.onos.util.GraphDBConnection;
-import net.onrc.onos.util.GraphDBConnection.Transaction;
-
-public class DeviceStorageImpl implements IDeviceStorage {
-
- public GraphDBConnection conn;
- protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
-
- @Override
- public void init(String conf) {
- conn = GraphDBConnection.getInstance(conf);
- }
-
- public void finalize() {
- close();
- }
-
- @Override
- public void close() {
- conn.close();
- }
-
- @Override
- public IDeviceObject addDevice(IDevice device) {
- // TODO Auto-generated method stub
- IDeviceObject obj = null;
- try {
- if ((obj = conn.utils().searchDevice(conn, device.getMACAddressString())) != null) {
- log.debug("Adding device {}: found existing device",device.getMACAddressString());
- } else {
- obj = conn.utils().newDevice(conn);
- log.debug("Adding device {}: creating new device",device.getMACAddressString());
- }
- changeDeviceAttachments(device, obj);
-
- obj.setIPAddress(device.getIPv4Addresses().toString());
- obj.setMACAddress(device.getMACAddressString());
- obj.setType("device");
- obj.setState("ACTIVE");
- conn.endTx(Transaction.COMMIT);
-
- log.debug("Adding device {}",device.getMACAddressString());
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":addDevice mac:{} failed", device.getMACAddressString());
- }
-
- return obj;
- }
-
- @Override
- public IDeviceObject updateDevice(IDevice device) {
- return addDevice(device);
- }
-
- @Override
- public void removeDevice(IDevice device) {
- // TODO Auto-generated method stub
- IDeviceObject dev;
- try {
- if ((dev = conn.utils().searchDevice(conn, device.getMACAddressString())) != null) {
- conn.utils().removeDevice(conn, dev);
- conn.endTx(Transaction.COMMIT);
- log.error("DeviceStorage:removeDevice mac:{} done", device.getMACAddressString());
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error("DeviceStorage:removeDevice mac:{} failed", device.getMACAddressString());
- }
- }
-
- @Override
- public IDeviceObject getDeviceByMac(String mac) {
- return conn.utils().searchDevice(conn, mac);
- }
-
- @Override
- public IDeviceObject getDeviceByIP(String ip) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void changeDeviceAttachments(IDevice device) {
- // TODO Auto-generated method stub
- IDeviceObject obj = null;
- try {
- if ((obj = conn.utils().searchDevice(conn, device.getMACAddressString())) != null) {
- log.debug("Changing device ports {}: found existing device",device.getMACAddressString());
- changeDeviceAttachments(device, obj);
- conn.endTx(Transaction.COMMIT);
- } else {
- log.debug("failed to search device...now adding {}",device.getMACAddressString());
- addDevice(device);
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":addDevice mac:{} failed", device.getMACAddressString());
- }
- }
-
- public void changeDeviceAttachments(IDevice device, IDeviceObject obj) {
- SwitchPort[] attachmentPoints = device.getAttachmentPoints();
- List<IPortObject> attachedPorts = Lists.newArrayList(obj.getAttachedPorts());
-
- for (SwitchPort ap : attachmentPoints) {
- IPortObject port = conn.utils().searchPort(conn,
- HexString.toHexString(ap.getSwitchDPID()),
- (short) ap.getPort());
- if (attachedPorts.contains(port)) {
- attachedPorts.remove(port);
- } else {
- log.debug("Adding device {}: attaching to port",device.getMACAddressString());
- port.setDevice(obj);
- //obj.setHostPort(port);
- }
- }
- for (IPortObject port: attachedPorts) {
- port.removeDevice(obj);
- // obj.removeHostPort(port);
- }
- }
-
- @Override
- public void changeDeviceIPv4Address(IDevice device) {
- // TODO Auto-generated method stub
- IDeviceObject obj;
- try {
- if ((obj = conn.utils().searchDevice(conn, device.getMACAddressString())) != null) {
- obj.setIPAddress(device.getIPv4Addresses().toString());
- conn.endTx(Transaction.COMMIT);
- } else {
- log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
- }
- } catch (TitanException e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(),e);
- }
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/IndexedEntity.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/IndexedEntity.java
index 3e0829d..3bb9bfa 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/IndexedEntity.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/IndexedEntity.java
@@ -19,7 +19,7 @@
protected EnumSet<DeviceField> keyFields;
protected Entity entity;
private int hashCode = 0;
- protected static Logger logger =
+ protected final static Logger logger =
LoggerFactory.getLogger(IndexedEntity.class);
/**
* Create a new {@link IndexedEntity} for the given {@link Entity} using
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/web/TopoDevicesResource.java b/src/main/java/net/floodlightcontroller/devicemanager/web/TopoDevicesResource.java
deleted file mode 100644
index db7059f..0000000
--- a/src/main/java/net/floodlightcontroller/devicemanager/web/TopoDevicesResource.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.floodlightcontroller.devicemanager.web;
-
-import java.util.Iterator;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.util.GraphDBConnection;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-
-public class TopoDevicesResource extends ServerResource {
-
- @Get("json")
- public Iterator<IDeviceObject> retrieve() {
-
- GraphDBConnection conn = GraphDBConnection.getInstance("");
-
- return conn.utils().getDevices(conn).iterator();
-
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/Firewall.java b/src/main/java/net/floodlightcontroller/firewall/Firewall.java
deleted file mode 100644
index 3f8ff6c..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/Firewall.java
+++ /dev/null
@@ -1,667 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFType;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.devicemanager.IDeviceService;
-
-import java.util.ArrayList;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.routing.IRoutingDecision;
-import net.floodlightcontroller.routing.RoutingDecision;
-import net.floodlightcontroller.storage.IResultSet;
-import net.floodlightcontroller.storage.IStorageSourceService;
-import net.floodlightcontroller.storage.StorageException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Stateless firewall implemented as a Google Summer of Code project.
- * Configuration done through REST API
- *
- * @author Amer Tahir
- * @edited KC Wang
- */
-public class Firewall implements IFirewallService, IOFMessageListener,
- IFloodlightModule {
-
- // service modules needed
- protected IFloodlightProviderService floodlightProvider;
- protected IStorageSourceService storageSource;
- protected IRestApiService restApi;
- protected static Logger logger;
-
- protected List<FirewallRule> rules; // protected by synchronized
- protected boolean enabled;
- protected int subnet_mask = IPv4.toIPv4Address("255.255.255.0");
-
- // constant strings for storage/parsing
- public static final String TABLE_NAME = "controller_firewallrules";
- public static final String COLUMN_RULEID = "ruleid";
- public static final String COLUMN_DPID = "dpid";
- public static final String COLUMN_IN_PORT = "in_port";
- public static final String COLUMN_DL_SRC = "dl_src";
- public static final String COLUMN_DL_DST = "dl_dst";
- public static final String COLUMN_DL_TYPE = "dl_type";
- public static final String COLUMN_NW_SRC_PREFIX = "nw_src_prefix";
- public static final String COLUMN_NW_SRC_MASKBITS = "nw_src_maskbits";
- public static final String COLUMN_NW_DST_PREFIX = "nw_dst_prefix";
- public static final String COLUMN_NW_DST_MASKBITS = "nw_dst_maskbits";
- public static final String COLUMN_NW_PROTO = "nw_proto";
- public static final String COLUMN_TP_SRC = "tp_src";
- public static final String COLUMN_TP_DST = "tp_dst";
- public static final String COLUMN_WILDCARD_DPID = "wildcard_dpid";
- public static final String COLUMN_WILDCARD_IN_PORT = "wildcard_in_port";
- public static final String COLUMN_WILDCARD_DL_SRC = "wildcard_dl_src";
- public static final String COLUMN_WILDCARD_DL_DST = "wildcard_dl_dst";
- public static final String COLUMN_WILDCARD_DL_TYPE = "wildcard_dl_type";
- public static final String COLUMN_WILDCARD_NW_SRC = "wildcard_nw_src";
- public static final String COLUMN_WILDCARD_NW_DST = "wildcard_nw_dst";
- public static final String COLUMN_WILDCARD_NW_PROTO = "wildcard_nw_proto";
- public static final String COLUMN_WILDCARD_TP_SRC = "wildcard_tp_src";
- public static final String COLUMN_WILDCARD_TP_DST = "wildcard_tp_dst";
- public static final String COLUMN_PRIORITY = "priority";
- public static final String COLUMN_ACTION = "action";
- public static String ColumnNames[] = { COLUMN_RULEID, COLUMN_DPID,
- COLUMN_IN_PORT, COLUMN_DL_SRC, COLUMN_DL_DST, COLUMN_DL_TYPE,
- COLUMN_NW_SRC_PREFIX, COLUMN_NW_SRC_MASKBITS, COLUMN_NW_DST_PREFIX,
- COLUMN_NW_DST_MASKBITS, COLUMN_NW_PROTO, COLUMN_TP_SRC,
- COLUMN_TP_DST, COLUMN_WILDCARD_DPID, COLUMN_WILDCARD_IN_PORT,
- COLUMN_WILDCARD_DL_SRC, COLUMN_WILDCARD_DL_DST,
- COLUMN_WILDCARD_DL_TYPE, COLUMN_WILDCARD_NW_SRC,
- COLUMN_WILDCARD_NW_DST, COLUMN_WILDCARD_NW_PROTO, COLUMN_PRIORITY,
- COLUMN_ACTION };
-
- @Override
- public String getName() {
- return "firewall";
- }
-
- @Override
- public boolean isCallbackOrderingPrereq(OFType type, String name) {
- // no prereq
- return false;
- }
-
- @Override
- public boolean isCallbackOrderingPostreq(OFType type, String name) {
- return (type.equals(OFType.PACKET_IN) && name.equals("forwarding"));
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFirewallService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
- Map<Class<? extends IFloodlightService>, IFloodlightService> m = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
- // We are the class that implements the service
- m.put(IFirewallService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(IStorageSourceService.class);
- l.add(IRestApiService.class);
- return l;
- }
-
- /**
- * Reads the rules from the storage and creates a sorted arraylist of
- * FirewallRule from them.
- *
- * Similar to getStorageRules(), which only reads contents for REST GET and
- * does no parsing, checking, nor putting into FirewallRule objects
- *
- * @return the sorted arraylist of FirewallRule instances (rules from
- * storage)
- */
- protected ArrayList<FirewallRule> readRulesFromStorage() {
- ArrayList<FirewallRule> l = new ArrayList<FirewallRule>();
-
- try {
- Map<String, Object> row;
-
- // (..., null, null) for no predicate, no ordering
- IResultSet resultSet = storageSource.executeQuery(TABLE_NAME,
- ColumnNames, null, null);
-
- // put retrieved rows into FirewallRules
- for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
- row = it.next().getRow();
- // now, parse row
- FirewallRule r = new FirewallRule();
- if (!row.containsKey(COLUMN_RULEID)
- || !row.containsKey(COLUMN_DPID)) {
- logger.error(
- "skipping entry with missing required 'ruleid' or 'switchid' entry: {}",
- row);
- return l;
- }
- try {
- r.ruleid = Integer
- .parseInt((String) row.get(COLUMN_RULEID));
- r.dpid = Long.parseLong((String) row.get(COLUMN_DPID));
-
- for (String key : row.keySet()) {
- if (row.get(key) == null)
- continue;
- if (key.equals(COLUMN_RULEID)
- || key.equals(COLUMN_DPID)
- || key.equals("id")) {
- continue; // already handled
- }
-
- else if (key.equals(COLUMN_IN_PORT)) {
- r.in_port = Short.parseShort((String) row
- .get(COLUMN_IN_PORT));
- }
-
- else if (key.equals(COLUMN_DL_SRC)) {
- r.dl_src = Long.parseLong((String) row
- .get(COLUMN_DL_SRC));
- }
-
- else if (key.equals(COLUMN_DL_DST)) {
- r.dl_dst = Long.parseLong((String) row
- .get(COLUMN_DL_DST));
- }
-
- else if (key.equals(COLUMN_DL_TYPE)) {
- r.dl_type = Short.parseShort((String) row
- .get(COLUMN_DL_TYPE));
- }
-
- else if (key.equals(COLUMN_NW_SRC_PREFIX)) {
- r.nw_src_prefix = Integer.parseInt((String) row
- .get(COLUMN_NW_SRC_PREFIX));
- }
-
- else if (key.equals(COLUMN_NW_SRC_MASKBITS)) {
- r.nw_src_maskbits = Integer.parseInt((String) row
- .get(COLUMN_NW_SRC_MASKBITS));
- }
-
- else if (key.equals(COLUMN_NW_DST_PREFIX)) {
- r.nw_dst_prefix = Integer.parseInt((String) row
- .get(COLUMN_NW_DST_PREFIX));
- }
-
- else if (key.equals(COLUMN_NW_DST_MASKBITS)) {
- r.nw_dst_maskbits = Integer.parseInt((String) row
- .get(COLUMN_NW_DST_MASKBITS));
- }
-
- else if (key.equals(COLUMN_NW_PROTO)) {
- r.nw_proto = Short.parseShort((String) row
- .get(COLUMN_NW_PROTO));
- }
-
- else if (key.equals(COLUMN_TP_SRC)) {
- r.tp_src = Short.parseShort((String) row
- .get(COLUMN_TP_SRC));
- }
-
- else if (key.equals(COLUMN_TP_DST)) {
- r.tp_dst = Short.parseShort((String) row
- .get(COLUMN_TP_DST));
- }
-
- else if (key.equals(COLUMN_WILDCARD_DPID)) {
- r.wildcard_dpid = Boolean.parseBoolean((String) row
- .get(COLUMN_WILDCARD_DPID));
- }
-
- else if (key.equals(COLUMN_WILDCARD_IN_PORT)) {
- r.wildcard_in_port = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_IN_PORT));
- }
-
- else if (key.equals(COLUMN_WILDCARD_DL_SRC)) {
- r.wildcard_dl_src = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_DL_SRC));
- }
-
- else if (key.equals(COLUMN_WILDCARD_DL_DST)) {
- r.wildcard_dl_dst = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_DL_DST));
- }
-
- else if (key.equals(COLUMN_WILDCARD_DL_TYPE)) {
- r.wildcard_dl_type = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_DL_TYPE));
- }
-
- else if (key.equals(COLUMN_WILDCARD_NW_SRC)) {
- r.wildcard_nw_src = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_NW_SRC));
- }
-
- else if (key.equals(COLUMN_WILDCARD_NW_DST)) {
- r.wildcard_nw_dst = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_NW_DST));
- }
-
- else if (key.equals(COLUMN_WILDCARD_NW_PROTO)) {
- r.wildcard_nw_proto = Boolean
- .parseBoolean((String) row
- .get(COLUMN_WILDCARD_NW_PROTO));
- }
-
- else if (key.equals(COLUMN_PRIORITY)) {
- r.priority = Integer.parseInt((String) row
- .get(COLUMN_PRIORITY));
- }
-
- else if (key.equals(COLUMN_ACTION)) {
- int tmp = Integer.parseInt((String) row.get(COLUMN_ACTION));
- if (tmp == FirewallRule.FirewallAction.DENY.ordinal())
- r.action = FirewallRule.FirewallAction.DENY;
- else if (tmp == FirewallRule.FirewallAction.ALLOW.ordinal())
- r.action = FirewallRule.FirewallAction.ALLOW;
- else {
- r.action = null;
- logger.error("action not recognized");
- }
- }
- }
- } catch (ClassCastException e) {
- logger.error(
- "skipping rule {} with bad data : "
- + e.getMessage(), r.ruleid);
- }
- if (r.action != null)
- l.add(r);
- }
- } catch (StorageException e) {
- logger.error("failed to access storage: {}", e.getMessage());
- // if the table doesn't exist, then wait to populate later via
- // setStorageSource()
- }
-
- // now, sort the list based on priorities
- Collections.sort(l);
-
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- floodlightProvider = context
- .getServiceImpl(IFloodlightProviderService.class);
- storageSource = context.getServiceImpl(IStorageSourceService.class);
- restApi = context.getServiceImpl(IRestApiService.class);
- rules = new ArrayList<FirewallRule>();
- logger = LoggerFactory.getLogger(Firewall.class);
-
- // start disabled
- enabled = false;
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // register REST interface
- restApi.addRestletRoutable(new FirewallWebRoutable());
-
- // always place firewall in pipeline at bootup
- floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
-
- // storage, create table and read rules
- storageSource.createTable(TABLE_NAME, null);
- storageSource.setTablePrimaryKeyName(TABLE_NAME, COLUMN_RULEID);
- synchronized (rules) {
- this.rules = readRulesFromStorage();
- }
- }
-
- @Override
- public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
- if (!this.enabled)
- return Command.CONTINUE;
-
- switch (msg.getType()) {
- case PACKET_IN:
- IRoutingDecision decision = null;
- if (cntx != null) {
- decision = IRoutingDecision.rtStore.get(cntx,
- IRoutingDecision.CONTEXT_DECISION);
-
- return this.processPacketInMessage(sw, (OFPacketIn) msg,
- decision, cntx);
- }
- break;
- default:
- break;
- }
-
- return Command.CONTINUE;
- }
-
- @Override
- public void enableFirewall(boolean enabled) {
- logger.info("Setting firewall to {}", enabled);
- this.enabled = enabled;
- }
-
- @Override
- public List<FirewallRule> getRules() {
- return this.rules;
- }
-
- // Only used to serve REST GET
- // Similar to readRulesFromStorage(), which actually checks and stores
- // record into FirewallRule list
- @Override
- public List<Map<String, Object>> getStorageRules() {
- ArrayList<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
- try {
- // null1=no predicate, null2=no ordering
- IResultSet resultSet = storageSource.executeQuery(TABLE_NAME,
- ColumnNames, null, null);
- for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
- l.add(it.next().getRow());
- }
- } catch (StorageException e) {
- logger.error("failed to access storage: {}", e.getMessage());
- // if the table doesn't exist, then wait to populate later via
- // setStorageSource()
- }
- return l;
- }
-
- @Override
- public String getSubnetMask() {
- return IPv4.fromIPv4Address(this.subnet_mask);
- }
-
- @Override
- public void setSubnetMask(String newMask) {
- if (newMask.trim().isEmpty())
- return;
- this.subnet_mask = IPv4.toIPv4Address(newMask.trim());
- }
-
- @Override
- public synchronized void addRule(FirewallRule rule) {
-
- // generate random ruleid for each newly created rule
- // may want to return to caller if useful
- // may want to check conflict
- rule.ruleid = rule.genID();
-
- int i = 0;
- // locate the position of the new rule in the sorted arraylist
- for (i = 0; i < this.rules.size(); i++) {
- if (this.rules.get(i).priority >= rule.priority)
- break;
- }
- // now, add rule to the list
- if (i <= this.rules.size()) {
- this.rules.add(i, rule);
- } else {
- this.rules.add(rule);
- }
- // add rule to database
- Map<String, Object> entry = new HashMap<String, Object>();
- entry.put(COLUMN_RULEID, Integer.toString(rule.ruleid));
- entry.put(COLUMN_DPID, Long.toString(rule.dpid));
- entry.put(COLUMN_IN_PORT, Short.toString(rule.in_port));
- entry.put(COLUMN_DL_SRC, Long.toString(rule.dl_src));
- entry.put(COLUMN_DL_DST, Long.toString(rule.dl_dst));
- entry.put(COLUMN_DL_TYPE, Short.toString(rule.dl_type));
- entry.put(COLUMN_NW_SRC_PREFIX, Integer.toString(rule.nw_src_prefix));
- entry.put(COLUMN_NW_SRC_MASKBITS, Integer.toString(rule.nw_src_maskbits));
- entry.put(COLUMN_NW_DST_PREFIX, Integer.toString(rule.nw_dst_prefix));
- entry.put(COLUMN_NW_DST_MASKBITS, Integer.toString(rule.nw_dst_maskbits));
- entry.put(COLUMN_NW_PROTO, Short.toString(rule.nw_proto));
- entry.put(COLUMN_TP_SRC, Integer.toString(rule.tp_src));
- entry.put(COLUMN_TP_DST, Integer.toString(rule.tp_dst));
- entry.put(COLUMN_WILDCARD_DPID,
- Boolean.toString(rule.wildcard_dpid));
- entry.put(COLUMN_WILDCARD_IN_PORT,
- Boolean.toString(rule.wildcard_in_port));
- entry.put(COLUMN_WILDCARD_DL_SRC,
- Boolean.toString(rule.wildcard_dl_src));
- entry.put(COLUMN_WILDCARD_DL_DST,
- Boolean.toString(rule.wildcard_dl_dst));
- entry.put(COLUMN_WILDCARD_DL_TYPE,
- Boolean.toString(rule.wildcard_dl_type));
- entry.put(COLUMN_WILDCARD_NW_SRC,
- Boolean.toString(rule.wildcard_nw_src));
- entry.put(COLUMN_WILDCARD_NW_DST,
- Boolean.toString(rule.wildcard_nw_dst));
- entry.put(COLUMN_WILDCARD_NW_PROTO,
- Boolean.toString(rule.wildcard_nw_proto));
- entry.put(COLUMN_WILDCARD_TP_SRC,
- Boolean.toString(rule.wildcard_tp_src));
- entry.put(COLUMN_WILDCARD_TP_DST,
- Boolean.toString(rule.wildcard_tp_dst));
- entry.put(COLUMN_PRIORITY, Integer.toString(rule.priority));
- entry.put(COLUMN_ACTION, Integer.toString(rule.action.ordinal()));
- storageSource.insertRow(TABLE_NAME, entry);
- }
-
- @Override
- public synchronized void deleteRule(int ruleid) {
- Iterator<FirewallRule> iter = this.rules.iterator();
- while (iter.hasNext()) {
- FirewallRule r = iter.next();
- if (r.ruleid == ruleid) {
- // found the rule, now remove it
- iter.remove();
- break;
- }
- }
- // delete from database
- storageSource.deleteRow(TABLE_NAME, Integer.toString(ruleid));
- }
-
- /**
- * Iterates over the firewall rules and tries to match them with the
- * incoming packet (flow). Uses the FirewallRule class's matchWithFlow
- * method to perform matching. It maintains a pair of wildcards (allow and
- * deny) which are assigned later to the firewall's decision, where 'allow'
- * wildcards are applied if the matched rule turns out to be an ALLOW rule
- * and 'deny' wildcards are applied otherwise. Wildcards are applied to
- * firewall decision to optimize flows in the switch, ensuring least number
- * of flows per firewall rule. So, if a particular field is not "ANY" (i.e.
- * not wildcarded) in a higher priority rule, then if a lower priority rule
- * matches the packet and wildcards it, it can't be wildcarded in the
- * switch's flow entry, because otherwise some packets matching the higher
- * priority rule might escape the firewall. The reason for keeping different
- * two different wildcards is that if a field is not wildcarded in a higher
- * priority allow rule, the same field shouldn't be wildcarded for packets
- * matching the lower priority deny rule (non-wildcarded fields in higher
- * priority rules override the wildcarding of those fields in lower priority
- * rules of the opposite type). So, to ensure that wildcards are
- * appropriately set for different types of rules (allow vs. deny), separate
- * wildcards are maintained. Iteration is performed on the sorted list of
- * rules (sorted in decreasing order of priority).
- *
- * @param sw
- * the switch instance
- * @param pi
- * the incoming packet data structure
- * @param cntx
- * the floodlight context
- * @return an instance of RuleWildcardsPair that specify rule that matches
- * and the wildcards for the firewall decision
- */
- protected RuleWildcardsPair matchWithRule(IOFSwitch sw, OFPacketIn pi,
- FloodlightContext cntx) {
- FirewallRule matched_rule = null;
- Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
- WildcardsPair wildcards = new WildcardsPair();
-
- synchronized (rules) {
- Iterator<FirewallRule> iter = this.rules.iterator();
- FirewallRule rule = null;
- // iterate through list to find a matching firewall rule
- while (iter.hasNext()) {
- // get next rule from list
- rule = iter.next();
-
- // check if rule matches
- if (rule.matchesFlow(sw.getId(), pi.getInPort(), eth, wildcards) == true) {
- matched_rule = rule;
- break;
- }
- }
- }
-
- // make a pair of rule and wildcards, then return it
- RuleWildcardsPair ret = new RuleWildcardsPair();
- ret.rule = matched_rule;
- if (matched_rule == null || matched_rule.action == FirewallRule.FirewallAction.DENY) {
- ret.wildcards = wildcards.drop;
- } else {
- ret.wildcards = wildcards.allow;
- }
- return ret;
- }
-
- /**
- * Checks whether an IP address is a broadcast address or not (determines
- * using subnet mask)
- *
- * @param IPAddress
- * the IP address to check
- * @return true if it is a broadcast address, false otherwise
- */
- protected boolean IPIsBroadcast(int IPAddress) {
- // inverted subnet mask
- int inv_subnet_mask = ~this.subnet_mask;
- return ((IPAddress & inv_subnet_mask) == inv_subnet_mask);
- }
-
- public Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi,
- IRoutingDecision decision, FloodlightContext cntx) {
- Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
-
- // Allowing L2 broadcast + ARP broadcast request (also deny malformed
- // broadcasts -> L2 broadcast + L3 unicast)
- if (eth.isBroadcast() == true) {
- boolean allowBroadcast = true;
- // the case to determine if we have L2 broadcast + L3 unicast
- // don't allow this broadcast packet if such is the case (malformed
- // packet)
- if (eth.getEtherType() == Ethernet.TYPE_IPv4
- && this.IPIsBroadcast(((IPv4) eth.getPayload())
- .getDestinationAddress()) == false) {
- allowBroadcast = false;
- }
- if (allowBroadcast == true) {
- if (logger.isTraceEnabled())
- logger.trace("Allowing broadcast traffic for PacketIn={}",
- pi);
-
- decision = new RoutingDecision(sw.getId(), pi.getInPort()
- , IDeviceService.fcStore.
- get(cntx, IDeviceService.CONTEXT_SRC_DEVICE),
- IRoutingDecision.RoutingAction.MULTICAST);
- decision.addToContext(cntx);
- } else {
- if (logger.isTraceEnabled())
- logger.trace(
- "Blocking malformed broadcast traffic for PacketIn={}",
- pi);
-
- decision = new RoutingDecision(sw.getId(), pi.getInPort()
- , IDeviceService.fcStore.
- get(cntx, IDeviceService.CONTEXT_SRC_DEVICE),
- IRoutingDecision.RoutingAction.DROP);
- decision.addToContext(cntx);
- }
- return Command.CONTINUE;
- }
- /*
- * ARP response (unicast) can be let through without filtering through
- * rules by uncommenting the code below
- */
- /*
- * else if (eth.getEtherType() == Ethernet.TYPE_ARP) {
- * logger.info("allowing ARP traffic"); decision = new
- * FirewallDecision(IRoutingDecision.RoutingAction.FORWARD_OR_FLOOD);
- * decision.addToContext(cntx); return Command.CONTINUE; }
- */
-
- // check if we have a matching rule for this packet/flow
- // and no decision is taken yet
- if (decision == null) {
- RuleWildcardsPair match_ret = this.matchWithRule(sw, pi, cntx);
- FirewallRule rule = match_ret.rule;
-
- if (rule == null || rule.action == FirewallRule.FirewallAction.DENY) {
- decision = new RoutingDecision(sw.getId(), pi.getInPort()
- , IDeviceService.fcStore.
- get(cntx, IDeviceService.CONTEXT_SRC_DEVICE),
- IRoutingDecision.RoutingAction.DROP);
- decision.setWildcards(match_ret.wildcards);
- decision.addToContext(cntx);
- if (logger.isTraceEnabled()) {
- if (rule == null)
- logger.trace(
- "No firewall rule found for PacketIn={}, blocking flow",
- pi);
- else if (rule.action == FirewallRule.FirewallAction.DENY) {
- logger.trace("Deny rule={} match for PacketIn={}",
- rule, pi);
- }
- }
- } else {
- decision = new RoutingDecision(sw.getId(), pi.getInPort()
- , IDeviceService.fcStore.
- get(cntx, IDeviceService.CONTEXT_SRC_DEVICE),
- IRoutingDecision.RoutingAction.FORWARD_OR_FLOOD);
- decision.setWildcards(match_ret.wildcards);
- decision.addToContext(cntx);
- if (logger.isTraceEnabled())
- logger.trace("Allow rule={} match for PacketIn={}", rule,
- pi);
- }
- }
-
- return Command.CONTINUE;
- }
-
- @Override
- public boolean isEnabled() {
- return enabled;
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/FirewallResource.java b/src/main/java/net/floodlightcontroller/firewall/FirewallResource.java
deleted file mode 100644
index 1f4d71a..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/FirewallResource.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import java.io.IOException;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.MappingJsonFactory;
-import org.restlet.resource.Post;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FirewallResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(FirewallResource.class);
-
- @Get("json")
- public Object handleRequest() {
- IFirewallService firewall =
- (IFirewallService)getContext().getAttributes().
- get(IFirewallService.class.getCanonicalName());
-
- String op = (String) getRequestAttributes().get("op");
-
- // REST API check status
- if (op.equalsIgnoreCase("status")) {
- if (firewall.isEnabled())
- return "{\"result\" : \"firewall enabled\"}";
- else
- return "{\"result\" : \"firewall disabled\"}";
- }
-
- // REST API enable firewall
- if (op.equalsIgnoreCase("enable")) {
- firewall.enableFirewall(true);
- return "{\"status\" : \"success\", \"details\" : \"firewall running\"}";
- }
-
- // REST API disable firewall
- if (op.equalsIgnoreCase("disable")) {
- firewall.enableFirewall(false);
- return "{\"status\" : \"success\", \"details\" : \"firewall stopped\"}";
- }
-
- // REST API retrieving rules from storage
- // currently equivalent to /wm/firewall/rules/json
- if (op.equalsIgnoreCase("storageRules")) {
- return firewall.getStorageRules();
- }
-
- // REST API set local subnet mask -- this only makes sense for one subnet
- // will remove later
- if (op.equalsIgnoreCase("subnet-mask")) {
- return firewall.getSubnetMask();
- }
-
- // no known options found
- return "{\"status\" : \"failure\", \"details\" : \"invalid operation\"}";
- }
-
- /**
- * Allows setting of subnet mask
- * @param fmJson The Subnet Mask in JSON format.
- * @return A string status message
- */
- @Post
- public String handlePost(String fmJson) {
- IFirewallService firewall =
- (IFirewallService)getContext().getAttributes().
- get(IFirewallService.class.getCanonicalName());
-
- String newMask;
- try {
- newMask = jsonExtractSubnetMask(fmJson);
- } catch (IOException e) {
- log.error("Error parsing new subnet mask: " + fmJson, e);
- e.printStackTrace();
- return "{\"status\" : \"Error! Could not parse new subnet mask, see log for details.\"}";
- }
- firewall.setSubnetMask(newMask);
- return ("{\"status\" : \"subnet mask set\"}");
- }
-
- /**
- * Extracts subnet mask from a JSON string
- * @param fmJson The JSON formatted string
- * @return The subnet mask
- * @throws IOException If there was an error parsing the JSON
- */
- public static String jsonExtractSubnetMask(String fmJson) throws IOException {
- String subnet_mask = "";
- MappingJsonFactory f = new MappingJsonFactory();
- JsonParser jp;
-
- try {
- jp = f.createJsonParser(fmJson);
- } catch (JsonParseException e) {
- throw new IOException(e);
- }
-
- jp.nextToken();
- if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
- throw new IOException("Expected START_OBJECT");
- }
-
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- if (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- throw new IOException("Expected FIELD_NAME");
- }
-
- String n = jp.getCurrentName();
- jp.nextToken();
- if (jp.getText().equals(""))
- continue;
-
- if (n == "subnet-mask") {
- subnet_mask = jp.getText();
- break;
- }
- }
-
- return subnet_mask;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/FirewallRule.java b/src/main/java/net/floodlightcontroller/firewall/FirewallRule.java
deleted file mode 100644
index d9b2612..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/FirewallRule.java
+++ /dev/null
@@ -1,392 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import org.openflow.protocol.OFMatch;
-
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.packet.TCP;
-import net.floodlightcontroller.packet.UDP;
-
-public class FirewallRule implements Comparable<FirewallRule> {
- public int ruleid;
-
- public long dpid;
- public short in_port;
- public long dl_src;
- public long dl_dst;
- public short dl_type;
- public int nw_src_prefix;
- public int nw_src_maskbits;
- public int nw_dst_prefix;
- public int nw_dst_maskbits;
- public short nw_proto;
- public short tp_src;
- public short tp_dst;
-
- public boolean wildcard_dpid;
- public boolean wildcard_in_port;
- public boolean wildcard_dl_src;
- public boolean wildcard_dl_dst;
- public boolean wildcard_dl_type;
- public boolean wildcard_nw_src;
- public boolean wildcard_nw_dst;
- public boolean wildcard_nw_proto;
- public boolean wildcard_tp_src;
- public boolean wildcard_tp_dst;
-
- public int priority = 0;
-
- public FirewallAction action;
-
- public enum FirewallAction {
- /*
- * DENY: Deny rule
- * ALLOW: Allow rule
- */
- DENY, ALLOW
- }
-
- public FirewallRule() {
- this.in_port = 0;
- this.dl_src = 0;
- this.nw_src_prefix = 0;
- this.nw_src_maskbits = 0;
- this.dl_dst = 0;
- this.nw_proto = 0;
- this.tp_src = 0;
- this.tp_dst = 0;
- this.dl_dst = 0;
- this.nw_dst_prefix = 0;
- this.nw_dst_maskbits = 0;
- this.dpid = -1;
- this.wildcard_dpid = true;
- this.wildcard_in_port = true;
- this.wildcard_dl_src = true;
- this.wildcard_dl_dst = true;
- this.wildcard_dl_type = true;
- this.wildcard_nw_src = true;
- this.wildcard_nw_dst = true;
- this.wildcard_nw_proto = true;
- this.wildcard_tp_src = true;
- this.wildcard_tp_dst = true;
- this.priority = 0;
- this.action = FirewallAction.ALLOW;
- this.ruleid = 0;
- }
-
- /**
- * Generates a unique ID for the instance
- *
- * @return int representing the unique id
- */
- public int genID() {
- int uid = this.hashCode();
- if (uid < 0) {
- uid = Math.abs(uid);
- uid = uid * 15551;
- }
- return uid;
- }
-
- /**
- * Comparison method for Collections.sort method
- *
- * @param rule
- * the rule to compare with
- * @return number representing the result of comparison 0 if equal negative
- * if less than 'rule' greater than zero if greater priority rule
- * than 'rule'
- */
- @Override
- public int compareTo(FirewallRule rule) {
- return this.priority - rule.priority;
- }
-
- /**
- * Determines if this instance matches an existing rule instance
- *
- * @param r
- * : the FirewallRule instance to compare with
- * @return boolean: true if a match is found
- **/
- public boolean isSameAs(FirewallRule r) {
- if (this.action != r.action
- || this.wildcard_dl_type != r.wildcard_dl_type
- || (this.wildcard_dl_type == false && this.dl_type == r.dl_type)
- || this.wildcard_tp_src != r.wildcard_tp_src
- || (this.wildcard_tp_src == false && this.tp_src != r.tp_src)
- || this.wildcard_tp_dst != r.wildcard_tp_dst
- || (this.wildcard_tp_dst == false &&this.tp_dst != r.tp_dst)
- || this.wildcard_dpid != r.wildcard_dpid
- || (this.wildcard_dpid == false && this.dpid != r.dpid)
- || this.wildcard_in_port != r.wildcard_in_port
- || (this.wildcard_in_port == false && this.in_port != r.in_port)
- || this.wildcard_nw_src != r.wildcard_nw_src
- || (this.wildcard_nw_src == false && (this.nw_src_prefix != r.nw_src_prefix || this.nw_src_maskbits != r.nw_src_maskbits))
- || this.wildcard_dl_src != r.wildcard_dl_src
- || (this.wildcard_dl_src == false && this.dl_src != r.dl_src)
- || this.wildcard_nw_proto != r.wildcard_nw_proto
- || (this.wildcard_nw_proto == false && this.nw_proto != r.nw_proto)
- || this.wildcard_nw_dst != r.wildcard_nw_dst
- || (this.wildcard_nw_dst == false && (this.nw_dst_prefix != r.nw_dst_prefix || this.nw_dst_maskbits != r.nw_dst_maskbits))
- || this.wildcard_dl_dst != r.wildcard_dl_dst
- || (this.wildcard_dl_dst == false && this.dl_dst != r.dl_dst)) {
- return false;
- }
- return true;
- }
-
- /**
- * Matches this rule to a given flow - incoming packet
- *
- * @param switchDpid
- * the Id of the connected switch
- * @param inPort
- * the switch port where the packet originated from
- * @param packet
- * the Ethernet packet that arrives at the switch
- * @param wildcards
- * the pair of wildcards (allow and deny) given by Firewall
- * module that is used by the Firewall module's matchWithRule
- * method to derive wildcards for the decision to be taken
- * @return true if the rule matches the given packet-in, false otherwise
- */
- public boolean matchesFlow(long switchDpid, short inPort, Ethernet packet,
- WildcardsPair wildcards) {
- IPacket pkt = packet.getPayload();
-
- // dl_type type
- IPv4 pkt_ip = null;
-
- // nw_proto types
- TCP pkt_tcp = null;
- UDP pkt_udp = null;
-
- // tp_src and tp_dst (tp port numbers)
- short pkt_tp_src = 0;
- short pkt_tp_dst = 0;
-
- // switchID matches?
- if (wildcard_dpid == false && dpid != switchDpid)
- return false;
-
- // in_port matches?
- if (wildcard_in_port == false && in_port != inPort)
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_IN_PORT;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_IN_PORT;
- }
-
- // mac address (src and dst) match?
- if (wildcard_dl_src == false
- && dl_src != packet.getSourceMAC().toLong())
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_DL_SRC;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_DL_SRC;
- }
-
- if (wildcard_dl_dst == false
- && dl_dst != packet.getDestinationMAC().toLong())
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_DL_DST;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_DL_DST;
- }
-
- // dl_type check: ARP, IP
-
- // if this is not an ARP rule but the pkt is ARP,
- // return false match - no need to continue protocol specific check
- if (wildcard_dl_type == false) {
- if (dl_type == Ethernet.TYPE_ARP) {
- if (packet.getEtherType() != Ethernet.TYPE_ARP)
- return false;
- else {
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_DL_TYPE;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_DL_TYPE;
- }
- }
- } else if (dl_type == Ethernet.TYPE_IPv4) {
- if (packet.getEtherType() != Ethernet.TYPE_IPv4)
- return false;
- else {
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_NW_PROTO;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_NW_PROTO;
- }
- // IP packets, proceed with ip address check
- pkt_ip = (IPv4) pkt;
-
- // IP addresses (src and dst) match?
- if (wildcard_nw_src == false
- && this.matchIPAddress(nw_src_prefix,
- nw_src_maskbits, pkt_ip.getSourceAddress()) == false)
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_NW_SRC_ALL;
- wildcards.drop |= (nw_src_maskbits << OFMatch.OFPFW_NW_SRC_SHIFT);
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_NW_SRC_ALL;
- wildcards.allow |= (nw_src_maskbits << OFMatch.OFPFW_NW_SRC_SHIFT);
- }
-
- if (wildcard_nw_dst == false
- && this.matchIPAddress(nw_dst_prefix,
- nw_dst_maskbits,
- pkt_ip.getDestinationAddress()) == false)
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_NW_DST_ALL;
- wildcards.drop |= (nw_dst_maskbits << OFMatch.OFPFW_NW_DST_SHIFT);
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_NW_DST_ALL;
- wildcards.allow |= (nw_dst_maskbits << OFMatch.OFPFW_NW_DST_SHIFT);
- }
-
- // nw_proto check
- if (wildcard_nw_proto == false) {
- if (nw_proto == IPv4.PROTOCOL_TCP) {
- if (pkt_ip.getProtocol() != IPv4.PROTOCOL_TCP)
- return false;
- else {
- pkt_tcp = (TCP) pkt_ip.getPayload();
- pkt_tp_src = pkt_tcp.getSourcePort();
- pkt_tp_dst = pkt_tcp.getDestinationPort();
- }
- } else if (nw_proto == IPv4.PROTOCOL_UDP) {
- if (pkt_ip.getProtocol() != IPv4.PROTOCOL_UDP)
- return false;
- else {
- pkt_udp = (UDP) pkt_ip.getPayload();
- pkt_tp_src = pkt_udp.getSourcePort();
- pkt_tp_dst = pkt_udp.getDestinationPort();
- }
- } else if (nw_proto == IPv4.PROTOCOL_ICMP) {
- if (pkt_ip.getProtocol() != IPv4.PROTOCOL_ICMP)
- return false;
- else {
- // nothing more needed for ICMP
- }
- }
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_NW_PROTO;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_NW_PROTO;
- }
-
- // TCP/UDP source and destination ports match?
- if (pkt_tcp != null || pkt_udp != null) {
- // does the source port match?
- if (tp_src != 0 && tp_src != pkt_tp_src)
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_TP_SRC;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_TP_SRC;
- }
-
- // does the destination port match?
- if (tp_dst != 0 && tp_dst != pkt_tp_dst)
- return false;
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_TP_DST;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_TP_DST;
- }
- }
- }
-
- }
- } else {
- // non-IP packet - not supported - report no match
- return false;
- }
- }
- if (action == FirewallRule.FirewallAction.DENY) {
- wildcards.drop &= ~OFMatch.OFPFW_DL_TYPE;
- } else {
- wildcards.allow &= ~OFMatch.OFPFW_DL_TYPE;
- }
-
- // all applicable checks passed
- return true;
- }
-
- /**
- * Determines if rule's CIDR address matches IP address of the packet
- *
- * @param rulePrefix
- * prefix part of the CIDR address
- * @param ruleBits
- * the size of mask of the CIDR address
- * @param packetAddress
- * the IP address of the incoming packet to match with
- * @return true if CIDR address matches the packet's IP address, false
- * otherwise
- */
- protected boolean matchIPAddress(int rulePrefix, int ruleBits,
- int packetAddress) {
- boolean matched = true;
-
- int rule_iprng = 32 - ruleBits;
- int rule_ipint = rulePrefix;
- int pkt_ipint = packetAddress;
- // if there's a subnet range (bits to be wildcarded > 0)
- if (rule_iprng > 0) {
- // right shift bits to remove rule_iprng of LSB that are to be
- // wildcarded
- rule_ipint = rule_ipint >> rule_iprng;
- pkt_ipint = pkt_ipint >> rule_iprng;
- // now left shift to return to normal range, except that the
- // rule_iprng number of LSB
- // are now zeroed
- rule_ipint = rule_ipint << rule_iprng;
- pkt_ipint = pkt_ipint << rule_iprng;
- }
- // check if we have a match
- if (rule_ipint != pkt_ipint)
- matched = false;
-
- return matched;
- }
-
- @Override
- public int hashCode() {
- final int prime = 2521;
- int result = super.hashCode();
- result = prime * result + (int) dpid;
- result = prime * result + in_port;
- result = prime * result + (int) dl_src;
- result = prime * result + (int) dl_dst;
- result = prime * result + dl_type;
- result = prime * result + nw_src_prefix;
- result = prime * result + nw_src_maskbits;
- result = prime * result + nw_dst_prefix;
- result = prime * result + nw_dst_maskbits;
- result = prime * result + nw_proto;
- result = prime * result + tp_src;
- result = prime * result + tp_dst;
- result = prime * result + action.ordinal();
- result = prime * result + priority;
- result = prime * result + (new Boolean(wildcard_dpid)).hashCode();
- result = prime * result + (new Boolean(wildcard_in_port)).hashCode();
- result = prime * result + (new Boolean(wildcard_dl_src)).hashCode();
- result = prime * result + (new Boolean(wildcard_dl_dst)).hashCode();
- result = prime * result + (new Boolean(wildcard_dl_type)).hashCode();
- result = prime * result + (new Boolean(wildcard_nw_src)).hashCode();
- result = prime * result + (new Boolean(wildcard_nw_dst)).hashCode();
- result = prime * result + (new Boolean(wildcard_nw_proto)).hashCode();
- result = prime * result + (new Boolean(wildcard_tp_src)).hashCode();
- result = prime * result + (new Boolean(wildcard_tp_dst)).hashCode();
- return result;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/FirewallRulesResource.java b/src/main/java/net/floodlightcontroller/firewall/FirewallRulesResource.java
deleted file mode 100644
index 7a31d38..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/FirewallRulesResource.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.MappingJsonFactory;
-import org.openflow.util.HexString;
-import org.restlet.resource.Delete;
-import org.restlet.resource.Post;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPv4;
-
-public class FirewallRulesResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(FirewallRulesResource.class);
-
- @Get("json")
- public Object handleRequest() {
- IFirewallService firewall =
- (IFirewallService)getContext().getAttributes().
- get(IFirewallService.class.getCanonicalName());
-
- return firewall.getRules();
- }
-
- /**
- * Takes a Firewall Rule string in JSON format and parses it into
- * our firewall rule data structure, then adds it to the firewall.
- * @param fmJson The Firewall rule entry in JSON format.
- * @return A string status message
- */
- @Post
- public String store(String fmJson) {
- IFirewallService firewall =
- (IFirewallService)getContext().getAttributes().
- get(IFirewallService.class.getCanonicalName());
-
- FirewallRule rule;
- try {
- rule = jsonToFirewallRule(fmJson);
- } catch (IOException e) {
- log.error("Error parsing firewall rule: " + fmJson, e);
- e.printStackTrace();
- return "{\"status\" : \"Error! Could not parse firewall rule, see log for details.\"}";
- }
- String status = null;
- if (checkRuleExists(rule, firewall.getRules())) {
- status = "Error! A similar firewall rule already exists.";
- log.error(status);
- } else {
- // add rule to firewall
- firewall.addRule(rule);
- status = "Rule added";
- }
- return ("{\"status\" : \"" + status + "\"}");
- }
-
- /**
- * Takes a Firewall Rule string in JSON format and parses it into
- * our firewall rule data structure, then deletes it from the firewall.
- * @param fmJson The Firewall rule entry in JSON format.
- * @return A string status message
- */
-
- @Delete
- public String remove(String fmJson) {
- IFirewallService firewall =
- (IFirewallService)getContext().getAttributes().
- get(IFirewallService.class.getCanonicalName());
-
- FirewallRule rule;
- try {
- rule = jsonToFirewallRule(fmJson);
- } catch (IOException e) {
- log.error("Error parsing firewall rule: " + fmJson, e);
- e.printStackTrace();
- return "{\"status\" : \"Error! Could not parse firewall rule, see log for details.\"}";
- }
- String status = null;
- boolean exists = false;
- Iterator<FirewallRule> iter = firewall.getRules().iterator();
- while (iter.hasNext()) {
- FirewallRule r = iter.next();
- if (r.ruleid == rule.ruleid) {
- exists = true;
- break;
- }
- }
- if (!exists) {
- status = "Error! Can't delete, a rule with this ID doesn't exist.";
- log.error(status);
- } else {
- // delete rule from firewall
- firewall.deleteRule(rule.ruleid);
- status = "Rule deleted";
- }
- return ("{\"status\" : \"" + status + "\"}");
- }
-
- /**
- * Turns a JSON formatted Firewall Rule string into a FirewallRule instance
- * @param fmJson The JSON formatted static firewall rule
- * @return The FirewallRule instance
- * @throws IOException If there was an error parsing the JSON
- */
-
- public static FirewallRule jsonToFirewallRule(String fmJson) throws IOException {
- FirewallRule rule = new FirewallRule();
- MappingJsonFactory f = new MappingJsonFactory();
- JsonParser jp;
-
- try {
- jp = f.createJsonParser(fmJson);
- } catch (JsonParseException e) {
- throw new IOException(e);
- }
-
- jp.nextToken();
- if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
- throw new IOException("Expected START_OBJECT");
- }
-
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- if (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- throw new IOException("Expected FIELD_NAME");
- }
-
- String n = jp.getCurrentName();
- jp.nextToken();
- if (jp.getText().equals(""))
- continue;
-
- String tmp;
-
- // This is currently only applicable for remove(). In store(), ruleid takes a random number
- if (n == "ruleid") {
- rule.ruleid = Integer.parseInt((String)jp.getText());
- }
-
- // This assumes user having dpid info for involved switches
- else if (n == "switchid") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("-1") == false) {
- // user inputs hex format dpid
- rule.dpid = HexString.toLong(tmp);
- rule.wildcard_dpid = false;
- }
- }
-
- else if (n == "src-inport") {
- rule.in_port = Short.parseShort(jp.getText());
- rule.wildcard_in_port = false;
- }
-
- else if (n == "src-mac") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("ANY") == false) {
- rule.wildcard_dl_src = false;
- rule.dl_src = Ethernet.toLong(Ethernet.toMACAddress(tmp));
- }
- }
-
- else if (n == "dst-mac") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("ANY") == false) {
- rule.wildcard_dl_dst = false;
- rule.dl_dst = Ethernet.toLong(Ethernet.toMACAddress(tmp));
- }
- }
-
- else if (n == "dl-type") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("ARP")) {
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_ARP;
- }
- }
-
- else if (n == "src-ip") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("ANY") == false) {
- rule.wildcard_nw_src = false;
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_IPv4;
- int[] cidr = IPCIDRToPrefixBits(tmp);
- rule.nw_src_prefix = cidr[0];
- rule.nw_src_maskbits = cidr[1];
- }
- }
-
- else if (n == "dst-ip") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("ANY") == false) {
- rule.wildcard_nw_dst = false;
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_IPv4;
- int[] cidr = IPCIDRToPrefixBits(tmp);
- rule.nw_dst_prefix = cidr[0];
- rule.nw_dst_maskbits = cidr[1];
- }
- }
-
- else if (n == "nw-proto") {
- tmp = jp.getText();
- if (tmp.equalsIgnoreCase("TCP")) {
- rule.wildcard_nw_proto = false;
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_IPv4;
- } else if (tmp.equalsIgnoreCase("UDP")) {
- rule.wildcard_nw_proto = false;
- rule.nw_proto = IPv4.PROTOCOL_UDP;
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_IPv4;
- } else if (tmp.equalsIgnoreCase("ICMP")) {
- rule.wildcard_nw_proto = false;
- rule.nw_proto = IPv4.PROTOCOL_ICMP;
- rule.wildcard_dl_type = false;
- rule.dl_type = Ethernet.TYPE_IPv4;
- }
- }
-
- else if (n == "tp-src") {
- rule.wildcard_tp_src = false;
- rule.tp_src = Short.parseShort(jp.getText());
- }
-
- else if (n == "tp-dst") {
- rule.wildcard_tp_dst = false;
- rule.tp_dst = Short.parseShort(jp.getText());
- }
-
- else if (n == "priority") {
- rule.priority = Integer.parseInt(jp.getText());
- }
-
- else if (n == "action") {
- if (jp.getText().equalsIgnoreCase("allow") == true) {
- rule.action = FirewallRule.FirewallAction.ALLOW;
- } else if (jp.getText().equalsIgnoreCase("deny") == true) {
- rule.action = FirewallRule.FirewallAction.DENY;
- }
- }
- }
-
- return rule;
- }
-
- public static int[] IPCIDRToPrefixBits(String cidr) {
- int ret[] = new int[2];
-
- // as IP can also be a prefix rather than an absolute address
- // split it over "/" to get the bit range
- String[] parts = cidr.split("/");
- String cidr_prefix = parts[0].trim();
- int cidr_bits = 0;
- if (parts.length == 2) {
- try {
- cidr_bits = Integer.parseInt(parts[1].trim());
- } catch (Exception exp) {
- cidr_bits = 32;
- }
- }
- ret[0] = IPv4.toIPv4Address(cidr_prefix);
- ret[1] = cidr_bits;
-
- return ret;
- }
-
- public static boolean checkRuleExists(FirewallRule rule, List<FirewallRule> rules) {
- Iterator<FirewallRule> iter = rules.iterator();
- while (iter.hasNext()) {
- FirewallRule r = iter.next();
-
- // check if we find a similar rule
- if (rule.isSameAs(r)) {
- return true;
- }
- }
-
- // no rule matched, so it doesn't exist in the rules
- return false;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/FirewallWebRoutable.java b/src/main/java/net/floodlightcontroller/firewall/FirewallWebRoutable.java
deleted file mode 100644
index 3a9beab..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/FirewallWebRoutable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import net.floodlightcontroller.restserver.RestletRoutable;
-import org.restlet.Context;
-import org.restlet.routing.Router;
-
-public class FirewallWebRoutable implements RestletRoutable {
- /**
- * Create the Restlet router and bind to the proper resources.
- */
- @Override
- public Router getRestlet(Context context) {
- Router router = new Router(context);
- router.attach("/module/{op}/json", FirewallResource.class);
- router.attach("/rules/json", FirewallRulesResource.class);
- return router;
- }
-
- /**
- * Set the base path for the Firewall
- */
- @Override
- public String basePath() {
- return "/wm/firewall";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/IFirewallService.java b/src/main/java/net/floodlightcontroller/firewall/IFirewallService.java
deleted file mode 100644
index ae9d89f..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/IFirewallService.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import java.util.List;
-import java.util.Map;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-public interface IFirewallService extends IFloodlightService {
-
- /**
- * Enables/disables the firewall.
- * @param enable Whether to enable or disable the firewall.
- */
- public void enableFirewall(boolean enable);
-
- /**
- * Returns operational status of the firewall
- * @return boolean enabled;
- */
- public boolean isEnabled();
-
- /**
- * Returns all of the firewall rules
- * @return List of all rules
- */
- public List<FirewallRule> getRules();
-
- /**
- * Returns the subnet mask
- * @return subnet mask
- */
- public String getSubnetMask();
-
- /**
- * Sets the subnet mask
- * @param newMask The new subnet mask
- */
- public void setSubnetMask(String newMask);
-
- /**
- * Returns all of the firewall rules in storage
- * for debugging and unit-testing purposes
- * @return List of all rules in storage
- */
- public List<Map<String, Object>> getStorageRules();
-
- /**
- * Adds a new Firewall rule
- */
- public void addRule(FirewallRule rule);
-
- /**
- * Deletes a Firewall rule
- */
- public void deleteRule(int ruleid);
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/RuleWildcardsPair.java b/src/main/java/net/floodlightcontroller/firewall/RuleWildcardsPair.java
deleted file mode 100644
index 3fab409..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/RuleWildcardsPair.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import org.openflow.protocol.OFMatch;
-
-public class RuleWildcardsPair {
- public FirewallRule rule;
- public int wildcards = OFMatch.OFPFW_ALL;
-}
diff --git a/src/main/java/net/floodlightcontroller/firewall/WildcardsPair.java b/src/main/java/net/floodlightcontroller/firewall/WildcardsPair.java
deleted file mode 100644
index 2e5f123..0000000
--- a/src/main/java/net/floodlightcontroller/firewall/WildcardsPair.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import org.openflow.protocol.OFMatch;
-
-public class WildcardsPair {
- public int allow = OFMatch.OFPFW_ALL;
- public int drop = OFMatch.OFPFW_ALL;
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
deleted file mode 100644
index a5f759c..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ /dev/null
@@ -1,658 +0,0 @@
-package net.floodlightcontroller.flowcache;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.INetMapStorage;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.flowcache.web.FlowWebRoutable;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.util.CallerId;
-import net.floodlightcontroller.util.DataPath;
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.DataPathEndpoints;
-import net.floodlightcontroller.util.FlowEntry;
-import net.floodlightcontroller.util.FlowEntryId;
-import net.floodlightcontroller.util.FlowEntrySwitchState;
-import net.floodlightcontroller.util.FlowEntryUserState;
-import net.floodlightcontroller.util.FlowId;
-import net.floodlightcontroller.util.FlowPath;
-import net.floodlightcontroller.util.OFMessageDamper;
-import net.floodlightcontroller.util.Port;
-import net.onrc.onos.util.GraphDBConnection;
-import net.onrc.onos.util.GraphDBConnection.Transaction;
-
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FlowManager implements IFloodlightModule, IFlowService, INetMapStorage {
-
- public GraphDBConnection conn;
-
- protected IRestApiService restApi;
- protected IFloodlightProviderService floodlightProvider;
-
- protected OFMessageDamper messageDamper;
-
- protected static int OFMESSAGE_DAMPER_CAPACITY = 50000; // TODO: find sweet spot
- protected static int OFMESSAGE_DAMPER_TIMEOUT = 250; // ms
- public static short FLOWMOD_DEFAULT_IDLE_TIMEOUT = 0; // infinity
- public static short FLOWMOD_DEFAULT_HARD_TIMEOUT = 0; // infinite
-
- /** The logger. */
- private static Logger log = LoggerFactory.getLogger(FlowManager.class);
-
- // The periodic task(s)
- private final ScheduledExecutorService scheduler =
- Executors.newScheduledThreadPool(1);
- final Runnable reader = new Runnable() {
- public void run() {
- // log.debug("Reading Flow Entries from the Network Map...");
- if (floodlightProvider == null) {
- log.debug("FloodlightProvider service not found!");
- return;
- }
-
- Map<Long, IOFSwitch> mySwitches = floodlightProvider.getSwitches();
-
- // Fetch all Flow Entries
- Iterable<IFlowEntry> flowEntries = conn.utils().getAllFlowEntries(conn);
- for (IFlowEntry flowEntryObj : flowEntries) {
- FlowEntryId flowEntryId =
- new FlowEntryId(flowEntryObj.getFlowEntryId());
- String userState = flowEntryObj.getUserState();
- String switchState = flowEntryObj.getSwitchState();
-
- log.debug("Found Flow Entry {}: ", flowEntryId.toString());
- log.debug("User State {}:", userState);
- log.debug("Switch State {}:", switchState);
-
- if (! switchState.equals("FE_SWITCH_NOT_UPDATED")) {
- // Ignore the entry: nothing to do
- continue;
- }
-
- Dpid dpid = new Dpid(flowEntryObj.getSwitchDpid());
- IOFSwitch mySwitch = mySwitches.get(dpid.value());
- if (mySwitch == null) {
- log.debug("Flow Entry ignored: not my switch");
- continue;
- }
-
- //
- // Create the Open Flow Flow Modification Entry to push
- //
- OFFlowMod fm =
- (OFFlowMod) floodlightProvider.getOFMessageFactory()
- .getMessage(OFType.FLOW_MOD);
- long cookie = flowEntryId.value();
-
- short flowModCommand = OFFlowMod.OFPFC_ADD;
- if (userState.equals("FE_USER_ADD")) {
- flowModCommand = OFFlowMod.OFPFC_ADD;
- } else if (userState.equals("FE_USER_MODIFY")) {
- flowModCommand = OFFlowMod.OFPFC_MODIFY_STRICT;
- } else if (userState.equals("FE_USER_DELETE")) {
- flowModCommand = OFFlowMod.OFPFC_DELETE_STRICT;
- } else {
- // Unknown user state. Ignore the entry
- continue;
- }
-
- OFMatch match = new OFMatch();
- match.setInputPort(flowEntryObj.getInPort());
-
- OFActionOutput action = new OFActionOutput();
- action.setMaxLength((short)0xffff);
- action.setPort(flowEntryObj.getOutPort());
- List<OFAction> actions = new ArrayList<OFAction>();
- actions.add(action);
-
- fm.setIdleTimeout(FLOWMOD_DEFAULT_IDLE_TIMEOUT)
- .setHardTimeout(FLOWMOD_DEFAULT_HARD_TIMEOUT)
- .setBufferId(OFPacketOut.BUFFER_ID_NONE)
- .setCookie(cookie)
- .setCommand(flowModCommand)
- .setMatch(match)
- .setActions(actions)
- .setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
- //
- // TODO: Set the following flag
- // fm.setFlags(OFFlowMod.OFPFF_SEND_FLOW_REM);
- // See method ForwardingBase::pushRoute()
- //
- try {
- messageDamper.write(mySwitch, fm, null);
- mySwitch.flush();
- flowEntryObj.setSwitchState("FE_SWITCH_UPDATED");
- if (userState.equals("FE_USER_DELETE")) {
- // Delete the entry
- IFlowPath flowObj = null;
- flowObj = conn.utils().getFlowPathByFlowEntry(conn,
- flowEntryObj);
- if (flowObj != null)
- log.debug("Found FlowPath to be deleted");
- else
- log.debug("Did not find FlowPath to be deleted");
- flowObj.removeFlowEntry(flowEntryObj);
- conn.utils().removeFlowEntry(conn, flowEntryObj);
-
- // Test whether the last flow entry
- Iterable<IFlowEntry> tmpflowEntries =
- flowObj.getFlowEntries();
- boolean found = false;
- for (IFlowEntry tmpflowEntryObj : tmpflowEntries) {
- found = true;
- break;
- }
- if (! found) {
- // Remove the Flow Path as well
- conn.utils().removeFlowPath(conn, flowObj);
- }
- }
- } catch (IOException e) {
- log.error("Failure writing flow mod from network map", e);
- }
- }
- conn.endTx(Transaction.COMMIT);
- }
- };
- final ScheduledFuture<?> readerHandle =
- scheduler.scheduleAtFixedRate(reader, 3, 3, TimeUnit.SECONDS);
-
- @Override
- public void init(String conf) {
- conn = GraphDBConnection.getInstance(conf);
- }
-
- public void finalize() {
- close();
- }
-
- @Override
- public void close() {
- conn.close();
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFlowService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(IFlowService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(IRestApiService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
- restApi = context.getServiceImpl(IRestApiService.class);
- messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY,
- EnumSet.of(OFType.FLOW_MOD),
- OFMESSAGE_DAMPER_TIMEOUT);
- // TODO: An ugly hack!
- String conf = "/tmp/cassandra.titan";
- this.init(conf);
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- restApi.addRestletRoutable(new FlowWebRoutable());
- }
-
- /**
- * Add a flow.
- *
- * Internally, ONOS will automatically register the installer for
- * receiving Flow Path Notifications for that path.
- *
- * @param flowPath the Flow Path to install.
- * @param flowId the return-by-reference Flow ID as assigned internally.
- * @return true on success, otherwise false.
- */
- @Override
- public boolean addFlow(FlowPath flowPath, FlowId flowId) {
-
- //
- // Assign the FlowEntry IDs
- // TODO: This is an ugly hack!
- // The Flow Entry IDs are set to 1000*FlowId + Index
- //
- int i = 1;
- for (FlowEntry flowEntry : flowPath.dataPath().flowEntries()) {
- long id = flowPath.flowId().value() * 1000 + i;
- ++i;
- flowEntry.setFlowEntryId(new FlowEntryId(id));
- }
-
- IFlowPath flowObj = null;
- try {
- if ((flowObj = conn.utils().searchFlowPath(conn, flowPath.flowId()))
- != null) {
- log.debug("Adding FlowPath with FlowId {}: found existing FlowPath",
- flowPath.flowId().toString());
- } else {
- flowObj = conn.utils().newFlowPath(conn);
- log.debug("Adding FlowPath with FlowId {}: creating new FlowPath",
- flowPath.flowId().toString());
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":addFlow FlowId:{} failed",
- flowPath.flowId().toString());
- }
- if (flowObj == null)
- return false;
-
- //
- // Set the Flow key:
- // - flowId
- //
- flowObj.setFlowId(flowPath.flowId().toString());
- flowObj.setType("flow");
-
- //
- // Set the Flow attributes:
- // - flowPath.installerId()
- // - flowPath.dataPath().srcPort()
- // - flowPath.dataPath().dstPort()
- //
- flowObj.setInstallerId(flowPath.installerId().toString());
- flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
- flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
- flowObj.setDstSwitch(flowPath.dataPath().dstPort().dpid().toString());
- flowObj.setDstPort(flowPath.dataPath().dstPort().port().value());
-
- // Flow edges:
- // HeadFE
-
-
- //
- // Flow Entries:
- // flowPath.dataPath().flowEntries()
- //
- for (FlowEntry flowEntry : flowPath.dataPath().flowEntries()) {
- IFlowEntry flowEntryObj = null;
- boolean found = false;
- try {
- if ((flowEntryObj = conn.utils().searchFlowEntry(conn, flowEntry.flowEntryId())) != null) {
- log.debug("Adding FlowEntry with FlowEntryId {}: found existing FlowEntry",
- flowEntry.flowEntryId().toString());
- found = true;
- } else {
- flowEntryObj = conn.utils().newFlowEntry(conn);
- log.debug("Adding FlowEntry with FlowEntryId {}: creating new FlowEntry",
- flowEntry.flowEntryId().toString());
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":addFlow FlowEntryId:{} failed",
- flowEntry.flowEntryId().toString());
- }
- if (flowEntryObj == null)
- return false;
-
- //
- // Set the Flow Entry key:
- // - flowEntry.flowEntryId()
- //
- flowEntryObj.setFlowEntryId(flowEntry.flowEntryId().toString());
- flowEntryObj.setType("flow_entry");
-
- //
- // Set the Flow Entry attributes:
- // - flowEntry.flowEntryMatch()
- // - flowEntry.flowEntryActions()
- // - flowEntry.dpid()
- // - flowEntry.inPort()
- // - flowEntry.outPort()
- // - flowEntry.flowEntryUserState()
- // - flowEntry.flowEntrySwitchState()
- // - flowEntry.flowEntryErrorState()
- //
- flowEntryObj.setSwitchDpid(flowEntry.dpid().toString());
- flowEntryObj.setInPort(flowEntry.inPort().value());
- flowEntryObj.setOutPort(flowEntry.outPort().value());
- // TODO: Hacks with hard-coded state names!
- if (found)
- flowEntryObj.setUserState("FE_USER_MODIFY");
- else
- flowEntryObj.setUserState("FE_USER_ADD");
- flowEntryObj.setSwitchState("FE_SWITCH_NOT_UPDATED");
- //
- // TODO: Take care of the FlowEntryMatch, FlowEntryActions,
- // and FlowEntryErrorState.
- //
-
- // Flow Entries edges:
- // Flow
- // NextFE
- // InPort
- // OutPort
- // Switch
- if (! found)
- flowObj.addFlowEntry(flowEntryObj);
- }
- conn.endTx(Transaction.COMMIT);
-
- //
- // TODO: We need a proper Flow ID allocation mechanism.
- //
- flowId.setValue(flowPath.flowId().value());
- return true;
- }
-
- /**
- * Delete a previously added flow.
- *
- * @param flowId the Flow ID of the flow to delete.
- * @return true on success, otherwise false.
- */
- @Override
- public boolean deleteFlow(FlowId flowId) {
- IFlowPath flowObj = null;
- //
- // We just mark the entries for deletion,
- // and let the switches remove each individual entry after
- // it has been removed from the switches.
- //
- try {
- if ((flowObj = conn.utils().searchFlowPath(conn, flowId))
- != null) {
- log.debug("Deleting FlowPath with FlowId {}: found existing FlowPath",
- flowId.toString());
- } else {
- log.debug("Deleting FlowPath with FlowId {}: FlowPath not found",
- flowId.toString());
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":deleteFlow FlowId:{} failed", flowId.toString());
- }
- if (flowObj == null)
- return true; // OK: No such flow
-
- //
- // Find and mark for deletion all Flow Entries
- //
- Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
- boolean empty = true; // TODO: an ugly hack
- for (IFlowEntry flowEntryObj : flowEntries) {
- empty = false;
- // flowObj.removeFlowEntry(flowEntryObj);
- // conn.utils().removeFlowEntry(conn, flowEntryObj);
- flowEntryObj.setUserState("FE_USER_DELETE");
- flowEntryObj.setSwitchState("FE_SWITCH_NOT_UPDATED");
- }
- // Remove from the database empty flows
- if (empty)
- conn.utils().removeFlowPath(conn, flowObj);
- conn.endTx(Transaction.COMMIT);
-
- return true;
- }
-
- /**
- * Get a previously added flow.
- *
- * @param flowId the Flow ID of the flow to get.
- * @return the Flow Path if found, otherwise null.
- */
- @Override
- public FlowPath getFlow(FlowId flowId) {
- IFlowPath flowObj = null;
- try {
- if ((flowObj = conn.utils().searchFlowPath(conn, flowId))
- != null) {
- log.debug("Get FlowPath with FlowId {}: found existing FlowPath",
- flowId.toString());
- } else {
- log.debug("Get FlowPath with FlowId {}: FlowPath not found",
- flowId.toString());
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":getFlow FlowId:{} failed", flowId.toString());
- }
- if (flowObj == null)
- return null; // Flow not found
-
- //
- // Extract the Flow state
- //
- FlowPath flowPath = extractFlowPath(flowObj);
- conn.endTx(Transaction.COMMIT);
-
- return flowPath;
- }
-
- /**
- * Get all previously added flows by a specific installer for a given
- * data path endpoints.
- *
- * @param installerId the Caller ID of the installer of the flow to get.
- * @param dataPathEndpoints the data path endpoints of the flow to get.
- * @return the Flow Paths if found, otherwise null.
- */
- @Override
- public ArrayList<FlowPath> getAllFlows(CallerId installerId,
- DataPathEndpoints dataPathEndpoints) {
- //
- // TODO: The implementation below is not optimal:
- // We fetch all flows, and then return only the subset that match
- // the query conditions.
- // We should use the appropriate Titan/Gremlin query to filter-out
- // the flows as appropriate.
- //
- ArrayList<FlowPath> allFlows = getAllFlows();
-
- if (allFlows == null) {
- log.debug("Get FlowPaths for installerId{} and dataPathEndpoints{}: no FlowPaths found", installerId, dataPathEndpoints);
- return null;
- }
-
- ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
- for (FlowPath flow : allFlows) {
- //
- // TODO: String-based comparison is sub-optimal.
- // We are using it for now to save us the extra work of
- // implementing the "equals()" and "hashCode()" methods.
- //
- if (! flow.installerId().toString().equals(installerId.toString()))
- continue;
- if (! flow.dataPath().srcPort().toString().equals(dataPathEndpoints.srcPort().toString())) {
- continue;
- }
- if (! flow.dataPath().dstPort().toString().equals(dataPathEndpoints.dstPort().toString())) {
- continue;
- }
- flowPaths.add(flow);
- }
-
- if (flowPaths.isEmpty()) {
- log.debug("Get FlowPaths for installerId{} and dataPathEndpoints{}: no FlowPaths found", installerId, dataPathEndpoints);
- flowPaths = null;
- } else {
- log.debug("Get FlowPaths for installerId{} and dataPathEndpoints{}: FlowPaths are found", installerId, dataPathEndpoints);
- }
-
- return flowPaths;
- }
-
- /**
- * Get all installed flows by all installers for given data path endpoints.
- *
- * @param dataPathEndpoints the data path endpoints of the flows to get.
- * @return the Flow Paths if found, otherwise null.
- */
- @Override
- public ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints) {
- //
- // TODO: The implementation below is not optimal:
- // We fetch all flows, and then return only the subset that match
- // the query conditions.
- // We should use the appropriate Titan/Gremlin query to filter-out
- // the flows as appropriate.
- //
- ArrayList<FlowPath> allFlows = getAllFlows();
-
- if (allFlows == null) {
- log.debug("Get FlowPaths for dataPathEndpoints{}: no FlowPaths found", dataPathEndpoints);
- return null;
- }
-
- ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
- for (FlowPath flow : allFlows) {
- //
- // TODO: String-based comparison is sub-optimal.
- // We are using it for now to save us the extra work of
- // implementing the "equals()" and "hashCode()" methods.
- //
- if (! flow.dataPath().srcPort().toString().equals(dataPathEndpoints.srcPort().toString())) {
- continue;
- }
- if (! flow.dataPath().dstPort().toString().equals(dataPathEndpoints.dstPort().toString())) {
- continue;
- }
- flowPaths.add(flow);
- }
-
- if (flowPaths.isEmpty()) {
- log.debug("Get FlowPaths for dataPathEndpoints{}: no FlowPaths found", dataPathEndpoints);
- flowPaths = null;
- } else {
- log.debug("Get FlowPaths for dataPathEndpoints{}: FlowPaths are found", dataPathEndpoints);
- }
-
- return flowPaths;
- }
-
- /**
- * Get all installed flows by all installers.
- *
- * @return the Flow Paths if found, otherwise null.
- */
- @Override
- public ArrayList<FlowPath> getAllFlows() {
- Iterable<IFlowPath> flowPathsObj = null;
-
- try {
- if ((flowPathsObj = conn.utils().getAllFlowPaths(conn)) != null) {
- log.debug("Get all FlowPaths: found FlowPaths");
- } else {
- log.debug("Get all FlowPaths: no FlowPaths found");
- }
- } catch (Exception e) {
- // TODO: handle exceptions
- conn.endTx(Transaction.ROLLBACK);
- log.error(":getAllFlowPaths failed");
- }
- if ((flowPathsObj == null) || (flowPathsObj.iterator().hasNext() == false))
- return null; // No Flows found
-
- ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
- for (IFlowPath flowObj : flowPathsObj) {
- //
- // Extract the Flow state
- //
- FlowPath flowPath = extractFlowPath(flowObj);
- flowPaths.add(flowPath);
- }
-
- conn.endTx(Transaction.COMMIT);
-
- return flowPaths;
- }
-
- /**
- * Extract Flow Path State from a Titan Database Object @ref IFlowPath.
- *
- * @param flowObj the object to extract the Flow Path State from.
- * @return the extracted Flow Path State.
- */
- private FlowPath extractFlowPath(IFlowPath flowObj) {
- FlowPath flowPath = new FlowPath();
-
- //
- // Extract the Flow state
- //
- flowPath.setFlowId(new FlowId(flowObj.getFlowId()));
- flowPath.setInstallerId(new CallerId(flowObj.getInstallerId()));
- flowPath.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
- flowPath.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
- flowPath.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch()));
- flowPath.dataPath().dstPort().setPort(new Port(flowObj.getDstPort()));
-
- //
- // Extract all Flow Entries
- //
- Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
- for (IFlowEntry flowEntryObj : flowEntries) {
- FlowEntry flowEntry = new FlowEntry();
- flowEntry.setFlowEntryId(new FlowEntryId(flowEntryObj.getFlowEntryId()));
- flowEntry.setDpid(new Dpid(flowEntryObj.getSwitchDpid()));
- flowEntry.setInPort(new Port(flowEntryObj.getInPort()));
- flowEntry.setOutPort(new Port(flowEntryObj.getOutPort()));
- String userState = flowEntryObj.getUserState();
- flowEntry.setFlowEntryUserState(FlowEntryUserState.valueOf(userState));
- String switchState = flowEntryObj.getSwitchState();
- flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.valueOf(switchState));
- //
- // TODO: Take care of the FlowEntryMatch, FlowEntryActions,
- // and FlowEntryErrorState.
- //
- flowPath.dataPath().flowEntries().add(flowEntry);
- }
-
- return flowPath;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowReconcileManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowReconcileManager.java
index d5d323d..b221b84 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowReconcileManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowReconcileManager.java
@@ -35,7 +35,7 @@
implements IFloodlightModule, IFlowReconcileService {
/** The logger. */
- private static Logger logger =
+ private final static Logger logger =
LoggerFactory.getLogger(FlowReconcileManager.class);
/** Reference to dependent modules */
diff --git a/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java b/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java
deleted file mode 100644
index b159661..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package net.floodlightcontroller.flowcache;
-
-import java.util.ArrayList;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.util.CallerId;
-import net.floodlightcontroller.util.DataPathEndpoints;
-import net.floodlightcontroller.util.FlowId;
-import net.floodlightcontroller.util.FlowPath;
-
-/**
- * @short Interface for providing Flow Service to other modules.
- */
-public interface IFlowService extends IFloodlightService {
- /**
- * Add a flow.
- *
- * Internally, ONOS will automatically register the installer for
- * receiving Flow Path Notifications for that path.
- *
- * @param flowPath the Flow Path to install.
- * @param flowId the return-by-reference Flow ID as assigned internally.
- * @return true on success, otherwise false.
- */
- boolean addFlow(FlowPath flowPath, FlowId flowId);
-
- /**
- * Delete a previously added flow.
- *
- * @param flowId the Flow ID of the flow to delete.
- * @return true on success, otherwise false.
- */
- boolean deleteFlow(FlowId flowId);
-
- /**
- * Get a previously added flow.
- *
- * @param flowId the Flow ID of the flow to get.
- * @return the Flow Path if found, otherwise null.
- */
- FlowPath getFlow(FlowId flowId);
-
- /**
- * Get all previously added flows by a specific installer for a given
- * data path endpoints.
- *
- * @param installerId the Caller ID of the installer of the flow to get.
- * @param dataPathEndpoints the data path endpoints of the flow to get.
- * @return the Flow Paths if found, otherwise null.
- */
- ArrayList<FlowPath> getAllFlows(CallerId installerId,
- DataPathEndpoints dataPathEndpoints);
-
- /**
- * Get all installed flows by all installers for given data path endpoints.
- *
- * @param dataPathEndpoints the data path endpoints of the flows to get.
- * @return the Flow Paths if found, otherwise null.
- */
- ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
-
- /**
- * Get all installed flows by all installers.
- *
- * @return the Flow Paths if found, otherwise null.
- */
- ArrayList<FlowPath> getAllFlows();
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java
deleted file mode 100644
index f418c1e..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.floodlightcontroller.flowcache.web;
-
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.FlowId;
-
-import org.openflow.util.HexString;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeleteFlowResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(DeleteFlowResource.class);
-
- @Get("json")
- public Boolean retrieve() {
- Boolean result = false;
-
- IFlowService flowService =
- (IFlowService)getContext().getAttributes().
- get(IFlowService.class.getCanonicalName());
-
- if (flowService == null) {
- log.debug("ONOS Flow Service not found");
- return result;
- }
-
- // Extract the arguments
- String flowIdStr = (String) getRequestAttributes().get("flow-id");
- FlowId flowId = new FlowId(flowIdStr);
- log.debug("Delete Flow Id: " + flowIdStr);
-
- // Process the request
- result = flowService.deleteFlow(flowId);
- return result;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
deleted file mode 100644
index 34d79c8..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package net.floodlightcontroller.flowcache.web;
-
-import java.util.ArrayList;
-
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.DataPathEndpoints;
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.FlowPath;
-import net.floodlightcontroller.util.Port;
-import net.floodlightcontroller.util.SwitchPort;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GetAllFlowsByEndpointsResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(GetAllFlowsByEndpointsResource.class);
-
- @Get("json")
- public ArrayList<FlowPath> retrieve() {
- ArrayList<FlowPath> result = null;
-
- IFlowService flowService =
- (IFlowService)getContext().getAttributes().
- get(IFlowService.class.getCanonicalName());
-
- if (flowService == null) {
- log.debug("ONOS Flow Service not found");
- return result;
- }
-
- // Extract the arguments
- String srcDpidStr = (String) getRequestAttributes().get("src-dpid");
- String srcPortStr = (String) getRequestAttributes().get("src-port");
- String dstDpidStr = (String) getRequestAttributes().get("dst-dpid");
- String dstPortStr = (String) getRequestAttributes().get("dst-port");
-
- log.debug("Get All Flows Endpoints: " + srcDpidStr + "--" +
- srcPortStr + "--" + dstDpidStr + "--" + dstPortStr);
-
- Dpid srcDpid = new Dpid(srcDpidStr);
- Port srcPort = new Port(Short.parseShort(srcPortStr));
- Dpid dstDpid = new Dpid(dstDpidStr);
- Port dstPort = new Port(Short.parseShort(dstPortStr));
- SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
- SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
- DataPathEndpoints dataPathEndpoints =
- new DataPathEndpoints(srcSwitchPort, dstSwitchPort);
-
- result = flowService.getAllFlows(dataPathEndpoints);
-
- return result;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java
deleted file mode 100644
index e3043dc..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.floodlightcontroller.flowcache.web;
-
-import java.util.ArrayList;
-
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.CallerId;
-import net.floodlightcontroller.util.DataPathEndpoints;
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.FlowPath;
-import net.floodlightcontroller.util.Port;
-import net.floodlightcontroller.util.SwitchPort;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GetAllFlowsByInstallerIdResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(GetAllFlowsByInstallerIdResource.class);
-
- @Get("json")
- public ArrayList<FlowPath> retrieve() {
- ArrayList<FlowPath> result = null;
-
- IFlowService flowService =
- (IFlowService)getContext().getAttributes().
- get(IFlowService.class.getCanonicalName());
-
- if (flowService == null) {
- log.debug("ONOS Flow Service not found");
- return result;
- }
-
- // Extract the arguments
- String installerIdStr = (String) getRequestAttributes().get("installer-id");
- String srcDpidStr = (String) getRequestAttributes().get("src-dpid");
- String srcPortStr = (String) getRequestAttributes().get("src-port");
- String dstDpidStr = (String) getRequestAttributes().get("dst-dpid");
- String dstPortStr = (String) getRequestAttributes().get("dst-port");
-
- log.debug("Get All Flow By Installer: " + installerIdStr +
- " Endpoints: " +
- srcDpidStr + "--" + srcPortStr + "--" +
- dstDpidStr + "--" + dstPortStr);
-
- CallerId installerId = new CallerId(installerIdStr);
- Dpid srcDpid = new Dpid(srcDpidStr);
- Port srcPort = new Port(Short.parseShort(srcPortStr));
- Dpid dstDpid = new Dpid(dstDpidStr);
- Port dstPort = new Port(Short.parseShort(dstPortStr));
- SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
- SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
- DataPathEndpoints dataPathEndpoints =
- new DataPathEndpoints(srcSwitchPort, dstSwitchPort);
-
- result = flowService.getAllFlows(installerId, dataPathEndpoints);
-
- return result;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java
deleted file mode 100644
index 85d5b7e..0000000
--- a/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.floodlightcontroller.flowcache.web;
-
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.FlowId;
-import net.floodlightcontroller.util.FlowPath;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GetFlowByIdResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(GetFlowByIdResource.class);
-
- @Get("json")
- public FlowPath retrieve() {
- FlowPath result = null;
-
- IFlowService flowService =
- (IFlowService)getContext().getAttributes().
- get(IFlowService.class.getCanonicalName());
-
- if (flowService == null) {
- log.debug("ONOS Flow Service not found");
- return result;
- }
-
- // Extract the arguments
- String flowIdStr = (String) getRequestAttributes().get("flow-id");
- FlowId flowId = new FlowId(flowIdStr);
-
- log.debug("Get Flow Id: " + flowIdStr);
-
- result = flowService.getFlow(flowId);
-
- return result;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
index 3fc7ae9..28369eb 100644
--- a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
@@ -59,7 +59,7 @@
@LogMessageCategory("Flow Programming")
public class Forwarding extends ForwardingBase implements IFloodlightModule {
- protected static Logger log = LoggerFactory.getLogger(Forwarding.class);
+ protected final static Logger log = LoggerFactory.getLogger(Forwarding.class);
@Override
@LogMessageDoc(level="ERROR",
diff --git a/src/main/java/net/floodlightcontroller/hub/Hub.java b/src/main/java/net/floodlightcontroller/hub/Hub.java
deleted file mode 100644
index 3618351..0000000
--- a/src/main/java/net/floodlightcontroller/hub/Hub.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.hub;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-import org.openflow.util.U16;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author David Erickson (daviderickson@cs.stanford.edu) - 04/04/10
- */
-public class Hub implements IFloodlightModule, IOFMessageListener {
- protected static Logger log = LoggerFactory.getLogger(Hub.class);
-
- protected IFloodlightProviderService floodlightProvider;
-
- /**
- * @param floodlightProvider the floodlightProvider to set
- */
- public void setFloodlightProvider(IFloodlightProviderService floodlightProvider) {
- this.floodlightProvider = floodlightProvider;
- }
-
- @Override
- public String getName() {
- return Hub.class.getPackage().getName();
- }
-
- public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
- OFPacketIn pi = (OFPacketIn) msg;
- OFPacketOut po = (OFPacketOut) floodlightProvider.getOFMessageFactory()
- .getMessage(OFType.PACKET_OUT);
- po.setBufferId(pi.getBufferId())
- .setInPort(pi.getInPort());
-
- // set actions
- OFActionOutput action = new OFActionOutput()
- .setPort((short) OFPort.OFPP_FLOOD.getValue());
- po.setActions(Collections.singletonList((OFAction)action));
- po.setActionsLength((short) OFActionOutput.MINIMUM_LENGTH);
-
- // set data if is is included in the packetin
- if (pi.getBufferId() == 0xffffffff) {
- byte[] packetData = pi.getPacketData();
- po.setLength(U16.t(OFPacketOut.MINIMUM_LENGTH
- + po.getActionsLength() + packetData.length));
- po.setPacketData(packetData);
- } else {
- po.setLength(U16.t(OFPacketOut.MINIMUM_LENGTH
- + po.getActionsLength()));
- }
- try {
- sw.write(po, cntx);
- } catch (IOException e) {
- log.error("Failure writing PacketOut", e);
- }
-
- return Command.CONTINUE;
- }
-
- @Override
- public boolean isCallbackOrderingPrereq(OFType type, String name) {
- return false;
- }
-
- @Override
- public boolean isCallbackOrderingPostreq(OFType type, String name) {
- return false;
- }
-
- // IFloodlightModule
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- // We don't provide any services, return null
- return null;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- // We don't provide any services, return null
- return null;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- floodlightProvider =
- context.getServiceImpl(IFloodlightProviderService.class);
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/jython/JythonDebugInterface.java b/src/main/java/net/floodlightcontroller/jython/JythonDebugInterface.java
deleted file mode 100644
index 19a97b5..0000000
--- a/src/main/java/net/floodlightcontroller/jython/JythonDebugInterface.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package net.floodlightcontroller.jython;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-public class JythonDebugInterface implements IFloodlightModule {
- protected static Logger log = LoggerFactory.getLogger(JythonDebugInterface.class);
- protected JythonServer debug_server;
- protected static int JYTHON_PORT = 6655;
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- // We don't export services
- return null;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- // We don't export services
- return null;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- // We don't have any dependencies
- return null;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- // no-op
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- Map<String, Object> locals = new HashMap<String, Object>();
- // add all existing module references to the debug server
- for (Class<? extends IFloodlightService> s : context.getAllServices()) {
- // Put only the last part of the name
- String[] bits = s.getCanonicalName().split("\\.");
- String name = bits[bits.length-1];
- locals.put(name, context.getServiceImpl(s));
- }
-
- // read our config options
- Map<String, String> configOptions = context.getConfigParams(this);
- int port = JYTHON_PORT;
- String portNum = configOptions.get("port");
- if (portNum != null) {
- port = Integer.parseInt(portNum);
- }
-
- JythonServer debug_server = new JythonServer(port, locals);
- debug_server.start();
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/jython/JythonServer.java b/src/main/java/net/floodlightcontroller/jython/JythonServer.java
deleted file mode 100644
index fc35b15..0000000
--- a/src/main/java/net/floodlightcontroller/jython/JythonServer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.floodlightcontroller.jython;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.python.util.PythonInterpreter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class starts a thread that runs a jython interpreter that
- * can be used for debug (or even development).
- *
- * @author mandeepdhami
- *
- */
-public class JythonServer extends Thread {
- protected static Logger log = LoggerFactory.getLogger(JythonServer.class);
-
- int port;
- Map<String, Object> locals;
-
- /**
- * @param port_ Port to use for jython server
- * @param locals_ Locals to add to the interpreters top level name space
- */
- public JythonServer(int port_, Map<String, Object> locals_) {
- this.port = port_ ;
- this.locals = locals_;
- if (this.locals == null) {
- this.locals = new HashMap<String, Object>();
- }
- this.locals.put("log", JythonServer.log);
- this.setName("debugserver");
- }
-
- /**
- * The main thread for this class invoked by Thread.run()
- *
- * @see java.lang.Thread#run()
- */
- public void run() {
- PythonInterpreter p = new PythonInterpreter();
- for (String name : this.locals.keySet()) {
- p.set(name, this.locals.get(name));
- }
-
- URL jarUrl = JythonServer.class.getProtectionDomain().getCodeSource().getLocation();
- String jarPath = jarUrl.getPath();
- if (jarUrl.getProtocol().equals("file")) {
- // If URL is of type file, assume that we are in dev env and set path to python dir.
- // else use the jar file as is
- jarPath = jarPath + "../../src/main/python/";
- }
-
- p.exec("import sys");
- p.exec("sys.path.append('" + jarPath + "')");
- p.exec("from debugserver import run_server");
- p.exec("run_server(" + this.port + ", '0.0.0.0', locals())");
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/learningswitch/ILearningSwitchService.java b/src/main/java/net/floodlightcontroller/learningswitch/ILearningSwitchService.java
deleted file mode 100644
index 71f6625..0000000
--- a/src/main/java/net/floodlightcontroller/learningswitch/ILearningSwitchService.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package net.floodlightcontroller.learningswitch;
-
-import java.util.Map;
-
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.types.MacVlanPair;
-
-public interface ILearningSwitchService extends IFloodlightService {
- /**
- * Returns the LearningSwitch's learned host table
- * @return The learned host table
- */
- public Map<IOFSwitch, Map<MacVlanPair,Short>> getTable();
-}
diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
deleted file mode 100644
index 005708d..0000000
--- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-/**
- * Floodlight
- * A BSD licensed, Java based OpenFlow controller
- *
- * Floodlight is a Java based OpenFlow controller originally written by David Erickson at Stanford
- * University. It is available under the BSD license.
- *
- * For documentation, forums, issue tracking and more visit:
- *
- * http://www.openflowhub.org/display/Floodlight/Floodlight+Home
- **/
-
-package net.floodlightcontroller.learningswitch;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.types.MacVlanPair;
-import net.floodlightcontroller.counter.ICounterStoreService;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.restserver.IRestApiService;
-
-import org.openflow.protocol.OFError;
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFFlowRemoved;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-import org.openflow.util.HexString;
-import org.openflow.util.LRULinkedHashMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LearningSwitch
- implements IFloodlightModule, ILearningSwitchService, IOFMessageListener {
- protected static Logger log = LoggerFactory.getLogger(LearningSwitch.class);
-
- // Module dependencies
- protected IFloodlightProviderService floodlightProvider;
- protected ICounterStoreService counterStore;
- protected IRestApiService restApi;
-
- // Stores the learned state for each switch
- protected Map<IOFSwitch, Map<MacVlanPair,Short>> macVlanToSwitchPortMap;
-
- // flow-mod - for use in the cookie
- public static final int LEARNING_SWITCH_APP_ID = 1;
- // LOOK! This should probably go in some class that encapsulates
- // the app cookie management
- public static final int APP_ID_BITS = 12;
- public static final int APP_ID_SHIFT = (64 - APP_ID_BITS);
- public static final long LEARNING_SWITCH_COOKIE = (long) (LEARNING_SWITCH_APP_ID & ((1 << APP_ID_BITS) - 1)) << APP_ID_SHIFT;
-
- // more flow-mod defaults
- protected static final short IDLE_TIMEOUT_DEFAULT = 5;
- protected static final short HARD_TIMEOUT_DEFAULT = 0;
- protected static final short PRIORITY_DEFAULT = 100;
-
- // for managing our map sizes
- protected static final int MAX_MACS_PER_SWITCH = 1000;
-
- // normally, setup reverse flow as well. Disable only for using cbench for comparison with NOX etc.
- protected static final boolean LEARNING_SWITCH_REVERSE_FLOW = true;
-
- /**
- * @param floodlightProvider the floodlightProvider to set
- */
- public void setFloodlightProvider(IFloodlightProviderService floodlightProvider) {
- this.floodlightProvider = floodlightProvider;
- }
-
- @Override
- public String getName() {
- return "learningswitch";
- }
-
- /**
- * Adds a host to the MAC/VLAN->SwitchPort mapping
- * @param sw The switch to add the mapping to
- * @param mac The MAC address of the host to add
- * @param vlan The VLAN that the host is on
- * @param portVal The switchport that the host is on
- */
- protected void addToPortMap(IOFSwitch sw, long mac, short vlan, short portVal) {
- Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw);
-
- if (vlan == (short) 0xffff) {
- // OFMatch.loadFromPacket sets VLAN ID to 0xffff if the packet contains no VLAN tag;
- // for our purposes that is equivalent to the default VLAN ID 0
- vlan = 0;
- }
-
- if (swMap == null) {
- // May be accessed by REST API so we need to make it thread safe
- swMap = Collections.synchronizedMap(new LRULinkedHashMap<MacVlanPair,Short>(MAX_MACS_PER_SWITCH));
- macVlanToSwitchPortMap.put(sw, swMap);
- }
- swMap.put(new MacVlanPair(mac, vlan), portVal);
- }
-
- /**
- * Removes a host from the MAC/VLAN->SwitchPort mapping
- * @param sw The switch to remove the mapping from
- * @param mac The MAC address of the host to remove
- * @param vlan The VLAN that the host is on
- */
- protected void removeFromPortMap(IOFSwitch sw, long mac, short vlan) {
- if (vlan == (short) 0xffff) {
- vlan = 0;
- }
- Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw);
- if (swMap != null)
- swMap.remove(new MacVlanPair(mac, vlan));
- }
-
- /**
- * Get the port that a MAC/VLAN pair is associated with
- * @param sw The switch to get the mapping from
- * @param mac The MAC address to get
- * @param vlan The VLAN number to get
- * @return The port the host is on
- */
- public Short getFromPortMap(IOFSwitch sw, long mac, short vlan) {
- if (vlan == (short) 0xffff) {
- vlan = 0;
- }
- Map<MacVlanPair,Short> swMap = macVlanToSwitchPortMap.get(sw);
- if (swMap != null)
- return swMap.get(new MacVlanPair(mac, vlan));
-
- // if none found
- return null;
- }
-
- /**
- * Clears the MAC/VLAN -> SwitchPort map for all switches
- */
- public void clearLearnedTable() {
- macVlanToSwitchPortMap.clear();
- }
-
- /**
- * Clears the MAC/VLAN -> SwitchPort map for a single switch
- * @param sw The switch to clear the mapping for
- */
- public void clearLearnedTable(IOFSwitch sw) {
- Map<MacVlanPair, Short> swMap = macVlanToSwitchPortMap.get(sw);
- if (swMap != null)
- swMap.clear();
- }
-
- @Override
- public synchronized Map<IOFSwitch, Map<MacVlanPair,Short>> getTable() {
- return macVlanToSwitchPortMap;
- }
-
- /**
- * Writes a OFFlowMod to a switch.
- * @param sw The switch tow rite the flowmod to.
- * @param command The FlowMod actions (add, delete, etc).
- * @param bufferId The buffer ID if the switch has buffered the packet.
- * @param match The OFMatch structure to write.
- * @param outPort The switch port to output it to.
- */
- private void writeFlowMod(IOFSwitch sw, short command, int bufferId,
- OFMatch match, short outPort) {
- // from openflow 1.0 spec - need to set these on a struct ofp_flow_mod:
- // struct ofp_flow_mod {
- // struct ofp_header header;
- // struct ofp_match match; /* Fields to match */
- // uint64_t cookie; /* Opaque controller-issued identifier. */
- //
- // /* Flow actions. */
- // uint16_t command; /* One of OFPFC_*. */
- // uint16_t idle_timeout; /* Idle time before discarding (seconds). */
- // uint16_t hard_timeout; /* Max time before discarding (seconds). */
- // uint16_t priority; /* Priority level of flow entry. */
- // uint32_t buffer_id; /* Buffered packet to apply to (or -1).
- // Not meaningful for OFPFC_DELETE*. */
- // uint16_t out_port; /* For OFPFC_DELETE* commands, require
- // matching entries to include this as an
- // output port. A value of OFPP_NONE
- // indicates no restriction. */
- // uint16_t flags; /* One of OFPFF_*. */
- // struct ofp_action_header actions[0]; /* The action length is inferred
- // from the length field in the
- // header. */
- // };
-
- OFFlowMod flowMod = (OFFlowMod) floodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD);
- flowMod.setMatch(match);
- flowMod.setCookie(LearningSwitch.LEARNING_SWITCH_COOKIE);
- flowMod.setCommand(command);
- flowMod.setIdleTimeout(LearningSwitch.IDLE_TIMEOUT_DEFAULT);
- flowMod.setHardTimeout(LearningSwitch.HARD_TIMEOUT_DEFAULT);
- flowMod.setPriority(LearningSwitch.PRIORITY_DEFAULT);
- flowMod.setBufferId(bufferId);
- flowMod.setOutPort((command == OFFlowMod.OFPFC_DELETE) ? outPort : OFPort.OFPP_NONE.getValue());
- flowMod.setFlags((command == OFFlowMod.OFPFC_DELETE) ? 0 : (short) (1 << 0)); // OFPFF_SEND_FLOW_REM
-
- // set the ofp_action_header/out actions:
- // from the openflow 1.0 spec: need to set these on a struct ofp_action_output:
- // uint16_t type; /* OFPAT_OUTPUT. */
- // uint16_t len; /* Length is 8. */
- // uint16_t port; /* Output port. */
- // uint16_t max_len; /* Max length to send to controller. */
- // type/len are set because it is OFActionOutput,
- // and port, max_len are arguments to this constructor
- flowMod.setActions(Arrays.asList((OFAction) new OFActionOutput(outPort, (short) 0xffff)));
- flowMod.setLength((short) (OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));
-
- if (log.isTraceEnabled()) {
- log.trace("{} {} flow mod {}",
- new Object[]{ sw, (command == OFFlowMod.OFPFC_DELETE) ? "deleting" : "adding", flowMod });
- }
-
- counterStore.updatePktOutFMCounterStore(sw, flowMod);
-
- // and write it out
- try {
- sw.write(flowMod, null);
- } catch (IOException e) {
- log.error("Failed to write {} to switch {}", new Object[]{ flowMod, sw }, e);
- }
- }
-
- /**
- * Writes an OFPacketOut message to a switch.
- * @param sw The switch to write the PacketOut to.
- * @param packetInMessage The corresponding PacketIn.
- * @param egressPort The switchport to output the PacketOut.
- */
- private void writePacketOutForPacketIn(IOFSwitch sw,
- OFPacketIn packetInMessage,
- short egressPort) {
- // from openflow 1.0 spec - need to set these on a struct ofp_packet_out:
- // uint32_t buffer_id; /* ID assigned by datapath (-1 if none). */
- // uint16_t in_port; /* Packet's input port (OFPP_NONE if none). */
- // uint16_t actions_len; /* Size of action array in bytes. */
- // struct ofp_action_header actions[0]; /* Actions. */
- /* uint8_t data[0]; */ /* Packet data. The length is inferred
- from the length field in the header.
- (Only meaningful if buffer_id == -1.) */
-
- OFPacketOut packetOutMessage = (OFPacketOut) floodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT);
- short packetOutLength = (short)OFPacketOut.MINIMUM_LENGTH; // starting length
-
- // Set buffer_id, in_port, actions_len
- packetOutMessage.setBufferId(packetInMessage.getBufferId());
- packetOutMessage.setInPort(packetInMessage.getInPort());
- packetOutMessage.setActionsLength((short)OFActionOutput.MINIMUM_LENGTH);
- packetOutLength += OFActionOutput.MINIMUM_LENGTH;
-
- // set actions
- List<OFAction> actions = new ArrayList<OFAction>(1);
- actions.add(new OFActionOutput(egressPort, (short) 0));
- packetOutMessage.setActions(actions);
-
- // set data - only if buffer_id == -1
- if (packetInMessage.getBufferId() == OFPacketOut.BUFFER_ID_NONE) {
- byte[] packetData = packetInMessage.getPacketData();
- packetOutMessage.setPacketData(packetData);
- packetOutLength += (short)packetData.length;
- }
-
- // finally, set the total length
- packetOutMessage.setLength(packetOutLength);
-
- // and write it out
- try {
- counterStore.updatePktOutFMCounterStore(sw, packetOutMessage);
- sw.write(packetOutMessage, null);
- } catch (IOException e) {
- log.error("Failed to write {} to switch {}: {}", new Object[]{ packetOutMessage, sw, e });
- }
- }
-
- /**
- * Processes a OFPacketIn message. If the switch has learned the MAC/VLAN to port mapping
- * for the pair it will write a FlowMod for. If the mapping has not been learned the
- * we will flood the packet.
- * @param sw
- * @param pi
- * @param cntx
- * @return
- */
- private Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
- // Read in packet data headers by using OFMatch
- OFMatch match = new OFMatch();
- match.loadFromPacket(pi.getPacketData(), pi.getInPort());
- Long sourceMac = Ethernet.toLong(match.getDataLayerSource());
- Long destMac = Ethernet.toLong(match.getDataLayerDestination());
- Short vlan = match.getDataLayerVirtualLan();
- if ((destMac & 0xfffffffffff0L) == 0x0180c2000000L) {
- if (log.isTraceEnabled()) {
- log.trace("ignoring packet addressed to 802.1D/Q reserved addr: switch {} vlan {} dest MAC {}",
- new Object[]{ sw, vlan, HexString.toHexString(destMac) });
- }
- return Command.STOP;
- }
- if ((sourceMac & 0x010000000000L) == 0) {
- // If source MAC is a unicast address, learn the port for this MAC/VLAN
- this.addToPortMap(sw, sourceMac, vlan, pi.getInPort());
- }
-
- // Now output flow-mod and/or packet
- Short outPort = getFromPortMap(sw, destMac, vlan);
- if (outPort == null) {
- // If we haven't learned the port for the dest MAC/VLAN, flood it
- // Don't flood broadcast packets if the broadcast is disabled.
- // XXX For LearningSwitch this doesn't do much. The sourceMac is removed
- // from port map whenever a flow expires, so you would still see
- // a lot of floods.
- this.writePacketOutForPacketIn(sw, pi, OFPort.OFPP_FLOOD.getValue());
- } else if (outPort == match.getInputPort()) {
- log.trace("ignoring packet that arrived on same port as learned destination:"
- + " switch {} vlan {} dest MAC {} port {}",
- new Object[]{ sw, vlan, HexString.toHexString(destMac), outPort });
- } else {
- // Add flow table entry matching source MAC, dest MAC, VLAN and input port
- // that sends to the port we previously learned for the dest MAC/VLAN. Also
- // add a flow table entry with source and destination MACs reversed, and
- // input and output ports reversed. When either entry expires due to idle
- // timeout, remove the other one. This ensures that if a device moves to
- // a different port, a constant stream of packets headed to the device at
- // its former location does not keep the stale entry alive forever.
- // FIXME: current HP switches ignore DL_SRC and DL_DST fields, so we have to match on
- // NW_SRC and NW_DST as well
- match.setWildcards(((Integer)sw.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).intValue()
- & ~OFMatch.OFPFW_IN_PORT
- & ~OFMatch.OFPFW_DL_VLAN & ~OFMatch.OFPFW_DL_SRC & ~OFMatch.OFPFW_DL_DST
- & ~OFMatch.OFPFW_NW_SRC_MASK & ~OFMatch.OFPFW_NW_DST_MASK);
- this.writeFlowMod(sw, OFFlowMod.OFPFC_ADD, pi.getBufferId(), match, outPort);
- if (LEARNING_SWITCH_REVERSE_FLOW) {
- this.writeFlowMod(sw, OFFlowMod.OFPFC_ADD, -1, match.clone()
- .setDataLayerSource(match.getDataLayerDestination())
- .setDataLayerDestination(match.getDataLayerSource())
- .setNetworkSource(match.getNetworkDestination())
- .setNetworkDestination(match.getNetworkSource())
- .setTransportSource(match.getTransportDestination())
- .setTransportDestination(match.getTransportSource())
- .setInputPort(outPort),
- match.getInputPort());
- }
- }
- return Command.CONTINUE;
- }
-
- /**
- * Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
- * the switch's table.
- * @param sw The switch that sent the flow removed message.
- * @param flowRemovedMessage The flow removed message.
- * @return Whether to continue processing this message or stop.
- */
- private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
- if (flowRemovedMessage.getCookie() != LearningSwitch.LEARNING_SWITCH_COOKIE) {
- return Command.CONTINUE;
- }
- if (log.isTraceEnabled()) {
- log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
- }
- OFMatch match = flowRemovedMessage.getMatch();
- // When a flow entry expires, it means the device with the matching source
- // MAC address and VLAN either stopped sending packets or moved to a different
- // port. If the device moved, we can't know where it went until it sends
- // another packet, allowing us to re-learn its port. Meanwhile we remove
- // it from the macVlanToPortMap to revert to flooding packets to this device.
- this.removeFromPortMap(sw, Ethernet.toLong(match.getDataLayerSource()),
- match.getDataLayerVirtualLan());
-
- // Also, if packets keep coming from another device (e.g. from ping), the
- // corresponding reverse flow entry will never expire on its own and will
- // send the packets to the wrong port (the matching input port of the
- // expired flow entry), so we must delete the reverse entry explicitly.
- this.writeFlowMod(sw, OFFlowMod.OFPFC_DELETE, -1, match.clone()
- .setWildcards(((Integer)sw.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).intValue()
- & ~OFMatch.OFPFW_DL_VLAN & ~OFMatch.OFPFW_DL_SRC & ~OFMatch.OFPFW_DL_DST
- & ~OFMatch.OFPFW_NW_SRC_MASK & ~OFMatch.OFPFW_NW_DST_MASK)
- .setDataLayerSource(match.getDataLayerDestination())
- .setDataLayerDestination(match.getDataLayerSource())
- .setNetworkSource(match.getNetworkDestination())
- .setNetworkDestination(match.getNetworkSource())
- .setTransportSource(match.getTransportDestination())
- .setTransportDestination(match.getTransportSource()),
- match.getInputPort());
- return Command.CONTINUE;
- }
-
- // IOFMessageListener
-
- @Override
- public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
- switch (msg.getType()) {
- case PACKET_IN:
- return this.processPacketInMessage(sw, (OFPacketIn) msg, cntx);
- case FLOW_REMOVED:
- return this.processFlowRemovedMessage(sw, (OFFlowRemoved) msg);
- case ERROR:
- log.info("received an error {} from switch {}", (OFError) msg, sw);
- return Command.CONTINUE;
- default:
- break;
- }
- log.error("received an unexpected message {} from switch {}", msg, sw);
- return Command.CONTINUE;
- }
-
- @Override
- public boolean isCallbackOrderingPrereq(OFType type, String name) {
- return false;
- }
-
- @Override
- public boolean isCallbackOrderingPostreq(OFType type, String name) {
- return false;
- }
-
- // IFloodlightModule
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(ILearningSwitchService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(ILearningSwitchService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(ICounterStoreService.class);
- l.add(IRestApiService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- macVlanToSwitchPortMap =
- new ConcurrentHashMap<IOFSwitch, Map<MacVlanPair,Short>>();
- floodlightProvider =
- context.getServiceImpl(IFloodlightProviderService.class);
- counterStore =
- context.getServiceImpl(ICounterStoreService.class);
- restApi =
- context.getServiceImpl(IRestApiService.class);
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
- floodlightProvider.addOFMessageListener(OFType.FLOW_REMOVED, this);
- floodlightProvider.addOFMessageListener(OFType.ERROR, this);
- restApi.addRestletRoutable(new LearningSwitchWebRoutable());
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchTable.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchTable.java
deleted file mode 100644
index 19f8bf5..0000000
--- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchTable.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.floodlightcontroller.learningswitch;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.types.MacVlanPair;
-
-import org.openflow.util.HexString;
-import org.restlet.data.Status;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LearningSwitchTable extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(LearningSwitchTable.class);
-
- protected Map<String, Object> formatTableEntry(MacVlanPair key, short port) {
- Map<String, Object> entry = new HashMap<String, Object>();
- entry.put("mac", HexString.toHexString(key.mac));
- entry.put("vlan", key.vlan);
- entry.put("port", port);
- return entry;
- }
-
- protected List<Map<String, Object>> getOneSwitchTable(Map<MacVlanPair, Short> switchMap) {
- List<Map<String, Object>> switchTable = new ArrayList<Map<String, Object>>();
- for (Entry<MacVlanPair, Short> entry : switchMap.entrySet()) {
- switchTable.add(formatTableEntry(entry.getKey(), entry.getValue()));
- }
- return switchTable;
- }
-
- @Get("json")
- public Map<String, List<Map<String, Object>>> getSwitchTableJson() {
- ILearningSwitchService lsp =
- (ILearningSwitchService)getContext().getAttributes().
- get(ILearningSwitchService.class.getCanonicalName());
-
- Map<IOFSwitch, Map<MacVlanPair,Short>> table = lsp.getTable();
- Map<String, List<Map<String, Object>>> allSwitchTableJson = new HashMap<String, List<Map<String, Object>>>();
-
- String switchId = (String) getRequestAttributes().get("switch");
- if (switchId.toLowerCase().equals("all")) {
- for (IOFSwitch sw : table.keySet()) {
- allSwitchTableJson.put(HexString.toHexString(sw.getId()), getOneSwitchTable(table.get(sw)));
- }
- } else {
- try {
- IFloodlightProviderService floodlightProvider =
- (IFloodlightProviderService)getContext().getAttributes().
- get(IFloodlightProviderService.class.getCanonicalName());
- long dpid = HexString.toLong(switchId);
- IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
- allSwitchTableJson.put(HexString.toHexString(sw.getId()), getOneSwitchTable(table.get(sw)));
- } catch (NumberFormatException e) {
- log.error("Could not decode switch ID = " + switchId);
- setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
- }
- }
-
- return allSwitchTableJson;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchWebRoutable.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchWebRoutable.java
deleted file mode 100644
index 76c30cb..0000000
--- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitchWebRoutable.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.floodlightcontroller.learningswitch;
-
-import org.restlet.Context;
-import org.restlet.Restlet;
-import org.restlet.routing.Router;
-
-import net.floodlightcontroller.restserver.RestletRoutable;
-
-public class LearningSwitchWebRoutable implements RestletRoutable {
-
- @Override
- public Restlet getRestlet(Context context) {
- Router router = new Router(context);
- router.attach("/table/{switch}/json", LearningSwitchTable.class);
- return router;
- }
-
- @Override
- public String basePath() {
- return "/wm/learningswitch";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkStorage.java b/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkStorage.java
deleted file mode 100644
index eb2fac9..0000000
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkStorage.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package net.floodlightcontroller.linkdiscovery;
-
-import java.util.List;
-
-import net.floodlightcontroller.core.INetMapStorage;
-import net.floodlightcontroller.routing.Link;
-
-public interface ILinkStorage extends INetMapStorage {
-
- /*
- * Link creation
- */
- public void update(Link link, DM_OPERATION op);
- public void update(Link link, LinkInfo linkinfo, DM_OPERATION op);
- public void update(List<Link> List, DM_OPERATION op);
-
- /*
- * Add Linkinfo
- */
- public void addOrUpdateLink (Link link, LinkInfo linkinfo, DM_OPERATION op);
-
- /*
- * Delete a single link
- */
- public void deleteLink(Link link);
-
- /*
- * Delete links associated with dpid and port
- * If only dpid is used, All links associated for switch are removed
- * Useful for port up/down and also switch join/remove events
- */
- public void deleteLinksOnPort(Long dpid, short port);
-
- /*
- * Delete a list of links
- */
- public void deleteLinks(List<Link> links);
-
- /*
- * Get Links from Storage
- * If dpid and port both are specified specific link is retrieved
- * If only dpid is set all links associated with Switch are retrieved
- */
- public List<Link> getLinks(Long dpid, short port);
- public List<Link> getLinks(String dpid);
- public List<Link> getActiveLinks();
-
- /*
- * Init with Storage conf
- */
- public void init(String conf);
-
-}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
deleted file mode 100644
index 503f2f3..0000000
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ /dev/null
@@ -1,284 +0,0 @@
-package net.floodlightcontroller.linkdiscovery.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoSwitchService;
-import net.floodlightcontroller.core.internal.TopoSwitchServiceImpl;
-import net.floodlightcontroller.linkdiscovery.ILinkStorage;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
-import net.floodlightcontroller.routing.Link;
-
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.thinkaurelius.titan.core.TitanException;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Direction;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.Edge;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-import com.tinkerpop.pipes.PipeFunction;
-import com.tinkerpop.pipes.transform.PathPipe;
-
-public class LinkStorageImpl implements ILinkStorage {
- public TitanGraph graph;
- protected static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
-
- @Override
- public void update(Link link, DM_OPERATION op) {
- update(link, (LinkInfo)null, op);
- }
-
- @Override
- public void update(List<Link> links, DM_OPERATION op) {
- for (Link lt: links) {
- update(lt, (LinkInfo)null, op);
- }
- }
-
- @Override
- public void update(Link link, LinkInfo linkinfo, DM_OPERATION op) {
- switch (op) {
- case UPDATE:
- break;
- case CREATE:
- case INSERT:
- addOrUpdateLink(link, linkinfo, op);
- break;
- case DELETE:
- deleteLink(link);
- break;
- }
- }
-
- private Vertex getPortVertex(String dpid, short port) {
- Vertex vsw, vport = null;
- if ((vsw = graph.getVertices("dpid", dpid).iterator().next()) != null) {
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- pipe.start(vsw).out("on").has("number", port);
- if (pipe.hasNext()) {
- vport = pipe.next();
- }
- }
- return vport;
- }
-
- public void addOrUpdateLink(Link lt, LinkInfo linkinfo, DM_OPERATION op) {
- Vertex vportSrc = null, vportDst = null;
-
- log.debug("addOrUpdateLink(): op {} {} {}", new Object[]{op, lt, linkinfo});
-
- try {
- // get source port vertex
- String dpid = HexString.toHexString(lt.getSrc());
- short port = lt.getSrcPort();
- vportSrc = getPortVertex(dpid, port);
-
- // get dest port vertex
- dpid = HexString.toHexString(lt.getDst());
- port = lt.getDstPort();
- vportDst = getPortVertex(dpid, port);
-
- if (vportSrc != null && vportDst != null) {
-
- // check if the link exists
- List<Vertex> currLinks = new ArrayList<Vertex>();
- for (Vertex V : vportSrc.query().direction(Direction.OUT).labels("link").vertices()) {
- currLinks.add(V);
- }
-
- if (currLinks.contains(vportDst)) {
- // TODO: update linkinfo
- if (op.equals(DM_OPERATION.INSERT) || op.equals(DM_OPERATION.CREATE)) {
- log.debug("addOrUpdateLink(): failed link exists {} {} src {} dst {}",
- new Object[]{op, lt, vportSrc, vportDst});
- }
- } else {
- graph.addEdge(null, vportSrc, vportDst, "link");
- graph.stopTransaction(Conclusion.SUCCESS);
- log.debug("addOrUpdateLink(): link added {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
- }
- } else {
- log.error("addOrUpdateLink(): failed invalid vertices {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
- graph.stopTransaction(Conclusion.FAILURE);
- }
- } catch (TitanException e) {
- /*
- * retry till we succeed?
- */
- log.error("addOrUpdateLink(): titan exception {} {} {}", new Object[]{op, lt, e.toString()});
- e.printStackTrace();
- }
- }
-
- @Override
- public void deleteLinks(List<Link> links) {
-
- for (Link lt : links) {
- deleteLink(lt);
- }
- }
-
-
- @Override
- public void deleteLink(Link lt) {
- Vertex vportSrc = null, vportDst = null;
- int count = 0;
-
- log.debug("deleteLink(): {}", lt);
-
- try {
- // get source port vertex
- String dpid = HexString.toHexString(lt.getSrc());
- short port = lt.getSrcPort();
- vportSrc = getPortVertex(dpid, port);
-
- // get dst port vertex
- dpid = HexString.toHexString(lt.getDst());
- port = lt.getDstPort();
- vportDst = getPortVertex(dpid, port);
-
- if (vportSrc != null && vportDst != null) {
- for (Edge e : vportSrc.getEdges(Direction.OUT)) {
- log.debug("deleteLink(): {} in {} out {}",
- new Object[]{e.getLabel(), e.getVertex(Direction.IN), e.getVertex(Direction.OUT)});
- if (e.getLabel().equals("link") && e.getVertex(Direction.IN).equals(vportDst)) {
- graph.removeEdge(e);
- count++;
- }
- }
- graph.stopTransaction(Conclusion.SUCCESS);
- log.debug("deleteLink(): deleted {} edges {} src {} dst {}", new Object[]{
- count, lt, vportSrc, vportDst});
-
- } else {
- log.error("deleteLink(): failed invalid vertices {} src {} dst {}", new Object[]{lt, vportSrc, vportDst});
- graph.stopTransaction(Conclusion.FAILURE);
- }
-
- } catch (TitanException e) {
- /*
- * retry till we succeed?
- */
- log.error("deleteLink(): titan exception {} {}", new Object[]{lt, e.toString()});
- e.printStackTrace();
- }
- }
-
- // TODO: Fix me
- @Override
- public List<Link> getLinks(Long dpid, short port) {
- Vertex vportSrc, vportDst;
- List<Link> links = null;
- Link lt;
-
- vportSrc = getPortVertex(HexString.toHexString(dpid), port);
- if (vportSrc != null) {
- for (Edge e : vportSrc.getEdges(Direction.OUT)) {
- if (e.getLabel().equals("link")) {
- break;
- }
- }
- }
- return null;
- }
-
- @Override
- public void init(String conf) {
- //TODO extract the DB location from properties
-
- graph = TitanFactory.open(conf);
-
- // FIXME: These keys are not needed for Links but we better create it before using it as per titan
- Set<String> s = graph.getIndexedKeys(Vertex.class);
- if (!s.contains("dpid")) {
- graph.createKeyIndex("dpid", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- if (!s.contains("type")) {
- graph.createKeyIndex("type", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- }
-
- @Override
- public void deleteLinksOnPort(Long dpid, short port) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public List<Link> getLinks(String dpid) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<Link> getActiveLinks() {
-
- ITopoSwitchService swService = new TopoSwitchServiceImpl();
-
- Iterable<ISwitchObject> switches = swService.getActiveSwitches();
-
- List<Link> links = new ArrayList<Link>();
- for (ISwitchObject sw : switches) {
- GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
- ExtractLink extractor = new ExtractLink();
-
- pipe.start(sw.asVertex());
- pipe.enablePath(true);
- pipe.out("on").out("link").in("on").path().step(extractor);
-
- while (pipe.hasNext() ) {
- Link l = pipe.next();
- links.add(l);
- }
-
- }
- return links;
- }
-
- static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
-
- @Override
- public Link compute(PathPipe<Vertex> pipe ) {
- // TODO Auto-generated method stub
- long s_dpid = 0;
- long d_dpid = 0;
- short s_port = 0;
- short d_port = 0;
- List<Vertex> V = new ArrayList<Vertex>();
- V = pipe.next();
- Vertex src_sw = V.get(0);
- Vertex dest_sw = V.get(3);
- Vertex src_port = V.get(1);
- Vertex dest_port = V.get(2);
- s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
- d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
- s_port = (Short) src_port.getProperty("number");
- d_port = (Short) dest_port.getProperty("number");
-
- Link l = new Link(s_dpid,s_port,d_dpid,d_port);
-
- return l;
- }
- }
-
- public void finalize() {
- close();
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
- graph.shutdown();
- }
-
-
-}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
deleted file mode 100644
index c452fcd..0000000
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.floodlightcontroller.linkdiscovery.internal;
-
-import java.util.List;
-
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoLinkService;
-import net.floodlightcontroller.routing.Link;
-
-public class TopoLinkServiceImpl implements ITopoLinkService {
-
- ThreadLocal<LinkStorageImpl> store = new ThreadLocal<LinkStorageImpl>() {
- @Override
- protected LinkStorageImpl initialValue() {
- LinkStorageImpl inStore = new LinkStorageImpl();
- //TODO: Get the file path from global properties
- inStore.init("/tmp/cassandra.titan");
- return inStore;
- }
- };
-
- LinkStorageImpl linkStore = store.get();
- @Override
- public List<Link> getActiveLinks() {
- // TODO Auto-generated method stub
- List<Link> retval = linkStore.getActiveLinks();
- return retval;
- }
-
- @Override
- public List<Link> getLinksOnSwitch(String dpid) {
- // TODO Auto-generated method stub
- return linkStore.getLinks(dpid);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java b/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java
deleted file mode 100644
index 2a66527..0000000
--- a/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package net.floodlightcontroller.onoslistener;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.IOFSwitchListener;
-import net.floodlightcontroller.core.ISwitchStorage;
-import net.floodlightcontroller.core.internal.SwitchStorageImpl;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.floodlightcontroller.devicemanager.IDeviceListener;
-import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.devicemanager.IDeviceStorage;
-import net.floodlightcontroller.devicemanager.internal.DeviceStorageImpl;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-
-public class OnosPublisher implements IDeviceListener, IOFSwitchListener,
- ILinkDiscoveryListener, IFloodlightModule {
-
- protected IDeviceStorage devStore;
- protected static Logger log;
- protected IDeviceService deviceService;
-
- protected static final String DBConfigFile = "dbconf";
-
- @Override
- public void linkDiscoveryUpdate(LDUpdate update) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void addedSwitch(IOFSwitch sw) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void removedSwitch(IOFSwitch sw) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void switchPortChanged(Long switchId) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String getName() {
- return "OnosPublisher";
- }
-
- @Override
- public void deviceAdded(IDevice device) {
- // TODO Auto-generated method stub
- log.debug("{}:deviceAdded(): Adding device {}",this.getClass(),device.getMACAddressString());
- devStore.addDevice(device);
- }
-
- @Override
- public void deviceRemoved(IDevice device) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void deviceMoved(IDevice device) {
- // TODO Auto-generated method stub
- devStore.changeDeviceAttachments(device);
-
- }
-
- @Override
- public void deviceIPV4AddrChanged(IDevice device) {
- // TODO Auto-generated method stub
- devStore.changeDeviceIPv4Address(device);
-
- }
-
- @Override
- public void deviceVlanChanged(IDevice device) {
- // TODO Auto-generated method stub
- }
-
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(IDeviceService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- // TODO Auto-generated method stub
- Map<String, String> configMap = context.getConfigParams(this);
- String conf = configMap.get(DBConfigFile);
-
- log = LoggerFactory.getLogger(OnosPublisher.class);
- deviceService = context.getServiceImpl(IDeviceService.class);
-
- devStore = new DeviceStorageImpl();
- devStore.init(conf);
-
- log.debug("Initializing OnosPublisher module with {}", conf);
-
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // TODO Auto-generated method stub
- deviceService.addListener(this);
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/packet/IPv4.java b/src/main/java/net/floodlightcontroller/packet/IPv4.java
index 01f886d..85f21ca 100644
--- a/src/main/java/net/floodlightcontroller/packet/IPv4.java
+++ b/src/main/java/net/floodlightcontroller/packet/IPv4.java
@@ -31,6 +31,7 @@
*
*/
public class IPv4 extends BasePacket {
+ public static final int ADDRESS_LENGTH = 4;
public static final byte PROTOCOL_ICMP = 0x1;
public static final byte PROTOCOL_TCP = 0x6;
public static final byte PROTOCOL_UDP = 0x11;
diff --git a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerClient.java b/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerClient.java
deleted file mode 100644
index abed853..0000000
--- a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerClient.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package net.floodlightcontroller.packetstreamer;
-
-import net.floodlightcontroller.packetstreamer.thrift.*;
-
-import java.util.List;
-import java.util.ArrayList;
-
-import org.apache.thrift.TException;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransportException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The PacketStreamer Sample Client.
- */
-public class PacketStreamerClient {
- protected static Logger log = LoggerFactory.getLogger(PacketStreamerClient.class);
-
- /**
- * Main function entry point;
- * @param args
- */
- public static void main(String [] args) {
- try {
- int serverPort = Integer.parseInt(System.getProperty("net.floodlightcontroller.packetstreamer.port", "9090"));
- TTransport transport;
- transport = new TFramedTransport(new TSocket("localhost", serverPort));
- transport.open();
-
-
- TProtocol protocol = new TBinaryProtocol(transport);
- PacketStreamer.Client client = new PacketStreamer.Client(protocol);
-
- sendPackets(client, (short)2, OFMessageType.PACKET_IN, true);
- log.debug("Terminate session1");
- client.terminateSession("session1");
-
- transport.close();
- } catch (TException x) {
- x.printStackTrace();
- }
- }
-
- /**
- * Send test packets of the given OFMessageType to the packetstreamer server;
- * @param client Packetstreamer client object
- * @param numPackets number of test packets to be sent
- * @param ofType OFMessageType of the test packets
- * @param sync true if send with synchronous interface, false for asynchronous interface
- * @throws TException
- */
- private static void sendPackets(PacketStreamer.Client client, short numPackets, OFMessageType ofType, boolean sync)
- throws TException {
- while (numPackets-- > 0) {
- Message msg = new Message();
- Packet packet = new Packet();
-
- List<String> sids = new ArrayList<String>();
- sids.add("session1");
- sids.add("session2");
- msg.setSessionIDs(sids);
- packet.setMessageType(ofType);
- long sw_dpid = numPackets/40 + 1;
- packet.setSwPortTuple(new SwitchPortTuple(sw_dpid, (short)(numPackets - (sw_dpid-1)*40)));
-
- String strData = "New data, sequence " + numPackets;
- packet.setData(strData.getBytes());
- msg.setPacket(packet);
-
- try {
- if (sync) {
- client.pushMessageSync(msg);
- log.debug("Send packet sync: " + msg.toString());
- } else {
- client.pushMessageAsync(msg);
- log.debug("Send packet sync: " + msg.toString());
- }
- } catch (TTransportException e) {
- log.error(e.toString());
- }
-
- try {
- Thread.sleep(100);
- } catch (Exception e) {}
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerHandler.java b/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerHandler.java
deleted file mode 100644
index 903295e..0000000
--- a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerHandler.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package net.floodlightcontroller.packetstreamer;
-
-import net.floodlightcontroller.core.annotations.LogMessageCategory;
-import net.floodlightcontroller.core.annotations.LogMessageDoc;
-import net.floodlightcontroller.core.annotations.LogMessageDocs;
-import net.floodlightcontroller.packetstreamer.thrift.*;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The PacketStreamer handler class that implements the service APIs.
- */
-@LogMessageCategory("OpenFlow Message Tracing")
-public class PacketStreamerHandler implements PacketStreamer.Iface {
-
- /**
- * The queue wrapper class that contains the queue for the streamed packets.
- */
- protected class SessionQueue {
- protected BlockingQueue<ByteBuffer> pQueue;
-
- /**
- * The queue wrapper constructor
- */
- public SessionQueue() {
- this.pQueue = new LinkedBlockingQueue<ByteBuffer>();
- }
-
- /**
- * The access method to get to the internal queue.
- */
- public BlockingQueue<ByteBuffer> getQueue() {
- return this.pQueue;
- }
- }
-
- /**
- * The class logger object
- */
- protected static Logger log =
- LoggerFactory.getLogger(PacketStreamerServer.class);
-
- /**
- * A sessionId-to-queue mapping
- */
- protected Map<String, SessionQueue> msgQueues;
-
- /**
- * The handler's constructor
- */
- public PacketStreamerHandler() {
- this.msgQueues = new ConcurrentHashMap<String, SessionQueue>();
- }
-
- /**
- * The implementation for getPackets() function.
- * This is a blocking API.
- *
- * @param sessionid
- * @return A list of packets associated with the session
- */
- @Override
- @LogMessageDocs({
- @LogMessageDoc(level="ERROR",
- message="Interrupted while waiting for session start",
- explanation="The thread was interrupted waiting " +
- "for the packet streamer session to start",
- recommendation=LogMessageDoc.CHECK_CONTROLLER),
- @LogMessageDoc(level="ERROR",
- message="Interrupted while waiting for packets",
- explanation="The thread was interrupted waiting " +
- "for packets",
- recommendation=LogMessageDoc.CHECK_CONTROLLER)
- })
- public List<ByteBuffer> getPackets(String sessionid)
- throws org.apache.thrift.TException {
- List<ByteBuffer> packets = new ArrayList<ByteBuffer>();
- int count = 0;
-
- while (!msgQueues.containsKey(sessionid) && count++ < 100) {
- log.debug("Queue for session {} doesn't exist yet.", sessionid);
- try {
- Thread.sleep(100); // Wait 100 ms to check again.
- } catch (InterruptedException e) {
- log.error("Interrupted while waiting for session start");
- }
- }
-
- if (count < 100) {
- SessionQueue pQueue = msgQueues.get(sessionid);
- BlockingQueue<ByteBuffer> queue = pQueue.getQueue();
- // Block if queue is empty
- try {
- packets.add(queue.take());
- queue.drainTo(packets);
- } catch (InterruptedException e) {
- log.error("Interrupted while waiting for packets");
- }
- }
-
- return packets;
- }
-
- /**
- * The implementation for pushMessageSync() function.
- *
- * @param msg
- * @return 1 for success, 0 for failure
- * @throws TException
- */
- @Override
- @LogMessageDocs({
- @LogMessageDoc(level="ERROR",
- message="Could not push empty message",
- explanation="An empty message was sent to the packet streamer",
- recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG),
- @LogMessageDoc(level="ERROR",
- message="queue for session {sessionId} is null",
- explanation="The queue for the packet streamer session " +
- "is missing",
- recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
- })
-
- public int pushMessageSync(Message msg)
- throws org.apache.thrift.TException {
-
- if (msg == null) {
- log.error("Could not push empty message");
- return 0;
- }
-
- List<String> sessionids = msg.getSessionIDs();
- for (String sid : sessionids) {
- SessionQueue pQueue = null;
-
- if (!msgQueues.containsKey(sid)) {
- pQueue = new SessionQueue();
- msgQueues.put(sid, pQueue);
- } else {
- pQueue = msgQueues.get(sid);
- }
-
- log.debug("pushMessageSync: SessionId: " + sid +
- " Receive a message, " + msg.toString() + "\n");
- ByteBuffer bb = ByteBuffer.wrap(msg.getPacket().getData());
- //ByteBuffer dst = ByteBuffer.wrap(msg.getPacket().toString().getBytes());
- BlockingQueue<ByteBuffer> queue = pQueue.getQueue();
- if (queue != null) {
- if (!queue.offer(bb)) {
- log.error("Failed to queue message for session: " + sid);
- } else {
- log.debug("insert a message to session: " + sid);
- }
- } else {
- log.error("queue for session {} is null", sid);
- }
- }
-
- return 1;
- }
-
- /**
- * The implementation for pushMessageAsync() function.
- *
- * @param msg
- * @throws TException
- */
- @Override
- public void pushMessageAsync(Message msg)
- throws org.apache.thrift.TException {
- pushMessageSync(msg);
- return;
- }
-
- /**
- * The implementation for terminateSession() function.
- * It removes the session to queue association.
- * @param sessionid
- * @throws TException
- */
- @Override
- public void terminateSession(String sessionid)
- throws org.apache.thrift.TException {
- if (!msgQueues.containsKey(sessionid)) {
- return;
- }
-
- SessionQueue pQueue = msgQueues.get(sessionid);
-
- log.debug("terminateSession: SessionId: " + sessionid + "\n");
- String data = "FilterTimeout";
- ByteBuffer bb = ByteBuffer.wrap(data.getBytes());
- BlockingQueue<ByteBuffer> queue = pQueue.getQueue();
- if (queue != null) {
- if (!queue.offer(bb)) {
- log.error("Failed to queue message for session: " + sessionid);
- }
- msgQueues.remove(sessionid);
- } else {
- log.error("queue for session {} is null", sessionid);
- }
- }
-}
-
diff --git a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerServer.java b/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerServer.java
deleted file mode 100644
index 4a425e0..0000000
--- a/src/main/java/net/floodlightcontroller/packetstreamer/PacketStreamerServer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package net.floodlightcontroller.packetstreamer;
-
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.THsHaServer;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TNonblockingServerSocket;
-import org.apache.thrift.transport.TNonblockingServerTransport;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.core.annotations.LogMessageCategory;
-// Generated code
-import net.floodlightcontroller.packetstreamer.thrift.*;
-
-/**
- * The PacketStreamer Server that brokers the packet streaming service.
- */
-@LogMessageCategory("OpenFlow Message Tracing")
-public class PacketStreamerServer {
- protected static Logger log = LoggerFactory.getLogger(PacketStreamerServer.class);
- protected static int port = 9090;
- protected static PacketStreamerHandler handler;
- protected static PacketStreamer.Processor<PacketStreamerHandler> processor;
-
-
- /**
- * Main function entry point;
- * @param args
- */
- public static void main(String [] args) {
- try {
- port = Integer.parseInt(System.getProperty("net.floodlightcontroller.packetstreamer.port", "9090"));
-
- handler = new PacketStreamerHandler();
- processor = new PacketStreamer.Processor<PacketStreamerHandler>(handler);
-
- Runnable simple = new Runnable() {
- public void run() {
- hshaServer(processor);
- }
- };
-
- new Thread(simple).start();
- } catch (Exception x) {
- x.printStackTrace();
- }
- }
-
-
- /**
- * The function to create a thrift Half-Sync and Half-Async Server.
- * @param processor
- */
- public static void hshaServer(PacketStreamer.Processor<PacketStreamerHandler> processor) {
- try {
- TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(port);
- THsHaServer.Args args = new THsHaServer.Args(serverTransport);
- args.processor(processor);
- args.transportFactory(new TFramedTransport.Factory());
- args.protocolFactory(new TBinaryProtocol.Factory(true, true));
- TServer server = new THsHaServer(args);
-
- log.info("Starting the packetstreamer hsha server on port {} ...", port);
- server.serve();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/perfmon/PerfMonDataResource.java b/src/main/java/net/floodlightcontroller/perfmon/PerfMonDataResource.java
index c43708d..297c44e 100644
--- a/src/main/java/net/floodlightcontroller/perfmon/PerfMonDataResource.java
+++ b/src/main/java/net/floodlightcontroller/perfmon/PerfMonDataResource.java
@@ -12,7 +12,7 @@
* @author subrata
*/
public class PerfMonDataResource extends ServerResource {
- protected static Logger logger = LoggerFactory.getLogger(PerfMonDataResource.class);
+ protected final static Logger logger = LoggerFactory.getLogger(PerfMonDataResource.class);
@Get("json")
public CumulativeTimeBucket handleApiQuery() {
diff --git a/src/main/java/net/floodlightcontroller/restclient/RestClient.java b/src/main/java/net/floodlightcontroller/restclient/RestClient.java
deleted file mode 100644
index 07eab45..0000000
--- a/src/main/java/net/floodlightcontroller/restclient/RestClient.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package net.floodlightcontroller.restclient;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class RestClient {
-
- public static void get (String str) {
-
- if (str == null)
- return;
-
- try {
-
- URL url = new URL(str);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("GET");
- conn.setRequestProperty("Accept", "application/json");
-
- if (conn.getResponseCode() != 200) {
- throw new RuntimeException("Failed : HTTP error code : "
- + conn.getResponseCode());
- }
-
- /* Disable reading the output from the server for now
- *
- BufferedReader br = new BufferedReader(new InputStreamReader(
- (conn.getInputStream())));
-
- String output;
- System.out.println("Output from Server .... \n");
- while ((output = br.readLine()) != null) {
- System.out.println(output);
- }
- */
-
- conn.disconnect();
-
- } catch (MalformedURLException e) {
-
- e.printStackTrace();
-
- } catch (IOException e) {
-
- e.printStackTrace();
-
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
index 2ca8483..daf1684 100644
--- a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
+++ b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
@@ -6,12 +6,18 @@
import java.util.List;
import java.util.Map;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+
import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Restlet;
+import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.data.Reference;
import org.restlet.data.Status;
@@ -24,17 +30,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-
public class RestApiServer
implements IFloodlightModule, IRestApiService {
- protected static Logger logger = LoggerFactory.getLogger(RestApiServer.class);
+ protected final static Logger logger = LoggerFactory.getLogger(RestApiServer.class);
protected List<RestletRoutable> restlets;
protected FloodlightModuleContext fmlContext;
protected int restPort = 8080;
+ protected String numThreads = null;
// ***********
// Application
@@ -98,7 +100,11 @@
// Start listening for REST requests
try {
final Component component = new Component();
- component.getServers().add(Protocol.HTTP, restPort);
+ Server server = component.getServers().add(Protocol.HTTP, restPort);
+ if (numThreads != null){
+ logger.debug("Setting number of REST API threads to {}", numThreads);
+ server.getContext().getParameters().add("defaultThreads", numThreads);
+ }
component.getClients().add(Protocol.CLAP);
component.getDefaultHost().attach(this);
component.start();
@@ -179,6 +185,11 @@
restPort = Integer.parseInt(port);
}
logger.debug("REST port set to {}", restPort);
+
+ String numThreads = configOptions.get("dispatcherthreads");
+ if (numThreads != null) {
+ this.numThreads = numThreads;
+ }
}
@Override
diff --git a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
index 22312c1..348a7af 100644
--- a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
+++ b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
@@ -68,7 +68,7 @@
public abstract class ForwardingBase
implements IOFMessageListener, IDeviceListener {
- protected static Logger log =
+ protected final static Logger log =
LoggerFactory.getLogger(ForwardingBase.class);
protected static int OFMESSAGE_DAMPER_CAPACITY = 50000; // TODO: find sweet spot
diff --git a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java b/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
deleted file mode 100644
index 94e4769..0000000
--- a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package net.floodlightcontroller.routing;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import net.floodlightcontroller.core.internal.SwitchStorageImpl;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.floodlightcontroller.util.DataPath;
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.FlowEntry;
-import net.floodlightcontroller.util.Port;
-import net.floodlightcontroller.util.SwitchPort;
-
-import org.openflow.util.HexString;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.Vertex;
-
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TopoRouteService implements IFloodlightModule, ITopoRouteService {
-
- /** The logger. */
- private static Logger log =
- LoggerFactory.getLogger(TopoRouteService.class);
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(ITopoRouteService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(ITopoRouteService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>>
- getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- // TODO: Add the appropriate dependencies
- // l.add(IRestApiService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- // TODO: Add the appropriate initialization
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- // TODO: Add the approprate setup
- }
-
- ThreadLocal<SwitchStorageImpl> store = new ThreadLocal<SwitchStorageImpl>() {
- @Override
- protected SwitchStorageImpl initialValue() {
- SwitchStorageImpl swStore = new SwitchStorageImpl();
- // NOTE: This is the file path from global properties
- swStore.init("/tmp/cassandra.titan");
- return swStore;
- }
- };
-
- SwitchStorageImpl swStore = store.get();
-
- @Override
- public DataPath getShortestPath(SwitchPort src, SwitchPort dest) {
- DataPath result_data_path = new DataPath();
-
- // Initialize the source and destination in the data path to return
- result_data_path.setSrcPort(src);
- result_data_path.setDstPort(dest);
-
- TitanGraph titanGraph = swStore.graph;
-
- String dpid_src = src.dpid().toString();
- String dpid_dest = dest.dpid().toString();
-
- //
- // Implement the Shortest Path between two vertices by using
- // the following Gremlin CLI code:
- // v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path(){it.dpid}{it.number}{it.number}
- // The equivalent code used here is:
- // results = []; v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path().fill(results)
- //
-
- String gremlin = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid}.path().fill(results)";
-
- // Get the source vertex
- Iterator<Vertex> iter = titanGraph.getVertices("dpid", dpid_src).iterator();
- if (! iter.hasNext()) {
- // titanGraph.stopTransaction(Conclusion.SUCCESS);
- return null; // Source vertex not found
- }
- Vertex v_src = iter.next();
-
- // Get the destination vertex
- iter = titanGraph.getVertices("dpid", dpid_dest).iterator();
- if (! iter.hasNext()) {
- // titanGraph.stopTransaction(Conclusion.SUCCESS);
- return null; // Destination vertex not found
- }
- Vertex v_dest = iter.next();
-
- //
- // Test whether we are computing a path from/to the same DPID.
- // If "yes", then just add a single flow entry in the return result.
- // NOTE: The return value will change in the future to return
- // a single hop/entry instead of two. Currently, we need
- // both entries to capture the source and destination ports.
- //
- if (dpid_src.equals(dpid_dest)) {
- FlowEntry flowEntry = new FlowEntry();
- flowEntry.setDpid(src.dpid());
- flowEntry.setInPort(src.port());
- flowEntry.setOutPort(dest.port());
- result_data_path.flowEntries().add(flowEntry);
- // titanGraph.stopTransaction(Conclusion.SUCCESS);
- return result_data_path;
- }
-
- //
- // Implement the Gremlin script and run it
- //
- ScriptEngine engine = new GremlinGroovyScriptEngine();
-
- ArrayList<ArrayList<Vertex>> results = new ArrayList<ArrayList<Vertex>>();
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("g", titanGraph);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("v_src", v_src);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("v_dest", v_dest);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("results", results);
-
- try {
- engine.eval(gremlin);
- } catch (ScriptException e) {
- System.err.println("Caught ScriptException running Gremlin script: " + e.getMessage());
- // titanGraph.stopTransaction(Conclusion.SUCCESS);
- return null;
- }
-
- //
- // Loop through the result and collect the list
- // of <dpid, port> tuples.
- //
- long nodeId = 0;
- short portId = 0;
- Port inPort = new Port(src.port().value());
- Port outPort = new Port();
- for (ArrayList<Vertex> lv : results) {
- int idx = 0;
- for (Vertex v: lv) {
- String type = v.getProperty("type").toString();
- System.out.println("type: " + type);
- if (type.equals("port")) {
- String number = v.getProperty("number").toString();
- System.out.println("number: " + number);
-
- Object obj = v.getProperty("number");
- // String class_str = obj.getClass().toString();
- if (obj instanceof Short) {
- portId = (Short)obj;
- } else if (obj instanceof Integer) {
- Integer int_nodeId = (Integer)obj;
- portId = int_nodeId.shortValue();
- // int int_nodeId = (Integer)obj;
- // portId = (short)int_nodeId.;
- }
- } else if (type.equals("switch")) {
- String dpid = v.getProperty("dpid").toString();
- nodeId = HexString.toLong(dpid);
-
- System.out.println("dpid: " + dpid);
- }
- idx++;
- if (idx == 1) {
- continue;
- }
- int mod = idx % 3;
- if (mod == 0) {
- // Setup the incoming port
- inPort = new Port(portId);
- continue;
- }
- if (mod == 2) {
- // Setup the outgoing port, and add the Flow Entry
- outPort = new Port(portId);
-
- FlowEntry flowEntry = new FlowEntry();
- flowEntry.setDpid(new Dpid(nodeId));
- flowEntry.setInPort(inPort);
- flowEntry.setOutPort(outPort);
- result_data_path.flowEntries().add(flowEntry);
- continue;
- }
- }
-
- if (idx > 0) {
- // Add the last Flow Entry
- FlowEntry flowEntry = new FlowEntry();
- flowEntry.setDpid(new Dpid(nodeId));
- flowEntry.setInPort(inPort);
- flowEntry.setOutPort(dest.port());
- result_data_path.flowEntries().add(flowEntry);
- }
- }
- // titanGraph.stopTransaction(Conclusion.SUCCESS);
- if (result_data_path.flowEntries().size() > 0)
- return result_data_path;
-
- return null;
- }
-
- @Override
- public Boolean routeExists(SwitchPort src, SwitchPort dest) {
- DataPath dataPath = getShortestPath(src, dest);
- if (dataPath != null)
- return true;
- return false;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java
index ba28619..e733843 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java
@@ -47,7 +47,7 @@
*/
@LogMessageCategory("Static Flow Pusher")
public class StaticFlowEntries {
- protected static Logger log = LoggerFactory.getLogger(StaticFlowEntries.class);
+ protected final static Logger log = LoggerFactory.getLogger(StaticFlowEntries.class);
private static class SubActionStruct {
OFAction action;
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
index 4ed59d7..d816d66 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
@@ -55,7 +55,7 @@
public class StaticFlowEntryPusher
implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
IStorageSourceListener, IOFMessageListener, IHAListener {
- protected static Logger log = LoggerFactory.getLogger(StaticFlowEntryPusher.class);
+ protected final static Logger log = LoggerFactory.getLogger(StaticFlowEntryPusher.class);
public static final String StaticFlowName = "staticflowentry";
public static final int STATIC_FLOW_APP_ID = 10;
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/web/ClearStaticFlowEntriesResource.java b/src/main/java/net/floodlightcontroller/staticflowentry/web/ClearStaticFlowEntriesResource.java
index c1d826a..f103e99 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/web/ClearStaticFlowEntriesResource.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/web/ClearStaticFlowEntriesResource.java
@@ -11,7 +11,7 @@
import org.slf4j.LoggerFactory;
public class ClearStaticFlowEntriesResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(ClearStaticFlowEntriesResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(ClearStaticFlowEntriesResource.class);
@Get
public void ClearStaticFlowEntries() {
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/web/ListStaticFlowEntriesResource.java b/src/main/java/net/floodlightcontroller/staticflowentry/web/ListStaticFlowEntriesResource.java
index 0ad778f..2bb53ba 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/web/ListStaticFlowEntriesResource.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/web/ListStaticFlowEntriesResource.java
@@ -14,7 +14,7 @@
import org.slf4j.LoggerFactory;
public class ListStaticFlowEntriesResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(ListStaticFlowEntriesResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(ListStaticFlowEntriesResource.class);
@Get
public Map<String, Map<String, OFFlowMod>> ListStaticFlowEntries() {
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java b/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java
index 3b750ae..2886a58 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java
@@ -40,7 +40,7 @@
*/
@LogMessageCategory("Static Flow Pusher")
public class StaticFlowEntryPusherResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(StaticFlowEntryPusherResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(StaticFlowEntryPusherResource.class);
/**
* Checks to see if the user matches IP information without
diff --git a/src/main/java/net/floodlightcontroller/storage/AbstractStorageSource.java b/src/main/java/net/floodlightcontroller/storage/AbstractStorageSource.java
index aae3962..20d6599 100644
--- a/src/main/java/net/floodlightcontroller/storage/AbstractStorageSource.java
+++ b/src/main/java/net/floodlightcontroller/storage/AbstractStorageSource.java
@@ -49,7 +49,7 @@
@LogMessageCategory("System Database")
public abstract class AbstractStorageSource
implements IStorageSourceService, IFloodlightModule {
- protected static Logger logger = LoggerFactory.getLogger(AbstractStorageSource.class);
+ protected final static Logger logger = LoggerFactory.getLogger(AbstractStorageSource.class);
// Shared instance of the executor to use to execute the storage tasks.
// We make this a single threaded executor, because if we used a thread pool
diff --git a/src/main/java/net/floodlightcontroller/storage/nosql/NoSqlStorageSource.java b/src/main/java/net/floodlightcontroller/storage/nosql/NoSqlStorageSource.java
index d7e5f95..6624932 100644
--- a/src/main/java/net/floodlightcontroller/storage/nosql/NoSqlStorageSource.java
+++ b/src/main/java/net/floodlightcontroller/storage/nosql/NoSqlStorageSource.java
@@ -49,7 +49,7 @@
import net.floodlightcontroller.storage.TypeMismatchStorageException;
public abstract class NoSqlStorageSource extends AbstractStorageSource {
- protected static Logger log = LoggerFactory.getLogger(NoSqlStorageSource.class);
+ protected final static Logger log = LoggerFactory.getLogger(NoSqlStorageSource.class);
public enum ColumnIndexMode { NOT_INDEXED, RANGE_INDEXED, EQUALITY_INDEXED };
diff --git a/src/main/java/net/floodlightcontroller/storage/web/StorageNotifyResource.java b/src/main/java/net/floodlightcontroller/storage/web/StorageNotifyResource.java
index fcfa96f..081c7f9 100644
--- a/src/main/java/net/floodlightcontroller/storage/web/StorageNotifyResource.java
+++ b/src/main/java/net/floodlightcontroller/storage/web/StorageNotifyResource.java
@@ -32,7 +32,7 @@
import org.slf4j.LoggerFactory;
public class StorageNotifyResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(StorageNotifyResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(StorageNotifyResource.class);
@Post("json")
public Map<String,Object> notify(String entity) throws Exception {
diff --git a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
index cc62e82..31032c9 100644
--- a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
+++ b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
@@ -5,7 +5,7 @@
import java.util.Set;
import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
public interface ITopologyService extends IFloodlightService {
diff --git a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
index 6ac8f29..4983529 100644
--- a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
+++ b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
@@ -18,16 +18,6 @@
protected short portId; // switch port id
/**
- * A copy constructor for NodePortTuple.
- *
- * @param other the object to copy the state from.
- */
- public NodePortTuple(NodePortTuple other) {
- this.nodeId = other.nodeId;
- this.portId = other.portId;
- }
-
- /**
* Creates a NodePortTuple
* @param nodeId The DPID of the switch
* @param portId The port of the switch
diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
index 85ac6b8..bda36a6 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
@@ -38,7 +38,7 @@
public static final int MAX_PATH_WEIGHT = Integer.MAX_VALUE - MAX_LINK_WEIGHT - 1;
public static final int PATH_CACHE_SIZE = 1000;
- protected static Logger log = LoggerFactory.getLogger(TopologyInstance.class);
+ protected final static Logger log = LoggerFactory.getLogger(TopologyInstance.class);
protected Map<Long, Set<Short>> switchPorts; // Set of ports for each switch
/** Set of switch ports that are marked as blocked. A set of blocked
diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
index ba17483..3e624e7 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
@@ -28,8 +28,6 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.counter.ICounterStoreService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
import net.floodlightcontroller.packet.BSN;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.LLDP;
@@ -39,6 +37,8 @@
import net.floodlightcontroller.routing.Route;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.web.TopologyWebRoutable;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -61,7 +61,7 @@
IRoutingService, ILinkDiscoveryListener,
IOFMessageListener, IHAListener {
- protected static Logger log = LoggerFactory.getLogger(TopologyManager.class);
+ protected final static Logger log = LoggerFactory.getLogger(TopologyManager.class);
public static final String CONTEXT_TUNNEL_ENABLED =
"com.bigswitch.floodlight.topologymanager.tunnelEnabled";
@@ -871,7 +871,8 @@
if (log.isTraceEnabled()) {
log.trace("Applying update: {}", update);
}
- if (update.getOperation() == UpdateOperation.LINK_UPDATED) {
+ if (update.getOperation() == UpdateOperation.LINK_UPDATED ||
+ update.getOperation() == UpdateOperation.LINK_ADDED ) {
addOrUpdateLink(update.getSrc(), update.getSrcPort(),
update.getDst(), update.getDstPort(),
update.getType());
diff --git a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java b/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
deleted file mode 100644
index 20f39d4..0000000
--- a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.floodlightcontroller.topology.web;
-
-import java.util.List;
-
-import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.floodlightcontroller.routing.IRoutingService;
-import net.floodlightcontroller.routing.Route;
-import net.floodlightcontroller.topology.NodePortTuple;
-import net.floodlightcontroller.util.DataPath;
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.Port;
-import net.floodlightcontroller.util.SwitchPort;
-
-import org.openflow.util.HexString;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RouteResource extends ServerResource {
-
- protected static Logger log = LoggerFactory.getLogger(RouteResource.class);
-
- @Get("json")
- public DataPath retrieve() {
- ITopoRouteService topoRouteService =
- (ITopoRouteService)getContext().getAttributes().
- get(ITopoRouteService.class.getCanonicalName());
- if (topoRouteService == null) {
- log.debug("Topology Route Service not found");
- return null;
- }
-
- String srcDpidStr = (String) getRequestAttributes().get("src-dpid");
- String srcPortStr = (String) getRequestAttributes().get("src-port");
- String dstDpidStr = (String) getRequestAttributes().get("dst-dpid");
- String dstPortStr = (String) getRequestAttributes().get("dst-port");
-
- log.debug( srcDpidStr + "--" + srcPortStr + "--" + dstDpidStr + "--" + dstPortStr);
-
- Dpid srcDpid = new Dpid(srcDpidStr);
- Port srcPort = new Port(Short.parseShort(srcPortStr));
- Dpid dstDpid = new Dpid(dstDpidStr);
- Port dstPort = new Port(Short.parseShort(dstPortStr));
-
- DataPath result =
- topoRouteService.getShortestPath(new SwitchPort(srcDpid, srcPort),
- new SwitchPort(dstDpid, dstPort));
- if (result != null) {
- return result;
- } else {
- log.debug("ERROR! no route found");
- return null;
- }
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
index 7989413..4f844b2 100644
--- a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
@@ -3,8 +3,9 @@
import org.restlet.Context;
import org.restlet.routing.Router;
-import net.floodlightcontroller.linkdiscovery.web.LinksResource;
import net.floodlightcontroller.restserver.RestletRoutable;
+import net.onrc.onos.ofcontroller.linkdiscovery.web.LinksResource;
+import net.onrc.onos.ofcontroller.topology.web.RouteResource;
public class TopologyWebRoutable implements RestletRoutable {
/**
diff --git a/src/main/java/net/floodlightcontroller/util/DataPath.java b/src/main/java/net/floodlightcontroller/util/DataPath.java
deleted file mode 100644
index b2dded6..0000000
--- a/src/main/java/net/floodlightcontroller/util/DataPath.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package net.floodlightcontroller.util;
-
-import java.util.ArrayList;
-
-import net.floodlightcontroller.util.SwitchPort;
-import net.floodlightcontroller.util.FlowEntry;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Data Path.
- */
-public class DataPath {
- private SwitchPort srcPort; // The source port
- private SwitchPort dstPort; // The destination port
- private ArrayList<FlowEntry> flowEntries; // The Flow Entries
-
- /**
- * Default constructor.
- */
- public DataPath() {
- srcPort = new SwitchPort();
- dstPort = new SwitchPort();
- flowEntries = new ArrayList<FlowEntry>();
- }
-
- /**
- * Get the data path source port.
- *
- * @return the data path source port.
- */
- @JsonProperty("srcPort")
- public SwitchPort srcPort() { return srcPort; }
-
- /**
- * Set the data path source port.
- *
- * @param srcPort the data path source port to set.
- */
- @JsonProperty("srcPort")
- public void setSrcPort(SwitchPort srcPort) {
- this.srcPort = srcPort;
- }
-
- /**
- * Get the data path destination port.
- *
- * @return the data path destination port.
- */
- @JsonProperty("dstPort")
- public SwitchPort dstPort() { return dstPort; }
-
- /**
- * Set the data path destination port.
- *
- * @param dstPort the data path destination port to set.
- */
- @JsonProperty("dstPort")
- public void setDstPort(SwitchPort dstPort) {
- this.dstPort = dstPort;
- }
-
- /**
- * Get the data path flow entries.
- *
- * @return the data path flow entries.
- */
- @JsonProperty("flowEntries")
- public ArrayList<FlowEntry> flowEntries() { return flowEntries; }
-
- /**
- * Set the data path flow entries.
- *
- * @param flowEntries the data path flow entries to set.
- */
- @JsonProperty("flowEntries")
- public void setFlowEntries(ArrayList<FlowEntry> flowEntries) {
- this.flowEntries = flowEntries;
- }
-
- /**
- * Convert the data path to a string.
- *
- * The string has the following form:
- * [src=01:01:01:01:01:01:01:01/1111 flowEntry=<entry1> flowEntry=<entry2> flowEntry=<entry3> dst=02:02:02:02:02:02:02:02/2222]
- *
- * @return the data path as a string.
- */
- @Override
- public String toString() {
- String ret = "[src=" + this.srcPort.toString();
-
- for (FlowEntry fe : flowEntries) {
- ret += " flowEntry=" + fe.toString();
- }
- ret += " dst=" + this.dstPort.toString() + "]";
-
- return ret;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntry.java b/src/main/java/net/floodlightcontroller/util/FlowEntry.java
deleted file mode 100644
index efab0cf..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntry.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.FlowEntryActions;
-import net.floodlightcontroller.util.FlowEntryId;
-import net.floodlightcontroller.util.FlowEntryMatch;
-import net.floodlightcontroller.util.FlowEntrySwitchState;
-import net.floodlightcontroller.util.FlowEntryUserState;
-import net.floodlightcontroller.util.Port;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry.
- *
- * NOTE: The specification is incomplete. E.g., the entry needs to
- * support multiple in-ports and multiple out-ports.
- */
-public class FlowEntry {
- private FlowEntryId flowEntryId; // The Flow Entry ID
- private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
- private FlowEntryActions flowEntryActions; // The Flow Entry Actions
- private Dpid dpid; // The Switch DPID
- private Port inPort; // The Switch incoming port
- private Port outPort; // The Switch outgoing port
- private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
- private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
- // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
- private FlowEntryErrorState flowEntryErrorState;
-
- /**
- * Default constructor.
- */
- public FlowEntry() {
- flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
- flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
- }
-
- /**
- * Get the Flow Entry ID.
- *
- * @return the Flow Entry ID.
- */
- @JsonProperty("flowEntryId")
- public FlowEntryId flowEntryId() { return flowEntryId; }
-
- /**
- * Set the Flow Entry ID.
- *
- * @param flowEntryId the Flow Entry ID to set.
- */
- @JsonProperty("flowEntryId")
- public void setFlowEntryId(FlowEntryId flowEntryId) {
- this.flowEntryId = flowEntryId;
- }
-
- /**
- * Get the Flow Entry Match.
- *
- * @return the Flow Entry Match.
- */
- @JsonProperty("flowEntryMatch")
- public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
-
- /**
- * Set the Flow Entry Match.
- *
- * @param flowEntryMatch the Flow Entry Match to set.
- */
- @JsonProperty("flowEntryMatch")
- public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
- this.flowEntryMatch = flowEntryMatch;
- }
-
- /**
- * Get the Flow Entry Actions.
- *
- * @return the Flow Entry Actions.
- */
- @JsonProperty("flowEntryActions")
- public FlowEntryActions flowEntryActions() { return flowEntryActions; }
-
- /**
- * Set the Flow Entry Actions.
- *
- * @param flowEntryActions the Flow Entry Actions to set.
- */
- @JsonProperty("flowEntryActions")
- public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
- this.flowEntryActions = flowEntryActions;
- }
-
- /**
- * Get the Switch DPID.
- *
- * @return the Switch DPID.
- */
- @JsonProperty("dpid")
- public Dpid dpid() { return dpid; }
-
- /**
- * Set the Switch DPID.
- *
- * @param dpid the Switch DPID to set.
- */
- @JsonProperty("dpid")
- public void setDpid(Dpid dpid) {
- this.dpid = dpid;
- }
-
- /**
- * Get the Switch incoming port.
- *
- * @return the Switch incoming port.
- */
- @JsonProperty("inPort")
- public Port inPort() { return inPort; }
-
- /**
- * Set the Switch incoming port.
- *
- * @param inPort the Switch incoming port to set.
- */
- @JsonProperty("inPort")
- public void setInPort(Port inPort) {
- this.inPort = inPort;
- }
-
- /**
- * Get the Switch outgoing port.
- *
- * @return the Switch outgoing port.
- */
- @JsonProperty("outPort")
- public Port outPort() { return outPort; }
-
- /**
- * Set the Switch outgoing port.
- *
- * @param outPort the Switch outgoing port to set.
- */
- @JsonProperty("outPort")
- public void setOutPort(Port outPort) {
- this.outPort = outPort;
- }
-
- /**
- * Get the Flow Entry User state.
- *
- * @return the Flow Entry User state.
- */
- @JsonProperty("flowEntryUserState")
- public FlowEntryUserState flowEntryUserState() {
- return flowEntryUserState;
- }
-
- /**
- * Set the Flow Entry User state.
- *
- * @param flowEntryUserState the Flow Entry User state to set.
- */
- @JsonProperty("flowEntryUserState")
- public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
- this.flowEntryUserState = flowEntryUserState;
- }
-
- /**
- * Get the Flow Entry Switch state.
- *
- * The Flow Entry Error state is used if FlowEntrySwitchState is
- * FE_SWITCH_FAILED.
- *
- * @return the Flow Entry Switch state.
- */
- @JsonProperty("flowEntrySwitchState")
- public FlowEntrySwitchState flowEntrySwitchState() {
- return flowEntrySwitchState;
- }
-
- /**
- * Set the Flow Entry Switch state.
- *
- * The Flow Entry Error state is used if FlowEntrySwitchState is
- * FE_SWITCH_FAILED.
- *
- * @param flowEntrySwitchState the Flow Entry Switch state to set.
- */
- @JsonProperty("flowEntrySwitchState")
- public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
- this.flowEntrySwitchState = flowEntrySwitchState;
- }
-
- /**
- * Get the Flow Entry Error state.
- *
- * @return the Flow Entry Error state.
- */
- @JsonProperty("flowEntryErrorState")
- public FlowEntryErrorState flowEntryErrorState() {
- return flowEntryErrorState;
- }
-
- /**
- * Set the Flow Entry Error state.
- *
- * @param flowEntryErrorState the Flow Entry Error state to set.
- */
- @JsonProperty("flowEntryErrorState")
- public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
- this.flowEntryErrorState = flowEntryErrorState;
- }
-
- /**
- * Convert the flow entry to a string.
- *
- * The string has the following form:
- * [flowEntryId=XXX flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
- * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
- * flowEntryErrorState=XXX]
- * @return the flow entry as a string.
- */
- @Override
- public String toString() {
- String ret = "[flowEntryId=" + this.flowEntryId.toString();
- ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
- ret += " flowEntryActions=" + this.flowEntryActions.toString();
- ret += " dpid=" + this.dpid.toString();
- ret += " inPort=" + this.inPort.toString();
- ret += " outPort=" + this.outPort.toString();
- ret += " flowEntryUserState=" + this.flowEntryUserState;
- ret += " flowEntrySwitchState=" + this.flowEntrySwitchState;
- ret += " flowEntryErrorState=" + this.flowEntryErrorState.toString();
- ret += "]";
-
- return ret;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java b/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java
deleted file mode 100644
index 4d17de8..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.floodlightcontroller.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry set of actions.
- *
- * The Flow Entry set of actions need to be applied to each packet.
- *
- * NOTE: This is just an empty placeholder (for now). The implied action is
- * forwarding on a single port.
- */
-public class FlowEntryActions {
-
- /**
- * Default constructor.
- */
- public FlowEntryActions() {
- }
-
- /**
- * Convert the set of actions to a string.
- *
- * @return the set of actions as a string.
- */
- @Override
- public String toString() {
- String ret = "";
- // TODO: Implement it!
- return ret;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryId.java b/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
deleted file mode 100644
index d322f5e..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.serializers.FlowEntryIdDeserializer;
-import net.floodlightcontroller.util.serializers.FlowEntryIdSerializer;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * The class representing a Flow Entry ID.
- */
-@JsonDeserialize(using=FlowEntryIdDeserializer.class)
-@JsonSerialize(using=FlowEntryIdSerializer.class)
-public class FlowEntryId {
- private long value;
-
- /**
- * Default constructor.
- */
- public FlowEntryId() {
- this.value = 0;
- }
-
- /**
- * Constructor from an integer value.
- *
- * @param value the value to use.
- */
- public FlowEntryId(long value) {
- this.value = value;
- }
-
- /**
- * Constructor from a string.
- *
- * @param value the value to use.
- */
- public FlowEntryId(String value) {
- this.value = Long.decode(value);
- }
-
- /**
- * Get the value of the Flow Entry ID.
- *
- * @return the value of the Flow Entry ID.
- */
- public long value() { return value; }
-
- /**
- * Set the value of the Flow Entry ID.
- *
- * @param value the value to set.
- */
- public void setValue(long value) {
- this.value = value;
- }
-
- /**
- * Convert the Flow Entry ID value to a hexadecimal string.
- *
- * @return the Flow Entry ID value to a hexadecimal string.
- */
- @Override
- public String toString() {
- return "0x" + Long.toHexString(this.value);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java b/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java
deleted file mode 100644
index 9bd3bea..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.MACAddress;
-import net.floodlightcontroller.util.IPv4Net;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry Matching filter.
- *
- * The Flow Entry matching filter that is used to specify
- * the network data that would be forwarded on the data path from
- * the source to the destination. Examples: MAC address (of the
- * sender), IP prefix that includes the destination's IP address, etc.
- *
- * NOTE: The FlowEntryMatch specification below is incomplete: we need
- * more matching fields, we need to indicate which fields need to be
- * matched, etc.
- */
-public class FlowEntryMatch {
- private MACAddress srcMac; // Matching source MAC address
- private MACAddress dstMac; // Matching destination MAC address
- private IPv4Net srcIPv4Net; // Matching source IPv4 prefix
- private IPv4Net dstIPv4Net; // Matching destination IPv4 prefix
-
- /**
- * Default constructor.
- */
- public FlowEntryMatch() {
- }
-
- /**
- * Get the matching source MAC address.
- *
- * @return the matching source MAC address.
- */
- @JsonProperty("srcMac")
- public MACAddress srcMac() { return srcMac; }
-
- /**
- * Set the matching source MAC address.
- *
- * @param srcMac the matching source MAC address to set.
- */
- @JsonProperty("srcMac")
- public void setSrcMac(MACAddress srcMac) {
- this.srcMac = srcMac;
- }
-
- /**
- * Get the matching destination MAC address.
- *
- * @return the matching destination MAC address.
- */
- @JsonProperty("dstMac")
- public MACAddress dstMac() { return dstMac; }
-
- /**
- * Set the matching destination MAC address.
- *
- * @param dstMac the matching destination MAC address to set.
- */
- @JsonProperty("dstMac")
- public void setDstMac(MACAddress dstMac) {
- this.dstMac = dstMac;
- }
-
- /**
- * Get the matching source IPv4 prefix.
- *
- * @return the matching source IPv4 prefix.
- */
- @JsonProperty("srcIPv4Net")
- public IPv4Net srcIPv4Net() { return srcIPv4Net; }
-
- /**
- * Set the matching source IPv4 prefix.
- *
- * @param srcIPv4Net the matching source IPv4 prefix to set.
- */
- @JsonProperty("srcIPv4Net")
- public void setSrcIPv4Net(IPv4Net srcIPv4Net) {
- this.srcIPv4Net = srcIPv4Net;
- }
-
- /**
- * Get the matching destination IPv4 prefix.
- *
- * @return the matching destination IPv4 prefix.
- */
- @JsonProperty("dstIPv4Net")
- public IPv4Net dstIPv4Net() { return dstIPv4Net; }
-
- /**
- * Set the matching destination IPv4 prefix.
- *
- * @param srcIPv4Net the matching destination IPv4 prefix to set.
- */
- @JsonProperty("dstIPv4Net")
- public void setDstIPv4Net(IPv4Net dstIPv4Net) {
- this.dstIPv4Net = dstIPv4Net;
- }
-
- /**
- * Convert the matching filter to a string.
- *
- * The string has the following form:
- * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
- *
- * @return the matching filter as a string.
- */
- @Override
- public String toString() {
- String ret = "[srcMac=" + this.srcMac.toString();
- ret += " dstMac=" + this.dstMac.toString();
- ret += " srcIPv4Net=" + this.srcIPv4Net.toString();
- ret += " dstIPv4Net=" + this.dstIPv4Net.toString();
- ret += "]";
- return ret;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java b/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java
deleted file mode 100644
index 4f9882a..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.floodlightcontroller.util;
-
-/**
- * The Flow Entry state as set by the controller.
- */
-public enum FlowEntrySwitchState {
- FE_SWITCH_UNKNOWN, // Initialization value: state unknown
- FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
- FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
- FE_SWITCH_UPDATED, // Switch updated with this entry
- FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java b/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java
deleted file mode 100644
index 8637b4f..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.floodlightcontroller.util;
-
-/**
- * The Flow Entry state as set by the user (via the ONOS API).
- */
-public enum FlowEntryUserState {
- FE_USER_UNKNOWN, // Initialization value: state unknown
- FE_USER_ADD, // Flow entry that is added
- FE_USER_MODIFY, // Flow entry that is modified
- FE_USER_DELETE // Flow entry that is deleted
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowId.java b/src/main/java/net/floodlightcontroller/util/FlowId.java
deleted file mode 100644
index 297c0c4..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowId.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.serializers.FlowIdDeserializer;
-import net.floodlightcontroller.util.serializers.FlowIdSerializer;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * The class representing a Flow ID.
- */
-@JsonDeserialize(using=FlowIdDeserializer.class)
-@JsonSerialize(using=FlowIdSerializer.class)
-public class FlowId {
- private long value;
-
- /**
- * Default constructor.
- */
- public FlowId() {
- this.value = 0;
- }
-
- /**
- * Constructor from an integer value.
- *
- * @param value the value to use.
- */
- public FlowId(long value) {
- this.value = value;
- }
-
- /**
- * Constructor from a string.
- *
- * @param value the value to use.
- */
- public FlowId(String value) {
- this.value = Long.decode(value);
- }
-
- /**
- * Get the value of the Flow ID.
- *
- * @return the value of the Flow ID.
- */
- public long value() { return value; }
-
- /**
- * Set the value of the Flow ID.
- *
- * @param value the value to set.
- */
- public void setValue(long value) {
- this.value = value;
- }
-
- /**
- * Convert the Flow ID value to a hexadecimal string.
- *
- * @return the Flow ID value to a hexadecimal string.
- */
- @Override
- public String toString() {
- return "0x" + Long.toHexString(this.value);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowPath.java b/src/main/java/net/floodlightcontroller/util/FlowPath.java
deleted file mode 100644
index 11f23fe..0000000
--- a/src/main/java/net/floodlightcontroller/util/FlowPath.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.CallerId;
-import net.floodlightcontroller.util.DataPath;
-import net.floodlightcontroller.util.FlowId;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Path.
- */
-public class FlowPath {
- private FlowId flowId; // The Flow ID
- private CallerId installerId; // The Caller ID of the path installer
- private DataPath dataPath; // The data path
-
- /**
- * Default constructor.
- */
- public FlowPath() {
- dataPath = new DataPath();
- }
-
- /**
- * Get the flow path Flow ID.
- *
- * @return the flow path Flow ID.
- */
- @JsonProperty("flowId")
- public FlowId flowId() { return flowId; }
-
- /**
- * Set the flow path Flow ID.
- *
- * @param flowId the flow path Flow ID to set.
- */
- @JsonProperty("flowId")
- public void setFlowId(FlowId flowId) {
- this.flowId = flowId;
- }
-
- /**
- * Get the Caller ID of the flow path installer.
- *
- * @return the Caller ID of the flow path installer.
- */
- @JsonProperty("installerId")
- public CallerId installerId() { return installerId; }
-
- /**
- * Set the Caller ID of the flow path installer.
- *
- * @param installerId the Caller ID of the flow path installer.
- */
- @JsonProperty("installerId")
- public void setInstallerId(CallerId installerId) {
- this.installerId = installerId;
- }
-
- /**
- * Get the flow path's data path.
- *
- * @return the flow path's data path.
- */
- @JsonProperty("dataPath")
- public DataPath dataPath() { return dataPath; }
-
- /**
- * Set the flow path's data path.
- *
- * @param dataPath the flow path's data path to set.
- */
- @JsonProperty("dataPath")
- public void setDataPath(DataPath dataPath) {
- this.dataPath = dataPath;
- }
-
- /**
- * Convert the flow path to a string.
- *
- * The string has the following form:
- * [flowId=XXX installerId=XXX dataPath=XXX]
- *
- * @return the flow path as a string.
- */
- @Override
- public String toString() {
- String ret = "[flowId=" + this.flowId.toString();
- ret += " installerId=" + this.installerId.toString();
- ret += " dataPath=" + this.dataPath.toString();
- ret += "]";
- return ret;
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/MACAddress.java b/src/main/java/net/floodlightcontroller/util/MACAddress.java
index 4ba9dad..b77d4cc 100644
--- a/src/main/java/net/floodlightcontroller/util/MACAddress.java
+++ b/src/main/java/net/floodlightcontroller/util/MACAddress.java
@@ -2,15 +2,35 @@
import java.util.Arrays;
+import net.onrc.onos.ofcontroller.util.serializers.MACAddressDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.MACAddressSerializer;
+
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
/**
* The class representing MAC address.
*
* @author Sho Shimizu (sho.shimizu@gmail.com)
*/
+@JsonDeserialize(using=MACAddressDeserializer.class)
+@JsonSerialize(using=MACAddressSerializer.class)
public class MACAddress {
public static final int MAC_ADDRESS_LENGTH = 6;
private byte[] address = new byte[MAC_ADDRESS_LENGTH];
+ /**
+ * Default constructor.
+ */
+ public MACAddress() {
+ this.address = new byte[] { 0, 0, 0, 0, 0, 0};
+ }
+
+ /**
+ * Constructor for a given address stored in a byte array.
+ *
+ * @param address the address stored in a byte array.
+ */
public MACAddress(byte[] address) {
this.address = Arrays.copyOf(address, MAC_ADDRESS_LENGTH);
}
diff --git a/src/main/java/net/floodlightcontroller/util/Port.java b/src/main/java/net/floodlightcontroller/util/Port.java
deleted file mode 100644
index 19bbf8f..0000000
--- a/src/main/java/net/floodlightcontroller/util/Port.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.floodlightcontroller.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing a network port of a switch.
- */
-public class Port {
- private short value;
-
- /**
- * Default constructor.
- */
- public Port() {
- this.value = 0;
- }
-
- /**
- * Constructor from another entry.
- *
- * @param other the other entry to use.
- */
- public Port(Port other) {
- this.value = other.value();
- }
-
- /**
- * Constructor from a long value.
- *
- * @param value the value to use.
- */
- public Port(short value) {
- this.value = value;
- }
-
- /**
- * Get the value of the port.
- *
- * @return the value of the port.
- */
- @JsonProperty("value")
- public short value() { return value; }
-
- /**
- * Set the value of the port.
- *
- * @param value the value to set.
- */
- @JsonProperty("value")
- public void setValue(short value) {
- this.value = value;
- }
-
- /**
- * Convert the port value to a string.
- *
- * @return the port value as a string.
- */
- @Override
- public String toString() {
- return Short.toString(this.value);
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/HostResource.java b/src/main/java/net/floodlightcontroller/virtualnetwork/HostResource.java
deleted file mode 100644
index 6021e3d..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/HostResource.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.io.IOException;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.MappingJsonFactory;
-import org.restlet.data.Status;
-import org.restlet.resource.Delete;
-import org.restlet.resource.Put;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class HostResource extends org.restlet.resource.ServerResource {
- protected static Logger log = LoggerFactory.getLogger(HostResource.class);
-
- public class HostDefinition {
- String port = null; // Logical port name
- String guid = null; // Network ID
- String mac = null; // MAC Address
- String attachment = null; // Attachment name
- }
-
- protected void jsonToHostDefinition(String json, HostDefinition host) throws IOException {
- MappingJsonFactory f = new MappingJsonFactory();
- JsonParser jp;
-
- try {
- jp = f.createJsonParser(json);
- } catch (JsonParseException e) {
- throw new IOException(e);
- }
-
- jp.nextToken();
- if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
- throw new IOException("Expected START_OBJECT");
- }
-
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- if (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- throw new IOException("Expected FIELD_NAME");
- }
-
- String n = jp.getCurrentName();
- jp.nextToken();
- if (jp.getText().equals(""))
- continue;
- else if (n.equals("attachment")) {
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String field = jp.getCurrentName();
- if (field.equals("id")) {
- host.attachment = jp.getText();
- } else if (field.equals("mac")) {
- host.mac = jp.getText();
- }
- }
- }
- }
-
- jp.close();
- }
-
- @Put
- public String addHost(String postData) {
- IVirtualNetworkService vns =
- (IVirtualNetworkService)getContext().getAttributes().
- get(IVirtualNetworkService.class.getCanonicalName());
- HostDefinition host = new HostDefinition();
- host.port = (String) getRequestAttributes().get("port");
- host.guid = (String) getRequestAttributes().get("network");
- try {
- jsonToHostDefinition(postData, host);
- } catch (IOException e) {
- log.error("Could not parse JSON {}", e.getMessage());
- }
- vns.addHost(MACAddress.valueOf(host.mac), host.guid, host.port);
- setStatus(Status.SUCCESS_OK);
- return "{\"status\":\"ok\"}";
- }
-
-
- @Delete
- public String deleteHost() {
- String port = (String) getRequestAttributes().get("port");
- IVirtualNetworkService vns =
- (IVirtualNetworkService)getContext().getAttributes().
- get(IVirtualNetworkService.class.getCanonicalName());
- vns.deleteHost(null, port);
- setStatus(Status.SUCCESS_OK);
- return "{\"status\":\"ok\"}";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/IVirtualNetworkService.java b/src/main/java/net/floodlightcontroller/virtualnetwork/IVirtualNetworkService.java
deleted file mode 100644
index 4304a33..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/IVirtualNetworkService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.util.Collection;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.util.MACAddress;
-
-public interface IVirtualNetworkService extends IFloodlightService {
- /**
- * Creates a new virtual network. This can also be called
- * to modify a virtual network. To update a network you specify the GUID
- * and the fields you want to update.
- * @param network The network name. Must be unique.
- * @param guid The ID of the network. Must be unique.
- * @param gateway The IP address of the network gateway, null if none.
- */
- public void createNetwork(String guid, String network, Integer gateway);
-
- /**
- * Deletes a virtual network.
- * @param guid The ID (not name) of virtual network to delete.
- */
- public void deleteNetwork(String guid);
-
- /**
- * Adds a host to a virtual network. If a mapping already exists the
- * new one will override the old mapping.
- * @param mac The MAC address of the host to add.
- * @param network The network to add the host to.
- * @param port The logical port name to attach the host to. Must be unique.
- */
- public void addHost(MACAddress mac, String network, String port);
-
- /**
- * Deletes a host from a virtual network. Either the MAC or Port must
- * be specified.
- * @param mac The MAC address to delete.
- * @param port The logical port the host is attached to.
- */
- public void deleteHost(MACAddress mac, String port);
-
- /**
- * Return list of all virtual networks.
- * @return Collection <VirtualNetwork>
- */
- public Collection <VirtualNetwork> listNetworks();
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/NetworkResource.java b/src/main/java/net/floodlightcontroller/virtualnetwork/NetworkResource.java
deleted file mode 100644
index 2efe52a..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/NetworkResource.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import net.floodlightcontroller.packet.IPv4;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.MappingJsonFactory;
-import org.restlet.data.Status;
-import org.restlet.resource.Delete;
-import org.restlet.resource.Get;
-import org.restlet.resource.Post;
-import org.restlet.resource.Put;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetworkResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(NetworkResource.class);
-
- public class NetworkDefinition {
- public String name = null;
- public String guid = null;
- public String gateway = null;
- }
-
- protected void jsonToNetworkDefinition(String json, NetworkDefinition network) throws IOException {
- MappingJsonFactory f = new MappingJsonFactory();
- JsonParser jp;
-
- try {
- jp = f.createJsonParser(json);
- } catch (JsonParseException e) {
- throw new IOException(e);
- }
-
- jp.nextToken();
- if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
- throw new IOException("Expected START_OBJECT");
- }
-
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- if (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- throw new IOException("Expected FIELD_NAME");
- }
-
- String n = jp.getCurrentName();
- jp.nextToken();
- if (jp.getText().equals(""))
- continue;
- else if (n.equals("network")) {
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String field = jp.getCurrentName();
- if (field.equals("name")) {
- network.name = jp.getText();
- } else if (field.equals("gateway")) {
- String gw = jp.getText();
- if ((gw != null) && (!gw.equals("null")))
- network.gateway = gw;
- } else if (field.equals("id")) {
- network.guid = jp.getText();
- } else {
- log.warn("Unrecognized field {} in " +
- "parsing network definition",
- jp.getText());
- }
- }
- }
- }
-
- jp.close();
- }
-
- @Get("json")
- public Collection <VirtualNetwork> retrieve() {
- IVirtualNetworkService vns =
- (IVirtualNetworkService)getContext().getAttributes().
- get(IVirtualNetworkService.class.getCanonicalName());
-
- return vns.listNetworks();
- }
-
- @Put
- @Post
- public String createNetwork(String postData) {
- NetworkDefinition network = new NetworkDefinition();
- try {
- jsonToNetworkDefinition(postData, network);
- } catch (IOException e) {
- log.error("Could not parse JSON {}", e.getMessage());
- }
-
- // We try to get the ID from the URI only if it's not
- // in the POST data
- if (network.guid == null) {
- String guid = (String) getRequestAttributes().get("network");
- if ((guid != null) && (!guid.equals("null")))
- network.guid = guid;
- }
-
- IVirtualNetworkService vns =
- (IVirtualNetworkService)getContext().getAttributes().
- get(IVirtualNetworkService.class.getCanonicalName());
-
- Integer gw = null;
- if (network.gateway != null) {
- try {
- gw = IPv4.toIPv4Address(network.gateway);
- } catch (IllegalArgumentException e) {
- log.warn("Could not parse gateway {} as IP for network {}, setting as null",
- network.gateway, network.name);
- network.gateway = null;
- }
- }
- vns.createNetwork(network.guid, network.name, gw);
- setStatus(Status.SUCCESS_OK);
- return "{\"status\":\"ok\"}";
- }
-
- @Delete
- public String deleteNetwork() {
- IVirtualNetworkService vns =
- (IVirtualNetworkService)getContext().getAttributes().
- get(IVirtualNetworkService.class.getCanonicalName());
- String guid = (String) getRequestAttributes().get("network");
- vns.deleteNetwork(guid);
- setStatus(Status.SUCCESS_OK);
- return "{\"status\":\"ok\"}";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/NoOp.java b/src/main/java/net/floodlightcontroller/virtualnetwork/NoOp.java
deleted file mode 100644
index a184a95..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/NoOp.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import org.restlet.data.Status;
-import org.restlet.resource.Get;
-import org.restlet.resource.Post;
-import org.restlet.resource.Put;
-import org.restlet.resource.ServerResource;
-
-public class NoOp extends ServerResource {
- /**
- * Does nothing and returns 200 OK with a status message
- * @return status: ok
- */
- @Get
- @Put
- @Post
- public String noOp(String postdata) {
- setStatus(Status.SUCCESS_OK);
- return "{\"status\":\"ok\"}";
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetwork.java b/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetwork.java
deleted file mode 100644
index f5dfb21..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetwork.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import net.floodlightcontroller.util.MACAddress;
-
-/**
- * Data structure for storing and outputing information of a virtual network created
- * by VirtualNetworkFilter
- *
- * @author KC Wang
- */
-
-@JsonSerialize(using=VirtualNetworkSerializer.class)
-public class VirtualNetwork{
- protected String name; // network name
- protected String guid; // network id
- protected String gateway; // network gateway
- protected Collection<MACAddress> hosts; // array of hosts explicitly added to this network
-
- /**
- * Constructor requires network name and id
- * @param name: network name
- * @param guid: network id
- */
- public VirtualNetwork(String name, String guid) {
- this.name = name;
- this.guid = guid;
- this.gateway = null;
- this.hosts = new ArrayList<MACAddress>();
- return;
- }
-
- /**
- * Sets network name
- * @param gateway: IP address as String
- */
- public void setName(String name){
- this.name = name;
- return;
- }
-
- /**
- * Sets network gateway IP address
- * @param gateway: IP address as String
- */
- public void setGateway(String gateway){
- this.gateway = gateway;
- return;
- }
-
- /**
- * Adds a host to this network record
- * @param host: MAC address as MACAddress
- */
- public void addHost(MACAddress host){
- this.hosts.add(host);
- return;
- }
-
- /**
- * Removes a host from this network record
- * @param host: MAC address as MACAddress
- * @return boolean: true: removed, false: host not found
- */
- public boolean removeHost(MACAddress host){
- Iterator<MACAddress> iter = this.hosts.iterator();
- while(iter.hasNext()){
- MACAddress element = iter.next();
- if(element.equals(host) ){
- //assuming MAC address for host is unique
- iter.remove();
- return true;
- }
- }
- return false;
- }
-
- /**
- * Removes all hosts from this network record
- */
- public void clearHosts(){
- this.hosts.clear();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilter.java b/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilter.java
deleted file mode 100644
index 012dfb6..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilter.java
+++ /dev/null
@@ -1,521 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.core.util.AppCookie;
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.floodlightcontroller.devicemanager.IDeviceListener;
-import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.packet.DHCP;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.routing.ForwardingBase;
-import net.floodlightcontroller.util.MACAddress;
-
-/**
- * A simple Layer 2 (MAC based) network virtualization module. This module allows
- * you to create simple L2 networks (host + gateway) and will drop traffic if
- * they are not on the same virtual network.
- *
- * LIMITATIONS
- * - This module does not allow overlapping of IPs or MACs
- * - You can only have 1 gateway per virtual network (can be shared)
- * - There is filtering of multicast/broadcast traffic
- * - All DHCP traffic will be allowed, regardless of unicast/broadcast
- *
- * @author alexreimers
- */
-public class VirtualNetworkFilter
- implements IFloodlightModule, IVirtualNetworkService, IOFMessageListener, IDeviceListener {
- protected static Logger log = LoggerFactory.getLogger(VirtualNetworkFilter.class);
-
- private final short APP_ID = 20;
-
- // Our dependencies
- IFloodlightProviderService floodlightProvider;
- IRestApiService restApi;
- IDeviceService deviceService;
-
- // Our internal state
- protected Map<String, VirtualNetwork> vNetsByGuid; // List of all created virtual networks
- protected Map<String, String> nameToGuid; // Logical name -> Network ID
- protected Map<String, Integer> guidToGateway; // Network ID -> Gateway IP
- protected Map<Integer, Set<String>> gatewayToGuid; // Gateway IP -> Network ID
- protected Map<MACAddress, Integer> macToGateway; // Gateway MAC -> Gateway IP
- protected Map<MACAddress, String> macToGuid; // Host MAC -> Network ID
- protected Map<String, MACAddress> portToMac; // Host MAC -> logical port name
-
- /**
- * Adds a gateway to a virtual network.
- * @param guid The ID (not name) of the network.
- * @param ip The IP addresses of the gateway.
- */
- protected void addGateway(String guid, Integer ip) {
- if (ip.intValue() != 0) {
- if (log.isDebugEnabled())
- log.debug("Adding {} as gateway for GUID {}",
- IPv4.fromIPv4Address(ip), guid);
-
- guidToGateway.put(guid, ip);
- if (vNetsByGuid.get(guid) != null)
- vNetsByGuid.get(guid).setGateway(IPv4.fromIPv4Address(ip));
- if (gatewayToGuid.containsKey(ip)) {
- Set<String> gSet = gatewayToGuid.get(ip);
- gSet.add(guid);
- } else {
- Set<String> gSet = Collections.synchronizedSet(new HashSet<String>());
- gSet.add(guid);
- gatewayToGuid.put(ip, gSet);
- }
- }
- }
-
- /**
- * Deletes a gateway for a virtual network.
- * @param guid The ID (not name) of the network to delete
- * the gateway for.
- */
- protected void deleteGateway(String guid) {
- Integer gwIp = guidToGateway.remove(guid);
- if (gwIp == null) return;
- Set<String> gSet = gatewayToGuid.get(gwIp);
- gSet.remove(guid);
- if(vNetsByGuid.get(guid)!=null)
- vNetsByGuid.get(guid).setGateway(null);
- }
-
- // IVirtualNetworkService
-
- @Override
- public void createNetwork(String guid, String network, Integer gateway) {
- if (log.isDebugEnabled()) {
- String gw = null;
- try {
- gw = IPv4.fromIPv4Address(gateway);
- } catch (Exception e) {
- // fail silently
- }
- log.debug("Creating network {} with ID {} and gateway {}",
- new Object[] {network, guid, gw});
- }
-
- if (!nameToGuid.isEmpty()) {
- // We have to iterate all the networks to handle name/gateway changes
- for (Entry<String, String> entry : nameToGuid.entrySet()) {
- if (entry.getValue().equals(guid)) {
- nameToGuid.remove(entry.getKey());
- break;
- }
- }
- }
- nameToGuid.put(network, guid);
- if (vNetsByGuid.containsKey(guid))
- vNetsByGuid.get(guid).setName(network); //network already exists, just updating name
- else
- vNetsByGuid.put(guid, new VirtualNetwork(network, guid)); //new network
-
- // If they don't specify a new gateway the old one will be preserved
- if ((gateway != null) && (gateway != 0)) {
- addGateway(guid, gateway);
- if(vNetsByGuid.get(guid)!=null)
- vNetsByGuid.get(guid).setGateway(IPv4.fromIPv4Address(gateway));
- }
- }
-
- @Override
- public void deleteNetwork(String guid) {
- String name = null;
- if (nameToGuid.isEmpty()) {
- log.warn("Could not delete network with ID {}, network doesn't exist",
- guid);
- return;
- }
- for (Entry<String, String> entry : nameToGuid.entrySet()) {
- if (entry.getValue().equals(guid)) {
- name = entry.getKey();
- break;
- }
- log.warn("Could not delete network with ID {}, network doesn't exist",
- guid);
- }
-
- if (log.isDebugEnabled())
- log.debug("Deleting network with name {} ID {}", name, guid);
-
- nameToGuid.remove(name);
- deleteGateway(guid);
- if(vNetsByGuid.get(guid)!=null){
- vNetsByGuid.get(guid).clearHosts();
- vNetsByGuid.remove(guid);
- }
- Collection<MACAddress> deleteList = new ArrayList<MACAddress>();
- for (MACAddress host : macToGuid.keySet()) {
- if (macToGuid.get(host).equals(guid)) {
- deleteList.add(host);
- }
- }
- for (MACAddress mac : deleteList) {
- if (log.isDebugEnabled()) {
- log.debug("Removing host {} from network {}",
- HexString.toHexString(mac.toBytes()), guid);
- }
- macToGuid.remove(mac);
- for (Entry<String, MACAddress> entry : portToMac.entrySet()) {
- if (entry.getValue().equals(mac)) {
- portToMac.remove(entry.getKey());
- break;
- }
- }
- }
- }
-
- @Override
- public void addHost(MACAddress mac, String guid, String port) {
- if (guid != null) {
- if (log.isDebugEnabled()) {
- log.debug("Adding {} to network ID {} on port {}",
- new Object[] {mac, guid, port});
- }
- // We ignore old mappings
- macToGuid.put(mac, guid);
- portToMac.put(port, mac);
- if(vNetsByGuid.get(guid)!=null)
- vNetsByGuid.get(guid).addHost(new MACAddress(mac.toBytes()));
- } else {
- log.warn("Could not add MAC {} to network ID {} on port {}, the network does not exist",
- new Object[] {mac, guid, port});
- }
- }
-
- @Override
- public void deleteHost(MACAddress mac, String port) {
- if (log.isDebugEnabled()) {
- log.debug("Removing host {} from port {}", mac, port);
- }
- if (mac == null && port == null) return;
- if (port != null) {
- MACAddress host = portToMac.remove(port);
- if(vNetsByGuid.get(macToGuid.get(host)) != null)
- vNetsByGuid.get(macToGuid.get(host)).removeHost(host);
- macToGuid.remove(host);
- } else if (mac != null) {
- if (!portToMac.isEmpty()) {
- for (Entry<String, MACAddress> entry : portToMac.entrySet()) {
- if (entry.getValue().equals(mac)) {
- if(vNetsByGuid.get(macToGuid.get(entry.getValue())) != null)
- vNetsByGuid.get(macToGuid.get(entry.getValue())).removeHost(entry.getValue());
- portToMac.remove(entry.getKey());
- macToGuid.remove(entry.getValue());
- return;
- }
- }
- }
- }
- }
-
- // IFloodlightModule
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IVirtualNetworkService.class);
- return l;
- }
-
- @Override
- public Map<Class<? extends IFloodlightService>, IFloodlightService>
- getServiceImpls() {
- Map<Class<? extends IFloodlightService>,
- IFloodlightService> m =
- new HashMap<Class<? extends IFloodlightService>,
- IFloodlightService>();
- m.put(IVirtualNetworkService.class, this);
- return m;
- }
-
- @Override
- public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
- Collection<Class<? extends IFloodlightService>> l =
- new ArrayList<Class<? extends IFloodlightService>>();
- l.add(IFloodlightProviderService.class);
- l.add(IRestApiService.class);
- l.add(IDeviceService.class);
- return l;
- }
-
- @Override
- public void init(FloodlightModuleContext context)
- throws FloodlightModuleException {
- floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
- restApi = context.getServiceImpl(IRestApiService.class);
- deviceService = context.getServiceImpl(IDeviceService.class);
-
- vNetsByGuid = new ConcurrentHashMap<String, VirtualNetwork>();
- nameToGuid = new ConcurrentHashMap<String, String>();
- guidToGateway = new ConcurrentHashMap<String, Integer>();
- gatewayToGuid = new ConcurrentHashMap<Integer, Set<String>>();
- macToGuid = new ConcurrentHashMap<MACAddress, String>();
- portToMac = new ConcurrentHashMap<String, MACAddress>();
- macToGateway = new ConcurrentHashMap<MACAddress, Integer>();
- }
-
- @Override
- public void startUp(FloodlightModuleContext context) {
- floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
- restApi.addRestletRoutable(new VirtualNetworkWebRoutable());
- deviceService.addListener(this);
- }
-
- // IOFMessageListener
-
- @Override
- public String getName() {
- return "virtualizer";
- }
-
- @Override
- public boolean isCallbackOrderingPrereq(OFType type, String name) {
- // Link discovery should go before us so we don't block LLDPs
- return (type.equals(OFType.PACKET_IN) &&
- (name.equals("linkdiscovery") || (name.equals("devicemanager"))));
- }
-
- @Override
- public boolean isCallbackOrderingPostreq(OFType type, String name) {
- // We need to go before forwarding
- return (type.equals(OFType.PACKET_IN) && name.equals("forwarding"));
- }
-
- @Override
- public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
- switch (msg.getType()) {
- case PACKET_IN:
- return processPacketIn(sw, (OFPacketIn)msg, cntx);
- default:
- break;
- }
- log.warn("Received unexpected message {}", msg);
- return Command.CONTINUE;
- }
-
- /**
- * Checks whether the frame is destined to or from a gateway.
- * @param frame The ethernet frame to check.
- * @return True if it is to/from a gateway, false otherwise.
- */
- protected boolean isDefaultGateway(Ethernet frame) {
- if (macToGateway.containsKey(frame.getSourceMAC()))
- return true;
-
- Integer gwIp = macToGateway.get(frame.getDestinationMAC());
- if (gwIp != null) {
- MACAddress host = frame.getSourceMAC();
- String srcNet = macToGuid.get(host);
- if (srcNet != null) {
- Integer gwIpSrcNet = guidToGateway.get(srcNet);
- if ((gwIpSrcNet != null) && (gwIp.equals(gwIpSrcNet)))
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Checks to see if two MAC Addresses are on the same network.
- * @param m1 The first MAC.
- * @param m2 The second MAC.
- * @return True if they are on the same virtual network,
- * false otherwise.
- */
- protected boolean oneSameNetwork(MACAddress m1, MACAddress m2) {
- String net1 = macToGuid.get(m1);
- String net2 = macToGuid.get(m2);
- if (net1 == null) return false;
- if (net2 == null) return false;
- return net1.equals(net2);
- }
-
- /**
- * Checks to see if an Ethernet frame is a DHCP packet.
- * @param frame The Ethernet frame.
- * @return True if it is a DHCP frame, false otherwise.
- */
- protected boolean isDhcpPacket(Ethernet frame) {
- IPacket payload = frame.getPayload(); // IP
- if (payload == null) return false;
- IPacket p2 = payload.getPayload(); // TCP or UDP
- if (p2 == null) return false;
- IPacket p3 = p2.getPayload(); // Application
- if ((p3 != null) && (p3 instanceof DHCP)) return true;
- return false;
- }
-
- /**
- * Processes an OFPacketIn message and decides if the OFPacketIn should be dropped
- * or the processing should continue.
- * @param sw The switch the PacketIn came from.
- * @param msg The OFPacketIn message from the switch.
- * @param cntx The FloodlightContext for this message.
- * @return Command.CONTINUE if processing should be continued, Command.STOP otherwise.
- */
- protected Command processPacketIn(IOFSwitch sw, OFPacketIn msg, FloodlightContext cntx) {
- Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
- Command ret = Command.STOP;
- String srcNetwork = macToGuid.get(eth.getSourceMAC());
- // If the host is on an unknown network we deny it.
- // We make exceptions for ARP and DHCP.
- if (eth.isBroadcast() || eth.isMulticast() || isDefaultGateway(eth) || isDhcpPacket(eth)) {
- ret = Command.CONTINUE;
- } else if (srcNetwork == null) {
- log.trace("Blocking traffic from host {} because it is not attached to any network.",
- HexString.toHexString(eth.getSourceMACAddress()));
- ret = Command.STOP;
- } else if (oneSameNetwork(eth.getSourceMAC(), eth.getDestinationMAC())) {
- // if they are on the same network continue
- ret = Command.CONTINUE;
- }
-
- if (log.isTraceEnabled())
- log.trace("Results for flow between {} and {} is {}",
- new Object[] {eth.getSourceMAC(), eth.getDestinationMAC(), ret});
- /*
- * TODO - figure out how to still detect gateways while using
- * drop mods
- if (ret == Command.STOP) {
- if (!(eth.getPayload() instanceof ARP))
- doDropFlow(sw, msg, cntx);
- }
- */
- return ret;
- }
-
- /**
- * Writes a FlowMod to a switch that inserts a drop flow.
- * @param sw The switch to write the FlowMod to.
- * @param pi The corresponding OFPacketIn. Used to create the OFMatch structure.
- * @param cntx The FloodlightContext that gets passed to the switch.
- */
- protected void doDropFlow(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
- if (log.isTraceEnabled()) {
- log.trace("doDropFlow pi={} srcSwitch={}",
- new Object[] { pi, sw });
- }
-
- if (sw == null) {
- log.warn("Switch is null, not installing drop flowmod for PacketIn {}", pi);
- return;
- }
-
- // Create flow-mod based on packet-in and src-switch
- OFFlowMod fm =
- (OFFlowMod) floodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD);
- OFMatch match = new OFMatch();
- match.loadFromPacket(pi.getPacketData(), pi.getInPort());
- List<OFAction> actions = new ArrayList<OFAction>(); // no actions = drop
- long cookie = AppCookie.makeCookie(APP_ID, 0);
- fm.setCookie(cookie)
- .setIdleTimeout(ForwardingBase.FLOWMOD_DEFAULT_IDLE_TIMEOUT)
- .setHardTimeout(ForwardingBase.FLOWMOD_DEFAULT_HARD_TIMEOUT)
- .setBufferId(OFPacketOut.BUFFER_ID_NONE)
- .setMatch(match)
- .setActions(actions)
- .setLengthU(OFFlowMod.MINIMUM_LENGTH);
- fm.setFlags(OFFlowMod.OFPFF_SEND_FLOW_REM);
- try {
- if (log.isTraceEnabled()) {
- log.trace("write drop flow-mod srcSwitch={} match={} " +
- "pi={} flow-mod={}",
- new Object[] {sw, match, pi, fm});
- }
- sw.write(fm, cntx);
- } catch (IOException e) {
- log.error("Failure writing drop flow mod", e);
- }
- return;
- }
-
- // IDeviceListener
-
- @Override
- public void deviceAdded(IDevice device) {
- if (device.getIPv4Addresses() == null) return;
- for (Integer i : device.getIPv4Addresses()) {
- if (gatewayToGuid.containsKey(i)) {
- MACAddress mac = MACAddress.valueOf(device.getMACAddress());
- if (log.isDebugEnabled())
- log.debug("Adding MAC {} with IP {} a a gateway",
- HexString.toHexString(mac.toBytes()),
- IPv4.fromIPv4Address(i));
- macToGateway.put(mac, i);
- }
- }
- }
-
- @Override
- public void deviceRemoved(IDevice device) {
- // if device is a gateway remove
- MACAddress mac = MACAddress.valueOf(device.getMACAddress());
- if (macToGateway.containsKey(mac)) {
- if (log.isDebugEnabled())
- log.debug("Removing MAC {} as a gateway",
- HexString.toHexString(mac.toBytes()));
- macToGateway.remove(mac);
- }
- }
-
- @Override
- public void deviceIPV4AddrChanged(IDevice device) {
- // add or remove entry as gateway
- deviceAdded(device);
- }
-
- @Override
- public void deviceMoved(IDevice device) {
- // ignore
- }
-
- @Override
- public void deviceVlanChanged(IDevice device) {
- // ignore
- }
-
- @Override
- public Collection <VirtualNetwork> listNetworks() {
- return vNetsByGuid.values();
-
- }
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkSerializer.java b/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkSerializer.java
deleted file mode 100644
index 6902f6c..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkSerializer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.map.SerializerProvider;
-
-/**
- * Serialize a VirtualNetwork object
- * @author KC Wang
- */
-public class VirtualNetworkSerializer extends JsonSerializer<VirtualNetwork> {
-
- @Override
- public void serialize(VirtualNetwork vNet, JsonGenerator jGen,
- SerializerProvider serializer) throws IOException,
- JsonProcessingException {
- jGen.writeStartObject();
-
- jGen.writeStringField("name", vNet.name);
- jGen.writeStringField("guid", vNet.guid);
- jGen.writeStringField("gateway", vNet.gateway);
-
- jGen.writeArrayFieldStart("mac");
- Iterator<MACAddress> hit = vNet.hosts.iterator();
- while (hit.hasNext())
- jGen.writeString(hit.next().toString());
- jGen.writeEndArray();
-
- jGen.writeEndObject();
- }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkWebRoutable.java b/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkWebRoutable.java
deleted file mode 100644
index 61769ec..0000000
--- a/src/main/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkWebRoutable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import org.restlet.Context;
-import org.restlet.Restlet;
-import org.restlet.routing.Router;
-
-import net.floodlightcontroller.restserver.RestletRoutable;
-
-public class VirtualNetworkWebRoutable implements RestletRoutable {
-
- @Override
- public Restlet getRestlet(Context context) {
- Router router = new Router(context);
- router.attach("/tenants/{tenant}/networks", NetworkResource.class); // GET
- router.attach("/tenants/{tenant}/networks/{network}", NetworkResource.class); // PUT, DELETE
- router.attach("/tenants/{tenant}/networks", NetworkResource.class); // POST
- router.attach("/tenants/{tenant}/networks/{network}/ports/{port}/attachment", HostResource.class);
- router.attachDefault(NoOp.class);
- return router;
- }
-
- @Override
- public String basePath() {
- return "/quantum/v1.0";
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
new file mode 100644
index 0000000..775f952
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
@@ -0,0 +1,920 @@
+package net.onrc.onos.datagrid;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.onrc.onos.datagrid.web.DatagridWebRoutable;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
+import net.onrc.onos.ofcontroller.proxyarp.IArpEventHandler;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.serializers.KryoFactory;
+
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.esotericsoftware.kryo2.Kryo;
+import com.esotericsoftware.kryo2.io.Input;
+import com.esotericsoftware.kryo2.io.Output;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.FileSystemXmlConfig;
+import com.hazelcast.core.EntryEvent;
+import com.hazelcast.core.EntryListener;
+import com.hazelcast.core.Hazelcast;
+import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.core.IMap;
+import com.hazelcast.instance.GroupProperties;
+
+/**
+ * A datagrid service that uses Hazelcast as a datagrid.
+ * The relevant data is stored in the Hazelcast datagrid and shared as
+ * appropriate in a multi-node cluster.
+ */
+public class HazelcastDatagrid implements IFloodlightModule, IDatagridService {
+ private final static int MAX_BUFFER_SIZE = 64*1024;
+
+ protected final static Logger log = LoggerFactory.getLogger(HazelcastDatagrid.class);
+ protected IFloodlightProviderService floodlightProvider;
+ protected IRestApiService restApi;
+
+ protected static final String HazelcastConfigFile = "datagridConfig";
+ private HazelcastInstance hazelcastInstance = null;
+ private Config hazelcastConfig = null;
+
+ private KryoFactory kryoFactory = new KryoFactory();
+ private IFlowEventHandlerService flowEventHandlerService = null;
+
+ // State related to the Flow map
+ protected static final String mapFlowName = "mapFlow";
+ private IMap<Long, byte[]> mapFlow = null;
+ private MapFlowListener mapFlowListener = null;
+ private String mapFlowListenerId = null;
+
+ // State related to the Flow Entry map
+ protected static final String mapFlowEntryName = "mapFlowEntry";
+ private IMap<Long, byte[]> mapFlowEntry = null;
+ private MapFlowEntryListener mapFlowEntryListener = null;
+ private String mapFlowEntryListenerId = null;
+
+ // State related to the Network Topology map
+ protected static final String mapTopologyName = "mapTopology";
+ private IMap<String, byte[]> mapTopology = null;
+ private MapTopologyListener mapTopologyListener = null;
+ private String mapTopologyListenerId = null;
+
+ // State related to the ARP map
+ protected static final String arpMapName = "arpMap";
+ private IMap<ArpMessage, byte[]> arpMap = null;
+ private List<IArpEventHandler> arpEventHandlers = new ArrayList<IArpEventHandler>();
+ private final byte[] dummyByte = {0};
+
+ /**
+ * Class for receiving notifications for Flow state.
+ *
+ * The datagrid map is:
+ * - Key : Flow ID (Long)
+ * - Value : Serialized FlowPath (byte[])
+ */
+ class MapFlowListener implements EntryListener<Long, byte[]> {
+ /**
+ * Receive a notification that an entry is added.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryAdded(EntryEvent event) {
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowPath flowPath = kryo.readObject(input, FlowPath.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowAdded(flowPath);
+ }
+
+ /**
+ * Receive a notification that an entry is removed.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryRemoved(EntryEvent event) {
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowPath flowPath = kryo.readObject(input, FlowPath.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowRemoved(flowPath);
+ }
+
+ /**
+ * Receive a notification that an entry is updated.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryUpdated(EntryEvent event) {
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowPath flowPath = kryo.readObject(input, FlowPath.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowUpdated(flowPath);
+ }
+
+ /**
+ * Receive a notification that an entry is evicted.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryEvicted(EntryEvent event) {
+ // NOTE: We don't use eviction for this map
+ }
+ }
+
+ /**
+ * Class for receiving notifications for FlowEntry state.
+ *
+ * The datagrid map is:
+ * - Key : FlowEntry ID (Long)
+ * - Value : Serialized FlowEntry (byte[])
+ */
+ class MapFlowEntryListener implements EntryListener<Long, byte[]> {
+ /**
+ * Receive a notification that an entry is added.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryAdded(EntryEvent event) {
+ //
+ // NOTE: Ignore Flow Entries Events originated by this instance
+ //
+ if (event.getMember().localMember())
+ return;
+
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowEntry flowEntry = kryo.readObject(input, FlowEntry.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowEntryAdded(flowEntry);
+ }
+
+ /**
+ * Receive a notification that an entry is removed.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryRemoved(EntryEvent event) {
+ //
+ // NOTE: Ignore Flow Entries Events originated by this instance
+ //
+ if (event.getMember().localMember())
+ return;
+
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowEntry flowEntry = kryo.readObject(input, FlowEntry.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowEntryRemoved(flowEntry);
+ }
+
+ /**
+ * Receive a notification that an entry is updated.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryUpdated(EntryEvent event) {
+ //
+ // NOTE: Ignore Flow Entries Events originated by this instance
+ //
+ if (event.getMember().localMember())
+ return;
+
+ Long keyLong = (Long)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ FlowEntry flowEntry = kryo.readObject(input, FlowEntry.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvFlowEntryUpdated(flowEntry);
+ }
+
+ /**
+ * Receive a notification that an entry is evicted.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryEvicted(EntryEvent event) {
+ // NOTE: We don't use eviction for this map
+ }
+ }
+
+ /**
+ * Class for receiving notifications for Network Topology state.
+ *
+ * The datagrid map is:
+ * - Key: TopologyElement ID (String)
+ * - Value: Serialized TopologyElement (byte[])
+ */
+ class MapTopologyListener implements EntryListener<String, byte[]> {
+ /**
+ * Receive a notification that an entry is added.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryAdded(EntryEvent event) {
+ String keyString = (String)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ TopologyElement topologyElement =
+ kryo.readObject(input, TopologyElement.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvTopologyElementAdded(topologyElement);
+ }
+
+ /**
+ * Receive a notification that an entry is removed.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryRemoved(EntryEvent event) {
+ String keyString = (String)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ TopologyElement topologyElement =
+ kryo.readObject(input, TopologyElement.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvTopologyElementRemoved(topologyElement);
+ }
+
+ /**
+ * Receive a notification that an entry is updated.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryUpdated(EntryEvent event) {
+ String keyString = (String)event.getKey();
+ byte[] valueBytes = (byte[])event.getValue();
+
+ //
+ // Decode the value and deliver the notification
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ TopologyElement topologyElement =
+ kryo.readObject(input, TopologyElement.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvTopologyElementUpdated(topologyElement);
+ }
+
+ /**
+ * Receive a notification that an entry is evicted.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryEvicted(EntryEvent event) {
+ // NOTE: We don't use eviction for this map
+ }
+ }
+
+ /**
+ * Class for receiving notifications for ARP requests.
+ *
+ * The datagrid map is:
+ * - Key: Request ID (String)
+ * - Value: ARP request packet (byte[])
+ */
+ class ArpMapListener implements EntryListener<ArpMessage, byte[]> {
+ /**
+ * Receive a notification that an entry is added.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryAdded(EntryEvent<ArpMessage, byte[]> event) {
+ for (IArpEventHandler arpEventHandler : arpEventHandlers) {
+ arpEventHandler.arpRequestNotification(event.getKey());
+ }
+
+ //
+ // Decode the value and deliver the notification
+ //
+ /*
+ Kryo kryo = kryoFactory.newKryo();
+ Input input = new Input(valueBytes);
+ TopologyElement topologyElement =
+ kryo.readObject(input, TopologyElement.class);
+ kryoFactory.deleteKryo(kryo);
+ flowEventHandlerService.notificationRecvTopologyElementAdded(topologyElement);
+ */
+ }
+
+ /**
+ * Receive a notification that an entry is removed.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryRemoved(EntryEvent<ArpMessage, byte[]> event) {
+ // Not used
+ }
+
+ /**
+ * Receive a notification that an entry is updated.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryUpdated(EntryEvent<ArpMessage, byte[]> event) {
+ // Not used
+ }
+
+ /**
+ * Receive a notification that an entry is evicted.
+ *
+ * @param event the notification event for the entry.
+ */
+ public void entryEvicted(EntryEvent<ArpMessage, byte[]> event) {
+ // Not used
+ }
+ }
+
+ /**
+ * Initialize the Hazelcast Datagrid operation.
+ *
+ * @param conf the configuration filename.
+ */
+ public void init(String configFilename) {
+ /*
+ System.setProperty("hazelcast.socket.receive.buffer.size", "32");
+ System.setProperty("hazelcast.socket.send.buffer.size", "32");
+ */
+ // System.setProperty("hazelcast.heartbeat.interval.seconds", "100");
+
+ // Init from configuration file
+ try {
+ hazelcastConfig = new FileSystemXmlConfig(configFilename);
+ } catch (FileNotFoundException e) {
+ log.error("Error opening Hazelcast XML configuration. File not found: " + configFilename, e);
+ }
+ /*
+ hazelcastConfig.setProperty(GroupProperties.PROP_IO_THREAD_COUNT, "1");
+ hazelcastConfig.setProperty(GroupProperties.PROP_OPERATION_THREAD_COUNT, "1");
+ hazelcastConfig.setProperty(GroupProperties.PROP_EVENT_THREAD_COUNT, "1");
+ */
+ //
+ hazelcastConfig.setProperty(GroupProperties.PROP_EVENT_QUEUE_CAPACITY, "4000000");
+ hazelcastConfig.setProperty(GroupProperties.PROP_SOCKET_RECEIVE_BUFFER_SIZE, "4096");
+ hazelcastConfig.setProperty(GroupProperties.PROP_SOCKET_SEND_BUFFER_SIZE, "4096");
+ }
+
+ /**
+ * Shutdown the Hazelcast Datagrid operation.
+ */
+ public void finalize() {
+ close();
+ }
+
+ /**
+ * Shutdown the Hazelcast Datagrid operation.
+ */
+ public void close() {
+ Hazelcast.shutdownAll();
+ }
+
+ /**
+ * Get the collection of offered module services.
+ *
+ * @return the collection of offered module services.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IDatagridService.class);
+ return l;
+ }
+
+ /**
+ * Get the collection of implemented services.
+ *
+ * @return the collection of implemented services.
+ */
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService>
+ getServiceImpls() {
+ Map<Class<? extends IFloodlightService>,
+ IFloodlightService> m =
+ new HashMap<Class<? extends IFloodlightService>,
+ IFloodlightService>();
+ m.put(IDatagridService.class, this);
+ return m;
+ }
+
+ /**
+ * Get the collection of modules this module depends on.
+ *
+ * @return the collection of modules this module depends on.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>>
+ getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(IRestApiService.class);
+ return l;
+ }
+
+ /**
+ * Initialize the module.
+ *
+ * @param context the module context to use for the initialization.
+ */
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+ restApi = context.getServiceImpl(IRestApiService.class);
+
+ // Get the configuration file name and configure the Datagrid
+ Map<String, String> configMap = context.getConfigParams(this);
+ String configFilename = configMap.get(HazelcastConfigFile);
+ this.init(configFilename);
+ }
+
+ /**
+ * Startup module operation.
+ *
+ * @param context the module context to use for the startup.
+ */
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ hazelcastInstance = Hazelcast.newHazelcastInstance(hazelcastConfig);
+
+ restApi.addRestletRoutable(new DatagridWebRoutable());
+
+ arpMap = hazelcastInstance.getMap(arpMapName);
+ arpMap.addEntryListener(new ArpMapListener(), true);
+ }
+
+ /**
+ * Register Flow Event Handler Service for receiving Flow-related
+ * notifications.
+ *
+ * NOTE: Only a single Flow Event Handler Service can be registered.
+ *
+ * @param flowEventHandlerService the Flow Event Handler Service to register.
+ */
+ @Override
+ public void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService) {
+ this.flowEventHandlerService = flowEventHandlerService;
+
+ // Initialize the Flow-related map state
+ mapFlowListener = new MapFlowListener();
+ mapFlow = hazelcastInstance.getMap(mapFlowName);
+ mapFlowListenerId = mapFlow.addEntryListener(mapFlowListener, true);
+
+ // Initialize the FlowEntry-related map state
+ mapFlowEntryListener = new MapFlowEntryListener();
+ mapFlowEntry = hazelcastInstance.getMap(mapFlowEntryName);
+ mapFlowEntryListenerId = mapFlowEntry.addEntryListener(mapFlowEntryListener, true);
+
+ // Initialize the Topology-related map state
+ mapTopologyListener = new MapTopologyListener();
+ mapTopology = hazelcastInstance.getMap(mapTopologyName);
+ mapTopologyListenerId = mapTopology.addEntryListener(mapTopologyListener, true);
+ }
+
+ /**
+ * De-register Flow Event Handler Service for receiving Flow-related
+ * notifications.
+ *
+ * NOTE: Only a single Flow Event Handler Service can be registered.
+ *
+ * @param flowEventHandlerService the Flow Event Handler Service to
+ * de-register.
+ */
+ @Override
+ public void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService) {
+ // Clear the Flow-related map state
+ mapFlow.removeEntryListener(mapFlowListenerId);
+ mapFlow = null;
+ mapFlowListener = null;
+
+ // Clear the FlowEntry-related map state
+ mapFlowEntry.removeEntryListener(mapFlowEntryListenerId);
+ mapFlowEntry = null;
+ mapFlowEntryListener = null;
+
+ // Clear the Topology-related map state
+ mapTopology.removeEntryListener(mapTopologyListenerId);
+ mapTopology = null;
+ mapTopologyListener = null;
+
+ this.flowEventHandlerService = null;
+ }
+
+ @Override
+ public void registerArpEventHandler(IArpEventHandler arpEventHandler) {
+ if (arpEventHandler != null) {
+ arpEventHandlers.add(arpEventHandler);
+ }
+ }
+
+ @Override
+ public void deregisterArpEventHandler(IArpEventHandler arpEventHandler) {
+ arpEventHandlers.remove(arpEventHandler);
+ }
+
+ /**
+ * Get all Flows that are currently in the datagrid.
+ *
+ * @return all Flows that are currently in the datagrid.
+ */
+ @Override
+ public Collection<FlowPath> getAllFlows() {
+ Collection<FlowPath> allFlows = new LinkedList<FlowPath>();
+
+ //
+ // Get all current entries
+ //
+ Collection<byte[]> values = mapFlow.values();
+ Kryo kryo = kryoFactory.newKryo();
+ for (byte[] valueBytes : values) {
+ //
+ // Decode the value
+ //
+ Input input = new Input(valueBytes);
+ FlowPath flowPath = kryo.readObject(input, FlowPath.class);
+ allFlows.add(flowPath);
+ }
+ kryoFactory.deleteKryo(kryo);
+
+ return allFlows;
+ }
+
+ /**
+ * Get a Flow for a given Flow ID.
+ *
+ * @param flowId the Flow ID of the Flow to get.
+ * @return the Flow if found, otherwise null.
+ */
+ @Override
+ public FlowPath getFlow(FlowId flowId) {
+ byte[] valueBytes = mapFlow.get(flowId.value());
+ if (valueBytes == null)
+ return null;
+
+ Kryo kryo = kryoFactory.newKryo();
+ //
+ // Decode the value
+ //
+ Input input = new Input(valueBytes);
+ FlowPath flowPath = kryo.readObject(input, FlowPath.class);
+ kryoFactory.deleteKryo(kryo);
+
+ return flowPath;
+ }
+
+ /**
+ * Send a notification that a Flow is added.
+ *
+ * @param flowPath the Flow that is added.
+ */
+ @Override
+ public void notificationSendFlowAdded(FlowPath flowPath) {
+ //
+ // Encode the value
+ //
+ byte[] buffer = new byte[MAX_BUFFER_SIZE];
+ Kryo kryo = kryoFactory.newKryo();
+ Output output = new Output(buffer, -1);
+ kryo.writeObject(output, flowPath);
+ byte[] valueBytes = output.toBytes();
+ kryoFactory.deleteKryo(kryo);
+
+ //
+ // Put the entry:
+ // - Key : Flow ID (Long)
+ // - Value : Serialized Flow (byte[])
+ //
+ mapFlow.putAsync(flowPath.flowId().value(), valueBytes);
+ }
+
+ /**
+ * Send a notification that a Flow is removed.
+ *
+ * @param flowId the Flow ID of the Flow that is removed.
+ */
+ @Override
+ public void notificationSendFlowRemoved(FlowId flowId) {
+ //
+ // Remove the entry:
+ // - Key : Flow ID (Long)
+ // - Value : Serialized Flow (byte[])
+ //
+ mapFlow.removeAsync(flowId.value());
+ }
+
+ /**
+ * Send a notification that a Flow is updated.
+ *
+ * @param flowPath the Flow that is updated.
+ */
+ @Override
+ public void notificationSendFlowUpdated(FlowPath flowPath) {
+ // NOTE: Adding an entry with an existing key automatically updates it
+ notificationSendFlowAdded(flowPath);
+ }
+
+ /**
+ * Send a notification that all Flows are removed.
+ */
+ @Override
+ public void notificationSendAllFlowsRemoved() {
+ //
+ // Remove all entries
+ // NOTE: We remove the entries one-by-one so the per-entry
+ // notifications will be delivered.
+ //
+ // mapFlow.clear();
+ Set<Long> keySet = mapFlow.keySet();
+ for (Long key : keySet) {
+ mapFlow.removeAsync(key);
+ }
+ }
+
+ /**
+ * Get all Flow Entries that are currently in the datagrid.
+ *
+ * @return all Flow Entries that are currently in the datagrid.
+ */
+ @Override
+ public Collection<FlowEntry> getAllFlowEntries() {
+ Collection<FlowEntry> allFlowEntries = new LinkedList<FlowEntry>();
+
+ //
+ // Get all current entries
+ //
+ Collection<byte[]> values = mapFlowEntry.values();
+ Kryo kryo = kryoFactory.newKryo();
+ for (byte[] valueBytes : values) {
+ //
+ // Decode the value
+ //
+ Input input = new Input(valueBytes);
+ FlowEntry flowEntry = kryo.readObject(input, FlowEntry.class);
+ allFlowEntries.add(flowEntry);
+ }
+ kryoFactory.deleteKryo(kryo);
+
+ return allFlowEntries;
+ }
+
+ /**
+ * Get a Flow Entry for a given Flow Entry ID.
+ *
+ * @param flowEntryId the Flow Entry ID of the Flow Entry to get.
+ * @return the Flow Entry if found, otherwise null.
+ */
+ @Override
+ public FlowEntry getFlowEntry(FlowEntryId flowEntryId) {
+ byte[] valueBytes = mapFlowEntry.get(flowEntryId.value());
+ if (valueBytes == null)
+ return null;
+
+ Kryo kryo = kryoFactory.newKryo();
+ //
+ // Decode the value
+ //
+ Input input = new Input(valueBytes);
+ FlowEntry flowEntry = kryo.readObject(input, FlowEntry.class);
+ kryoFactory.deleteKryo(kryo);
+
+ return flowEntry;
+ }
+
+ /**
+ * Send a notification that a FlowEntry is added.
+ *
+ * @param flowEntry the FlowEntry that is added.
+ */
+ @Override
+ public void notificationSendFlowEntryAdded(FlowEntry flowEntry) {
+ //
+ // Encode the value
+ //
+ byte[] buffer = new byte[MAX_BUFFER_SIZE];
+ Kryo kryo = kryoFactory.newKryo();
+ Output output = new Output(buffer, -1);
+ kryo.writeObject(output, flowEntry);
+ byte[] valueBytes = output.toBytes();
+ kryoFactory.deleteKryo(kryo);
+
+ //
+ // Put the entry:
+ // - Key : FlowEntry ID (Long)
+ // - Value : Serialized FlowEntry (byte[])
+ //
+ mapFlowEntry.putAsync(flowEntry.flowEntryId().value(), valueBytes);
+ }
+
+ /**
+ * Send a notification that a FlowEntry is removed.
+ *
+ * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed.
+ */
+ @Override
+ public void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId) {
+ //
+ // Remove the entry:
+ // - Key : FlowEntry ID (Long)
+ // - Value : Serialized FlowEntry (byte[])
+ //
+ mapFlowEntry.removeAsync(flowEntryId.value());
+ }
+
+ /**
+ * Send a notification that a FlowEntry is updated.
+ *
+ * @param flowEntry the FlowEntry that is updated.
+ */
+ @Override
+ public void notificationSendFlowEntryUpdated(FlowEntry flowEntry) {
+ // NOTE: Adding an entry with an existing key automatically updates it
+ notificationSendFlowEntryAdded(flowEntry);
+ }
+
+ /**
+ * Send a notification that all Flow Entries are removed.
+ */
+ @Override
+ public void notificationSendAllFlowEntriesRemoved() {
+ //
+ // Remove all entries
+ // NOTE: We remove the entries one-by-one so the per-entry
+ // notifications will be delivered.
+ //
+ // mapFlowEntry.clear();
+ Set<Long> keySet = mapFlowEntry.keySet();
+ for (Long key : keySet) {
+ mapFlowEntry.removeAsync(key);
+ }
+ }
+
+ /**
+ * Get all Topology Elements that are currently in the datagrid.
+ *
+ * @return all Topology Elements that are currently in the datagrid.
+ */
+ @Override
+ public Collection<TopologyElement> getAllTopologyElements() {
+ Collection<TopologyElement> allTopologyElements =
+ new LinkedList<TopologyElement>();
+
+ //
+ // Get all current entries
+ //
+ Collection<byte[]> values = mapTopology.values();
+ Kryo kryo = kryoFactory.newKryo();
+ for (byte[] valueBytes : values) {
+ //
+ // Decode the value
+ //
+ Input input = new Input(valueBytes);
+ TopologyElement topologyElement =
+ kryo.readObject(input, TopologyElement.class);
+ allTopologyElements.add(topologyElement);
+ }
+ kryoFactory.deleteKryo(kryo);
+
+ return allTopologyElements;
+ }
+
+ /**
+ * Send a notification that a Topology Element is added.
+ *
+ * @param topologyElement the Topology Element that is added.
+ */
+ @Override
+ public void notificationSendTopologyElementAdded(TopologyElement topologyElement) {
+ //
+ // Encode the value
+ //
+ byte[] buffer = new byte[MAX_BUFFER_SIZE];
+ Kryo kryo = kryoFactory.newKryo();
+ Output output = new Output(buffer, -1);
+ kryo.writeObject(output, topologyElement);
+ byte[] valueBytes = output.toBytes();
+ kryoFactory.deleteKryo(kryo);
+
+ //
+ // Put the entry:
+ // - Key : TopologyElement ID (String)
+ // - Value : Serialized TopologyElement (byte[])
+ //
+ mapTopology.putAsync(topologyElement.elementId(), valueBytes);
+ }
+
+ /**
+ * Send a notification that a Topology Element is removed.
+ *
+ * @param topologyElement the Topology Element that is removed.
+ */
+ @Override
+ public void notificationSendTopologyElementRemoved(TopologyElement topologyElement) {
+ //
+ // Remove the entry:
+ // - Key : TopologyElement ID (String)
+ // - Value : Serialized TopologyElement (byte[])
+ //
+ mapTopology.removeAsync(topologyElement.elementId());
+ }
+
+ /**
+ * Send a notification that a Topology Element is updated.
+ *
+ * @param topologyElement the Topology Element that is updated.
+ */
+ @Override
+ public void notificationSendTopologyElementUpdated(TopologyElement topologyElement) {
+ // NOTE: Adding an entry with an existing key automatically updates it
+ notificationSendTopologyElementAdded(topologyElement);
+ }
+
+ /**
+ * Send a notification that all Topology Elements are removed.
+ */
+ @Override
+ public void notificationSendAllTopologyElementsRemoved() {
+ //
+ // Remove all entries
+ // NOTE: We remove the entries one-by-one so the per-entry
+ // notifications will be delivered.
+ //
+ // mapTopology.clear();
+ Set<String> keySet = mapTopology.keySet();
+ for (String key : keySet) {
+ mapTopology.removeAsync(key);
+ }
+ }
+
+ @Override
+ public void sendArpRequest(ArpMessage arpMessage) {
+ //log.debug("ARP bytes: {}", HexString.toHexString(arpRequest));
+ arpMap.putAsync(arpMessage, dummyByte, 1L, TimeUnit.MILLISECONDS);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
new file mode 100644
index 0000000..034fe25
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
@@ -0,0 +1,174 @@
+package net.onrc.onos.datagrid;
+
+import java.util.Collection;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
+import net.onrc.onos.ofcontroller.proxyarp.IArpEventHandler;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+/**
+ * Interface for providing Datagrid Service to other modules.
+ */
+public interface IDatagridService extends IFloodlightService {
+ /**
+ * Register Flow Event Handler Service for receiving Flow-related
+ * notifications.
+ *
+ * NOTE: Only a single Flow Event Handler Service can be registered.
+ *
+ * @param flowEventHandlerService the Flow Event Handler Service to register.
+ */
+ void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
+
+ /**
+ * De-register Flow Event Handler Service for receiving Flow-related
+ * notifications.
+ *
+ * NOTE: Only a single Flow Event Handler Service can be registered.
+ *
+ * @param flowEventHandlerService the Flow Event Handler Service to
+ * de-register.
+ */
+ void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
+
+ /**
+ * Register event handler for ARP events.
+ *
+ * @param arpEventHandler The ARP event handler to register.
+ */
+ public void registerArpEventHandler(IArpEventHandler arpEventHandler);
+
+ /**
+ * De-register event handler service for ARP events.
+ *
+ * @param arpEventHandler The ARP event handler to de-register.
+ */
+ public void deregisterArpEventHandler(IArpEventHandler arpEventHandler);
+
+ /**
+ * Get all Flows that are currently in the datagrid.
+ *
+ * @return all Flows that are currently in the datagrid.
+ */
+ Collection<FlowPath> getAllFlows();
+
+ /**
+ * Get a Flow for a given Flow ID.
+ *
+ * @param flowId the Flow ID of the Flow to get.
+ * @return the Flow if found, otherwise null.
+ */
+ FlowPath getFlow(FlowId flowId);
+
+ /**
+ * Send a notification that a Flow is added.
+ *
+ * @param flowPath the Flow that is added.
+ */
+ void notificationSendFlowAdded(FlowPath flowPath);
+
+ /**
+ * Send a notification that a Flow is removed.
+ *
+ * @param flowId the Flow ID of the Flow that is removed.
+ */
+ void notificationSendFlowRemoved(FlowId flowId);
+
+ /**
+ * Send a notification that a Flow is updated.
+ *
+ * @param flowPath the Flow that is updated.
+ */
+ void notificationSendFlowUpdated(FlowPath flowPath);
+
+ /**
+ * Send a notification that all Flows are removed.
+ */
+ void notificationSendAllFlowsRemoved();
+
+ /**
+ * Get all Flow Entries that are currently in the datagrid.
+ *
+ * @return all Flow Entries that are currently in the datagrid.
+ */
+ Collection<FlowEntry> getAllFlowEntries();
+
+ /**
+ * Get a Flow Entry for a given Flow Entry ID.
+ *
+ * @param flowEntryId the Flow Entry ID of the Flow Entry to get.
+ * @return the Flow Entry if found, otherwise null.
+ */
+ FlowEntry getFlowEntry(FlowEntryId flowEntryId);
+
+ /**
+ * Send a notification that a FlowEntry is added.
+ *
+ * @param flowEntry the FlowEntry that is added.
+ */
+ void notificationSendFlowEntryAdded(FlowEntry flowEntry);
+
+ /**
+ * Send a notification that a FlowEntry is removed.
+ *
+ * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed.
+ */
+ void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId);
+
+ /**
+ * Send a notification that a FlowEntry is updated.
+ *
+ * @param flowEntry the FlowEntry that is updated.
+ */
+ void notificationSendFlowEntryUpdated(FlowEntry flowEntry);
+
+ /**
+ * Send a notification that all Flow Entries are removed.
+ */
+ void notificationSendAllFlowEntriesRemoved();
+
+ /**
+ * Get all Topology Elements that are currently in the datagrid.
+ *
+ * @return all Topology Elements that are currently in the datagrid.
+ */
+ Collection<TopologyElement> getAllTopologyElements();
+
+ /**
+ * Send a notification that a Topology Element is added.
+ *
+ * @param topologyElement the Topology Element that is added.
+ */
+ void notificationSendTopologyElementAdded(TopologyElement topologyElement);
+
+ /**
+ * Send a notification that a Topology Element is removed.
+ *
+ * @param topologyElement the Topology Element that is removed.
+ */
+ void notificationSendTopologyElementRemoved(TopologyElement topologyElement);
+
+ /**
+ * Send a notification that a Topology Element is updated.
+ *
+ * @param topologyElement the Topology Element that is updated.
+ */
+ void notificationSendTopologyElementUpdated(TopologyElement topologyElement);
+
+ /**
+ * Send a notification that all Topology Elements are removed.
+ */
+ void notificationSendAllTopologyElementsRemoved();
+
+ /**
+ * Send an ARP request to other ONOS instances
+ * @param arpRequest The request packet to send
+ */
+ public void sendArpRequest(ArpMessage arpMessage);
+}
diff --git a/src/main/java/net/onrc/onos/datagrid/web/DatagridWebRoutable.java b/src/main/java/net/onrc/onos/datagrid/web/DatagridWebRoutable.java
new file mode 100644
index 0000000..2c99ece
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/web/DatagridWebRoutable.java
@@ -0,0 +1,30 @@
+package net.onrc.onos.datagrid.web;
+
+import net.floodlightcontroller.restserver.RestletRoutable;
+
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.routing.Router;
+
+/**
+ * REST API implementation for the Datagrid.
+ */
+public class DatagridWebRoutable implements RestletRoutable {
+ /**
+ * Create the Restlet router and bind to the proper resources.
+ */
+ @Override
+ public Restlet getRestlet(Context context) {
+ Router router = new Router(context);
+ router.attach("/get/map/{map-name}/json", GetMapResource.class);
+ return router;
+ }
+
+ /**
+ * Set the base path for the Topology
+ */
+ @Override
+ public String basePath() {
+ return "/wm/datagrid";
+ }
+}
diff --git a/src/main/java/net/onrc/onos/datagrid/web/GetMapResource.java b/src/main/java/net/onrc/onos/datagrid/web/GetMapResource.java
new file mode 100644
index 0000000..124ac28
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/web/GetMapResource.java
@@ -0,0 +1,84 @@
+package net.onrc.onos.datagrid.web;
+
+import java.util.Collection;
+
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Datagrid REST API implementation: Get the state of a map.
+ *
+ * Valid map names:
+ * - "all" : Get all maps
+ * - "flow" : Get the Flows
+ * - "flow-entry" : Get the Flow Entries
+ * - "topology" : Get the Topology
+ *
+ * GET /wm/datagrid/get/map/{map-name}/json
+ */
+public class GetMapResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(GetMapResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @return a string with the state of the map(s).
+ */
+ @Get("json")
+ public String retrieve() {
+ String result = "";
+
+ IDatagridService datagridService =
+ (IDatagridService)getContext().getAttributes().
+ get(IDatagridService.class.getCanonicalName());
+
+ if (datagridService == null) {
+ log.debug("ONOS Datagrid Service not found");
+ return result;
+ }
+
+ // Extract the arguments
+ String mapNameStr = (String)getRequestAttributes().get("map-name");
+
+ log.debug("Get Datagrid Map: " + mapNameStr);
+
+ //
+ // Get the Flows
+ //
+ if (mapNameStr.equals("flow") || mapNameStr.equals("all")) {
+ Collection<FlowPath> flowPaths = datagridService.getAllFlows();
+ result += "Flows:\n";
+ for (FlowPath flowPath : flowPaths) {
+ result += flowPath.toString() + "\n";
+ }
+ }
+
+ //
+ // Get the Flow Entries
+ //
+ if (mapNameStr.equals("flow-entry") || mapNameStr.equals("all")) {
+ Collection<FlowEntry> flowEntries = datagridService.getAllFlowEntries();
+ result += "Flow Entries:\n";
+ for (FlowEntry flowEntry : flowEntries) {
+ result += flowEntry.toString() + "\n";
+ }
+ }
+
+ if (mapNameStr.equals("topology") || mapNameStr.equals("all")) {
+ Collection<TopologyElement> topologyElements = datagridService.getAllTopologyElements();
+ result += "Topology:\n";
+ for (TopologyElement topologyElement : topologyElements) {
+ result += topologyElement.toString() + "\n";
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/graph/GraphDBConnection.java b/src/main/java/net/onrc/onos/graph/GraphDBConnection.java
new file mode 100644
index 0000000..bf30297
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/GraphDBConnection.java
@@ -0,0 +1,177 @@
+package net.onrc.onos.graph;
+
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.TransactionalGraph;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.blueprints.util.wrappers.event.EventTransactionalGraph;
+import com.tinkerpop.frames.FramedGraph;
+
+public class GraphDBConnection implements IDBConnection {
+ public enum Transaction {
+ COMMIT, ROLLBACK
+ }
+
+ public enum GenerateEvent {
+ TRUE, FALSE
+ }
+
+ class TransactionHandle {
+ protected TransactionalGraph tr;
+
+ public void create() {
+ tr = graph.newTransaction();
+ }
+ }
+
+ protected final static Logger log = LoggerFactory
+ .getLogger(GraphDBConnection.class);
+ private static GraphDBConnection singleton = new GraphDBConnection();
+ private static TitanGraph graph;
+ private static EventTransactionalGraph<TitanGraph> eg;
+ private static String configFile;
+
+ /*
+ * A private Constructor prevents any other class from instantiating.
+ */
+ private GraphDBConnection() {
+ }
+
+ /* Static 'instance' method */
+ /**
+ * Get the instance of GraphDBConnection class.
+ * @param conf the path to the database configuration file.
+ * @return GraphDBConnection instance.
+ */
+ public static synchronized GraphDBConnection getInstance(final String conf) {
+ if (GraphDBConnection.configFile == null
+ || GraphDBConnection.configFile.isEmpty()) {
+ GraphDBConnection.configFile = conf;
+ log.debug("GraphDBConnection::Setting Config File {}",
+ GraphDBConnection.configFile);
+ }
+ if (!GraphDBConnection.configFile.isEmpty()
+ && (graph == null || graph.isOpen() == Boolean.FALSE)) {
+ graph = TitanFactory.open(GraphDBConnection.configFile);
+ // FIXME: Creation on Indexes should be done only once
+ Set<String> s = graph.getIndexedKeys(Vertex.class);
+ if (!s.contains("dpid")) {
+ graph.createKeyIndex("dpid", Vertex.class);
+ }
+ if (!s.contains("port_id")) {
+ graph.createKeyIndex("port_id", Vertex.class);
+ }
+ if (!s.contains("type")) {
+ graph.createKeyIndex("type", Vertex.class);
+ }
+ if (!s.contains("dl_addr")) {
+ graph.createKeyIndex("dl_addr", Vertex.class);
+ }
+ if (!s.contains("flow_id")) {
+ graph.createKeyIndex("flow_id", Vertex.class);
+ }
+ if (!s.contains("flow_entry_id")) {
+ graph.createKeyIndex("flow_entry_id", Vertex.class);
+ }
+ if (!s.contains("switch_state")) {
+ graph.createKeyIndex("switch_state", Vertex.class);
+ }
+ if (!s.contains("ipv4_address")) {
+ graph.createKeyIndex("ipv4_address", Vertex.class);
+ }
+ graph.commit();
+ eg = new EventTransactionalGraph<TitanGraph>(graph);
+ }
+ return singleton;
+ }
+
+ /**
+ * Get a FramedGraph instance of the graph.
+ */
+ @Override
+ public FramedGraph<TitanGraph> getFramedGraph() {
+ if (isValid()) {
+ FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
+ return fg;
+ } else {
+ log.error("new FramedGraph failed");
+ return null;
+ }
+ }
+
+ /**
+ * Get EventTransactionalGraph of the titan graph.
+ * @return EventTransactionalGraph of the titan graph
+ */
+ protected EventTransactionalGraph<TitanGraph> getEventGraph() {
+ if (isValid()) {
+ return eg;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Add LocalGraphChangedLister for the graph.
+ */
+ @Override
+ public void addEventListener(final LocalGraphChangedListener listener) {
+ EventTransactionalGraph<TitanGraph> eg = this.getEventGraph();
+ eg.addListener(listener);
+ log.debug("Registered listener {}", listener.getClass());
+ }
+
+ /**
+ * Return whether this connection is valid.
+ */
+ @Override
+ public Boolean isValid() {
+ return (graph != null && graph.isOpen());
+ }
+
+ /**
+ * Commit changes for the graph operations.
+ * @throws Exception
+ */
+ @Override
+ public void commit() {
+// // Should not catch exception here!
+// try {
+ graph.commit();
+// }
+// catch (Exception e) {
+// log.error("{}", e.toString());
+// }
+ }
+
+ /**
+ * Rollback changes for the graph operations.
+ */
+ @Override
+ public void rollback() {
+ // Should not catch exception here!
+// try {
+ graph.rollback();
+// }
+// catch (Exception e) {
+// log.error("{}", e.toString());
+// }
+ }
+
+ /**
+ * Close this database connection.
+ */
+ @Override
+ public void close() {
+ try {
+ commit();
+ } catch (Exception e) {
+ log.error("{}", e.toString());
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/graph/GraphDBOperation.java b/src/main/java/net/onrc/onos/graph/GraphDBOperation.java
new file mode 100644
index 0000000..bfd9046
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/GraphDBOperation.java
@@ -0,0 +1,404 @@
+package net.onrc.onos.graph;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IBaseObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.frames.FramedGraph;
+import com.tinkerpop.frames.structures.FramedVertexIterable;
+import com.tinkerpop.gremlin.java.GremlinPipeline;
+
+public class GraphDBOperation implements IDBOperation {
+ private GraphDBConnection conn;
+
+ /**
+ * Create a GraphDBOperation instance from specified GraphDBConnection's instance.
+ * @param dbConnection an instance of GraphDBConnection
+ */
+ public GraphDBOperation(GraphDBConnection dbConnection) {
+ this.conn = dbConnection;
+ }
+
+ /**
+ * Create a GraphDBOperation instance from database configuration path.
+ * @param dbConfPath a path for database configuration file.
+ */
+ public GraphDBOperation(final String dbConfPath) {
+ this.conn = GraphDBConnection.getInstance(dbConfPath);
+ }
+
+ /**
+ * Create a new switch and return the created switch object.
+ * @param dpid DPID of the switch
+ */
+ public ISwitchObject newSwitch(String dpid) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ ISwitchObject obj = fg.addVertex(null,ISwitchObject.class);
+ if (obj != null) {
+ obj.setType("switch");
+ obj.setDPID(dpid);
+ }
+ return obj;
+ }
+
+ /**
+ * Search and get a switch object with DPID.
+ * @param dpid DPID of the switch
+ */
+ public ISwitchObject searchSwitch(String dpid) {
+
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+
+ return (fg != null && fg.getVertices("dpid",dpid).iterator().hasNext()) ?
+ fg.getVertices("dpid",dpid,ISwitchObject.class).iterator().next() : null;
+
+ }
+
+ /**
+ * Search and get an active switch object with DPID.
+ * @param dpid DPID of the switch
+ */
+ public ISwitchObject searchActiveSwitch(String dpid) {
+
+ ISwitchObject sw = searchSwitch(dpid);
+ if ((sw != null) &&
+ sw.getState().equals(SwitchState.ACTIVE.toString())) {
+ return sw;
+ }
+ return null;
+ }
+
+ /**
+ * Get all switch objects.
+ */
+ public Iterable<ISwitchObject> getAllSwitches() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
+ return switches;
+ }
+
+ /**
+ * Get all active switch objects.
+ */
+ public Iterable<ISwitchObject> getActiveSwitches() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
+ List<ISwitchObject> activeSwitches = new ArrayList<ISwitchObject>();
+
+ for (ISwitchObject sw: switches) {
+ if(sw.getState().equals(SwitchState.ACTIVE.toString())) {
+ activeSwitches.add(sw);
+ }
+ }
+ return activeSwitches;
+ }
+
+ /**
+ * Get all inactive switch objects.
+ */
+ public Iterable<ISwitchObject> getInactiveSwitches() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
+ List<ISwitchObject> inactiveSwitches = new ArrayList<ISwitchObject>();
+
+ for (ISwitchObject sw: switches) {
+ if(sw.getState().equals(SwitchState.INACTIVE.toString())) {
+ inactiveSwitches.add(sw);
+ }
+ }
+ return inactiveSwitches;
+ }
+
+ /**
+ * Get all flow entries' objects where their switches are not updated.
+ */
+ public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ //TODO: Should use an enum for flow_switch_state
+ return fg.getVertices("switch_state", "FE_SWITCH_NOT_UPDATED", IFlowEntry.class);
+ }
+
+ /**
+ * Remove specified switch.
+ * @param sw switch object to remove
+ */
+ public void removeSwitch(ISwitchObject sw) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ fg.removeVertex(sw.asVertex());
+ }
+
+ @Override
+ public IPortObject newPort(String dpid, Short portNumber) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IPortObject obj = fg.addVertex(null,IPortObject.class);
+ if (obj != null) {
+ obj.setType("port");
+ String id = dpid + portNumber.toString();
+ obj.setPortId(id);
+ obj.setNumber(portNumber);
+ }
+ return obj;
+
+ }
+
+ /**
+ * Create a port having specified port number.
+ * @param portNumber port number
+ */
+ @Deprecated
+ public IPortObject newPort(Short portNumber) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IPortObject obj = fg.addVertex(null,IPortObject.class);
+ if (obj != null) {
+ obj.setType("port");
+ obj.setNumber(portNumber);
+ }
+ return obj;
+ }
+
+ /**
+ * Search and get a port object of specified switch and port number.
+ * @param dpid DPID of a switch
+ * @param number port number of the switch's port
+ */
+ public IPortObject searchPort(String dpid, Short number) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ String id = dpid + number.toString();
+ return (fg != null && fg.getVertices("port_id",id).iterator().hasNext()) ?
+ fg.getVertices("port_id",id,IPortObject.class).iterator().next() : null;
+ }
+
+ /**
+ * Remove the specified switch port.
+ * @param port switch port object to remove
+ */
+ public void removePort(IPortObject port) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+// EventGraph<TitanGraph> eg = conn.getEventGraph();
+ if (fg != null) fg.removeVertex(port.asVertex());
+ }
+
+ /**
+ * Create and return a device object.
+ */
+ public IDeviceObject newDevice() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IDeviceObject obj = fg.addVertex(null,IDeviceObject.class);
+ if (obj != null) obj.setType("device");
+ return obj;
+ }
+
+ /**
+ * Search and get a device object having specified MAC address.
+ * @param macAddr MAC address to search and get
+ */
+ public IDeviceObject searchDevice(String macAddr) {
+ // TODO Auto-generated method stub
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ return (fg != null && fg.getVertices("dl_addr",macAddr).iterator().hasNext()) ?
+ fg.getVertices("dl_addr",macAddr, IDeviceObject.class).iterator().next() : null;
+ }
+
+ /**
+ * Get all devices.
+ */
+ public Iterable<IDeviceObject> getDevices() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ return fg != null ? fg.getVertices("type","device",IDeviceObject.class) : null;
+ }
+
+ /**
+ * Remove the specified device.
+ * @param dev a device object to remove
+ */
+ public void removeDevice(IDeviceObject dev) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ if (fg != null) fg.removeVertex(dev.asVertex());
+ }
+
+ public IIpv4Address newIpv4Address() {
+ return newVertex("ipv4Address", IIpv4Address.class);
+ }
+
+ private <T extends IBaseObject> T newVertex(String type, Class<T> vertexType) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ T newVertex = fg.addVertex(null, vertexType);
+ if (newVertex != null) {
+ newVertex.setType(type);
+ }
+ return newVertex;
+ }
+
+ public IIpv4Address searchIpv4Address(int intIpv4Address) {
+ return searchForVertex("ipv4_address", intIpv4Address, IIpv4Address.class);
+ }
+
+ private <T> T searchForVertex(String propertyName, Object propertyValue, Class<T> vertexType) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ if (fg != null) {
+ Iterator<T> it =
+ fg.getVertices(propertyName, propertyValue, vertexType).iterator();
+ if (it.hasNext()) {
+ return it.next();
+ }
+ }
+ return null;
+ }
+
+ public IIpv4Address ensureIpv4Address(int intIpv4Address) {
+ IIpv4Address ipv4Vertex = searchIpv4Address(intIpv4Address);
+ if (ipv4Vertex == null) {
+ ipv4Vertex = newIpv4Address();
+ ipv4Vertex.setIpv4Address(intIpv4Address);
+ }
+ return ipv4Vertex;
+ }
+
+ public void removeIpv4Address(IIpv4Address ipv4Address) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ fg.removeVertex(ipv4Address.asVertex());
+ }
+
+ /**
+ * Create and return a flow path object.
+ */
+ public IFlowPath newFlowPath() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IFlowPath flowPath = fg.addVertex(null, IFlowPath.class);
+ if (flowPath != null) flowPath.setType("flow");
+ return flowPath;
+ }
+
+ /**
+ * Search and get a flow path object with specified flow ID.
+ * @param flowId flow ID to search
+ */
+ public IFlowPath searchFlowPath(FlowId flowId) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+
+ return fg.getVertices("flow_id", flowId.toString()).iterator().hasNext() ?
+ fg.getVertices("flow_id", flowId.toString(),
+ IFlowPath.class).iterator().next() : null;
+ }
+
+ /**
+ * Get a flow path object with a flow entry.
+ * @param flowEntry flow entry object
+ */
+ public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) {
+ GremlinPipeline<Vertex, IFlowPath> pipe = new GremlinPipeline<Vertex, IFlowPath>();
+ pipe.start(flowEntry.asVertex());
+ pipe.out("flow");
+ FramedVertexIterable<IFlowPath> r = new FramedVertexIterable(conn.getFramedGraph(), (Iterable) pipe, IFlowPath.class);
+ return r.iterator().hasNext() ? r.iterator().next() : null;
+ }
+
+ /**
+ * Get all flow path objects.
+ */
+ public Iterable<IFlowPath> getAllFlowPaths() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ Iterable<IFlowPath> flowPaths = fg.getVertices("type", "flow", IFlowPath.class);
+
+ List<IFlowPath> nonNullFlows = new ArrayList<IFlowPath>();
+
+ for (IFlowPath fp: flowPaths) {
+ if (fp.getFlowId() != null) {
+ nonNullFlows.add(fp);
+ }
+ }
+ return nonNullFlows;
+ }
+
+ /**
+ * Remove the specified flow path.
+ * @param flowPath flow path object to remove
+ */
+ public void removeFlowPath(IFlowPath flowPath) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ fg.removeVertex(flowPath.asVertex());
+ }
+
+ /**
+ * Create and return a flow entry object.
+ */
+ public IFlowEntry newFlowEntry() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IFlowEntry flowEntry = fg.addVertex(null, IFlowEntry.class);
+ if (flowEntry != null) flowEntry.setType("flow_entry");
+ return flowEntry;
+ }
+
+ /**
+ * Search and get a flow entry object with flow entry ID.
+ * @param flowEntryId flow entry ID to search
+ */
+ public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+
+ return fg.getVertices("flow_entry_id", flowEntryId.toString()).iterator().hasNext() ?
+ fg.getVertices("flow_entry_id", flowEntryId.toString(),
+ IFlowEntry.class).iterator().next() : null;
+ }
+
+ /**
+ * Get all flow entry objects.
+ */
+ public Iterable<IFlowEntry> getAllFlowEntries() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+
+ return fg.getVertices("type", "flow_entry", IFlowEntry.class);
+ }
+
+ /**
+ * Remove the specified flow entry.
+ * @param flowEntry flow entry object to remove
+ */
+ public void removeFlowEntry(IFlowEntry flowEntry) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ fg.removeVertex(flowEntry.asVertex());
+ }
+
+ /**
+ * Get the instance of GraphDBConnection assigned to this class.
+ */
+ public IDBConnection getDBConnection() {
+ return conn;
+ }
+
+ /**
+ * Commit changes for the graph.
+ */
+ public void commit() {
+ conn.commit();
+ }
+
+ /**
+ * Rollback changes for the graph.
+ */
+ public void rollback() {
+ conn.rollback();
+ }
+
+ /**
+ * Close the connection of the assigned GraphDBConnection.
+ */
+ public void close() {
+ conn.close();
+ }
+
+
+}
diff --git a/src/main/java/net/onrc/onos/graph/IDBConnection.java b/src/main/java/net/onrc/onos/graph/IDBConnection.java
new file mode 100644
index 0000000..82ebba2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/IDBConnection.java
@@ -0,0 +1,13 @@
+package net.onrc.onos.graph;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.frames.FramedGraph;
+
+public interface IDBConnection {
+ public FramedGraph<TitanGraph> getFramedGraph();
+ public void addEventListener(final LocalGraphChangedListener listener);
+ public Boolean isValid();
+ public void commit();
+ public void rollback();
+ public void close();
+}
diff --git a/src/main/java/net/onrc/onos/graph/IDBOperation.java b/src/main/java/net/onrc/onos/graph/IDBOperation.java
new file mode 100644
index 0000000..f873f27
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/IDBOperation.java
@@ -0,0 +1,48 @@
+package net.onrc.onos.graph;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+public interface IDBOperation {
+ public ISwitchObject newSwitch(String dpid);
+ public ISwitchObject searchSwitch(String dpid);
+ public ISwitchObject searchActiveSwitch(String dpid);
+ public Iterable<ISwitchObject> getActiveSwitches();
+ public Iterable<ISwitchObject> getAllSwitches();
+ public Iterable<ISwitchObject> getInactiveSwitches();
+ public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries();
+ public void removeSwitch(ISwitchObject sw);
+
+ @Deprecated
+ public IPortObject newPort(Short portNumber);
+ public IPortObject newPort(String dpid, Short portNum);
+ public IPortObject searchPort(String dpid, Short number);
+ public void removePort(IPortObject port);
+
+ public IDeviceObject newDevice();
+ public IDeviceObject searchDevice(String macAddr);
+ public Iterable<IDeviceObject> getDevices();
+ public void removeDevice(IDeviceObject dev);
+
+ public IFlowPath newFlowPath();
+ public IFlowPath searchFlowPath(FlowId flowId);
+ public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry);
+ public Iterable<IFlowPath> getAllFlowPaths();
+ public void removeFlowPath(IFlowPath flowPath);
+
+ public IFlowEntry newFlowEntry();
+ public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId);
+ public Iterable<IFlowEntry> getAllFlowEntries();
+ public void removeFlowEntry(IFlowEntry flowEntry);
+
+ public IDBConnection getDBConnection();
+ public void commit();
+ public void rollback();
+ public void close();
+
+}
diff --git a/src/main/java/net/onrc/onos/graph/LocalGraphChangedListener.java b/src/main/java/net/onrc/onos/graph/LocalGraphChangedListener.java
new file mode 100644
index 0000000..5f3bbf1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/LocalGraphChangedListener.java
@@ -0,0 +1,7 @@
+package net.onrc.onos.graph;
+
+import com.tinkerpop.blueprints.util.wrappers.event.listener.GraphChangedListener;
+
+public interface LocalGraphChangedListener extends GraphChangedListener {
+
+}
diff --git a/src/main/java/net/onrc/onos/graph/LocalTopologyEventListener.java b/src/main/java/net/onrc/onos/graph/LocalTopologyEventListener.java
new file mode 100644
index 0000000..40f5044
--- /dev/null
+++ b/src/main/java/net/onrc/onos/graph/LocalTopologyEventListener.java
@@ -0,0 +1,108 @@
+package net.onrc.onos.graph;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.thinkaurelius.titan.core.TitanEdge;
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.blueprints.Edge;
+import com.tinkerpop.blueprints.Vertex;
+
+public class LocalTopologyEventListener implements LocalGraphChangedListener {
+
+ protected final static Logger log = LoggerFactory.getLogger(LocalTopologyEventListener.class);
+ protected static GraphDBConnection conn;
+
+ public LocalTopologyEventListener(GraphDBConnection conn) {
+ LocalTopologyEventListener.conn = conn;
+ }
+
+ @Override
+ public void edgeAdded(Edge arg0) {
+ // TODO Auto-generated method stub
+ // Convert this Event into NetMapEvent (LinkAdded, FlowEntryEnabled, HostAttached, PortEnabled)
+ }
+
+
+ @Override
+ public void edgePropertyRemoved(Edge arg0, String arg1, Object arg2) {
+ // TODO Auto-generated method stub
+ // Currently not needed
+
+ }
+
+ @Override
+ public void edgeRemoved(Edge e) {
+ // TODO Auto-generated method stub
+ // Fire NetMapEvents (LinkRemoved, FlowEntryRemoved, HostRemoved, PortRemoved)
+ TitanEdge edge = (TitanEdge) e;
+ log.debug("TopologyEvents: Received edge removed event: {}",edge.toString());
+ String label = edge.getLabel();
+ if (label.equals("link")) {
+ Vertex v = edge.getVertex(Direction.IN);
+ IPortObject src_port = conn.getFramedGraph().frame(v, IPortObject.class);
+ v = edge.getVertex(Direction.OUT);
+ IPortObject dest_port = conn.getFramedGraph().frame(v, IPortObject.class);
+
+ log.debug("TopologyEvents: link broken {}", new Object []{src_port.getSwitch().getDPID(),
+ src_port.getNumber(),
+ dest_port.getSwitch().getDPID(),
+ dest_port.getNumber()});
+ // TODO: Find the flows and add to reconcile queue
+ //
+ // NOTE: Old code/logic.
+ //
+ // IFlowService flowManager = ...
+ // flowManager.reconcileFlows(src_port);
+ }
+ }
+
+ @Override
+ public void vertexAdded(Vertex arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void vertexPropertyRemoved(Vertex arg0, String arg1, Object arg2) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void vertexRemoved(Vertex vertex) {
+ // TODO Auto-generated method stub
+ // Generate NetMapEvents
+ String type = (String) vertex.getProperty("type");
+ log.debug("TopologyEvents: Received vertex removed event: {}",vertex.toString());
+ if (type.equals("port")) {
+ // port is removed...lets fire reconcile here directly for now
+
+ IPortObject src_port = conn.getFramedGraph().frame(vertex, IPortObject.class);
+ log.debug("TopologyEvents: Port removed: {}:{}",src_port.getSwitch().getDPID(),src_port.getNumber());
+
+ // NOTE: Old code/logic.
+ //
+ // IFlowService flowManager = ...
+ // flowManager.reconcileFlows(src_port);
+ }
+ }
+
+
+ @Override
+ public void edgePropertyChanged(Edge arg0, String arg1, Object arg2,
+ Object arg3) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void vertexPropertyChanged(Vertex arg0, String arg1, Object arg2,
+ Object arg3) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpPeer.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpPeer.java
new file mode 100644
index 0000000..fa11c17
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpPeer.java
@@ -0,0 +1,26 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import com.google.common.net.InetAddresses;
+
+public class BgpPeer {
+ private final String interfaceName;
+ private final InetAddress ipAddress;
+
+ public BgpPeer(@JsonProperty("interface") String interfaceName,
+ @JsonProperty("ipAddress") String ipAddress) {
+ this.interfaceName = interfaceName;
+ this.ipAddress = InetAddresses.forString(ipAddress);
+ }
+
+ public String getInterfaceName() {
+ return interfaceName;
+ }
+
+ public InetAddress getIpAddress() {
+ return ipAddress;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
new file mode 100644
index 0000000..33280a6
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -0,0 +1,1313 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.IOFSwitchListener;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.core.util.SingletonTask;
+import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.packet.IPv4;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.routing.Link;
+import net.floodlightcontroller.topology.ITopologyListener;
+import net.floodlightcontroller.topology.ITopologyService;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.bgproute.RibUpdate.Operation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
+import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
+import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.proxyarp.BgpProxyArpManager;
+import net.onrc.onos.ofcontroller.proxyarp.IArpRequester;
+import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.Topology;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import net.sf.json.JSONSerializer;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.protocol.action.OFActionDataLayerDestination;
+import org.openflow.protocol.action.OFActionOutput;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+import com.google.common.net.InetAddresses;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+public class BgpRoute implements IFloodlightModule, IBgpRouteService,
+ ITopologyListener, IArpRequester,
+ IOFSwitchListener, IConfigInfoService,
+ IProxyArpService {
+
+ private final static Logger log = LoggerFactory.getLogger(BgpRoute.class);
+
+ private IFloodlightProviderService floodlightProvider;
+ private ITopologyService topologyService;
+ private ITopologyNetService topologyNetService;
+ private ILinkDiscoveryService linkDiscoveryService;
+ private IRestApiService restApi;
+
+ private BgpProxyArpManager proxyArp;
+
+ private IPatriciaTrie<RibEntry> ptree;
+ private IPatriciaTrie<Interface> interfacePtrie;
+ private BlockingQueue<RibUpdate> ribUpdates;
+
+ private String bgpdRestIp;
+ private String routerId;
+ private String configFilename = "config.json";
+
+ //We need to identify our flows somehow. But like it says in LearningSwitch.java,
+ //the controller/OS should hand out cookie IDs to prevent conflicts.
+ private final long APP_COOKIE = 0xa0000000000000L;
+ //Cookie for flows that do L2 forwarding within SDN domain to egress routers
+ private final long L2_FWD_COOKIE = APP_COOKIE + 1;
+ //Cookie for flows in ingress switches that rewrite the MAC address
+ private final long MAC_RW_COOKIE = APP_COOKIE + 2;
+ //Cookie for flows that setup BGP paths
+ private final long BGP_COOKIE = APP_COOKIE + 3;
+ //Forwarding uses priority 0, and the mac rewrite entries in ingress switches
+ //need to be higher priority than this otherwise the rewrite may not get done
+ private final short SDNIP_PRIORITY = 10;
+ private final short ARP_PRIORITY = 20;
+
+ private final short BGP_PORT = 179;
+
+ private final int TOPO_DETECTION_WAIT = 2; //seconds
+
+ //Configuration stuff
+ private List<String> switches;
+ private Map<String, Interface> interfaces;
+ private Map<InetAddress, BgpPeer> bgpPeers;
+ private SwitchPort bgpdAttachmentPoint;
+ private MACAddress bgpdMacAddress;
+ private short vlan;
+
+ //True when all switches have connected
+ private volatile boolean switchesConnected = false;
+ //True when we have a full mesh of shortest paths between gateways
+ private volatile boolean topologyReady = false;
+
+ private ArrayList<LDUpdate> linkUpdates;
+ private SingletonTask topologyChangeDetectorTask;
+
+ private SetMultimap<InetAddress, RibUpdate> prefixesWaitingOnArp;
+
+ private Map<InetAddress, Path> pathsWaitingOnArp;
+
+ private ExecutorService bgpUpdatesExecutor;
+
+ private Map<InetAddress, Path> pushedPaths;
+ private Map<Prefix, Path> prefixToPath;
+ private Multimap<Prefix, PushedFlowMod> pushedFlows;
+
+ private FlowCache flowCache;
+
+ private volatile Topology topology = null;
+
+ private class TopologyChangeDetector implements Runnable {
+ @Override
+ public void run() {
+ log.debug("Running topology change detection task");
+ synchronized (linkUpdates) {
+ //This is the model the REST API uses to retrieve network graph info
+ ITopoLinkService topoLinkService = new TopoLinkServiceImpl();
+
+ List<Link> activeLinks = topoLinkService.getActiveLinks();
+
+ Iterator<LDUpdate> it = linkUpdates.iterator();
+ while (it.hasNext()){
+ LDUpdate ldu = it.next();
+ Link l = new Link(ldu.getSrc(), ldu.getSrcPort(),
+ ldu.getDst(), ldu.getDstPort());
+
+ if (activeLinks.contains(l)){
+ it.remove();
+ }
+ }
+ }
+
+ if (!topologyReady) {
+ if (linkUpdates.isEmpty()){
+ //All updates have been seen in network map.
+ //We can check if topology is ready
+ log.debug("No known changes outstanding. Checking topology now");
+ checkStatus();
+ }
+ else {
+ //We know of some link updates that haven't propagated to the database yet
+ log.debug("Some changes not found in network map - {} links missing", linkUpdates.size());
+ topologyChangeDetectorTask.reschedule(TOPO_DETECTION_WAIT, TimeUnit.SECONDS);
+ }
+ }
+ }
+ }
+
+ private void readConfiguration(String configFilename){
+ File gatewaysFile = new File(configFilename);
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ Configuration config = mapper.readValue(gatewaysFile, Configuration.class);
+
+ switches = config.getSwitches();
+ interfaces = new HashMap<String, Interface>();
+ for (Interface intf : config.getInterfaces()){
+ interfaces.put(intf.getName(), intf);
+ }
+ bgpPeers = new HashMap<InetAddress, BgpPeer>();
+ for (BgpPeer peer : config.getPeers()){
+ bgpPeers.put(peer.getIpAddress(), peer);
+ }
+
+ bgpdAttachmentPoint = new SwitchPort(
+ new Dpid(config.getBgpdAttachmentDpid()),
+ new Port(config.getBgpdAttachmentPort()));
+
+ bgpdMacAddress = config.getBgpdMacAddress();
+ vlan = config.getVlan();
+ } catch (JsonParseException e) {
+ log.error("Error in JSON file", e);
+ System.exit(1);
+ } catch (JsonMappingException e) {
+ log.error("Error in JSON file", e);
+ System.exit(1);
+ } catch (IOException e) {
+ log.error("Error reading JSON file", e);
+ System.exit(1);
+ }
+
+ //Populate the interface Patricia Trie
+ for (Interface intf : interfaces.values()) {
+ Prefix prefix = new Prefix(intf.getIpAddress().getAddress(), intf.getPrefixLength());
+ interfacePtrie.put(prefix, intf);
+ }
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l
+ = new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IBgpRouteService.class);
+ l.add(IConfigInfoService.class);
+ return l;
+ }
+
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
+ Map<Class<? extends IFloodlightService>, IFloodlightService> m
+ = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
+ m.put(IBgpRouteService.class, this);
+ m.put(IConfigInfoService.class, this);
+ return m;
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l
+ = new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(ITopologyService.class);
+ l.add(IRestApiService.class);
+ return l;
+ }
+
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+
+ ptree = new PatriciaTrie<RibEntry>(32);
+ interfacePtrie = new PatriciaTrie<Interface>(32);
+
+ ribUpdates = new LinkedBlockingQueue<RibUpdate>();
+
+ // Register floodlight provider and REST handler.
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+ topologyService = context.getServiceImpl(ITopologyService.class);
+ linkDiscoveryService = context.getServiceImpl(ILinkDiscoveryService.class);
+ restApi = context.getServiceImpl(IRestApiService.class);
+
+ //TODO We'll initialise this here for now, but it should really be done as
+ //part of the controller core
+ //proxyArp = new ProxyArpManager(floodlightProvider, topologyService, this, restApi);
+ proxyArp = new BgpProxyArpManager();
+ proxyArp.init(floodlightProvider, topologyService, this, restApi);
+ //proxyArp = context.getServiceImpl(IProxyArpService.class);
+
+ linkUpdates = new ArrayList<LDUpdate>();
+ ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
+ topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
+
+ topologyNetService = new TopologyManager("");
+
+ pathsWaitingOnArp = new HashMap<InetAddress, Path>();
+ prefixesWaitingOnArp = Multimaps.synchronizedSetMultimap(
+ HashMultimap.<InetAddress, RibUpdate>create());
+
+ pushedPaths = new HashMap<InetAddress, Path>();
+ prefixToPath = new HashMap<Prefix, Path>();
+ pushedFlows = HashMultimap.<Prefix, PushedFlowMod>create();
+
+ flowCache = new FlowCache(floodlightProvider);
+
+ bgpUpdatesExecutor = Executors.newSingleThreadExecutor(
+ new ThreadFactoryBuilder().setNameFormat("bgp-updates-%d").build());
+
+ //Read in config values
+ bgpdRestIp = context.getConfigParams(this).get("BgpdRestIp");
+ if (bgpdRestIp == null){
+ log.error("BgpdRestIp property not found in config file");
+ System.exit(1);
+ }
+ else {
+ log.info("BgpdRestIp set to {}", bgpdRestIp);
+ }
+
+ routerId = context.getConfigParams(this).get("RouterId");
+ if (routerId == null){
+ log.error("RouterId property not found in config file");
+ System.exit(1);
+ }
+ else {
+ log.info("RouterId set to {}", routerId);
+ }
+
+ String configFilenameParameter = context.getConfigParams(this).get("configfile");
+ if (configFilenameParameter != null){
+ configFilename = configFilenameParameter;
+ }
+ log.debug("Config file set to {}", configFilename);
+
+ readConfiguration(configFilename);
+ }
+
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ restApi.addRestletRoutable(new BgpRouteWebRoutable());
+ topologyService.addListener(this);
+ floodlightProvider.addOFSwitchListener(this);
+
+ proxyArp.startUp();
+
+ //floodlightProvider.addOFMessageListener(OFType.PACKET_IN, proxyArp);
+
+ //Retrieve the RIB from BGPd during startup
+ retrieveRib();
+ }
+
+ public IPatriciaTrie<RibEntry> getPtree() {
+ return ptree;
+ }
+
+ public void clearPtree() {
+ ptree = new PatriciaTrie<RibEntry>(32);
+ }
+
+ public String getBGPdRestIp() {
+ return bgpdRestIp;
+ }
+
+ public String getRouterId() {
+ return routerId;
+ }
+
+ private void retrieveRib(){
+ String url = "http://" + bgpdRestIp + "/wm/bgp/" + routerId;
+ String response = RestClient.get(url);
+
+ if (response.equals("")){
+ return;
+ }
+
+ response = response.replaceAll("\"", "'");
+ JSONObject jsonObj = (JSONObject) JSONSerializer.toJSON(response);
+ JSONArray rib_json_array = jsonObj.getJSONArray("rib");
+ String router_id = jsonObj.getString("router-id");
+
+ int size = rib_json_array.size();
+
+ log.info("Retrived RIB of {} entries from BGPd", size);
+
+ for (int j = 0; j < size; j++) {
+ JSONObject second_json_object = rib_json_array.getJSONObject(j);
+ String prefix = second_json_object.getString("prefix");
+ String nexthop = second_json_object.getString("nexthop");
+
+ //insert each rib entry into the local rib;
+ String[] substring = prefix.split("/");
+ String prefix1 = substring[0];
+ String mask1 = substring[1];
+
+ Prefix p;
+ try {
+ p = new Prefix(prefix1, Integer.valueOf(mask1));
+ } catch (NumberFormatException e) {
+ log.warn("Wrong mask format in RIB JSON: {}", mask1);
+ continue;
+ } catch (IllegalArgumentException e1) {
+ log.warn("Wrong prefix format in RIB JSON: {}", prefix1);
+ continue;
+ }
+
+ RibEntry rib = new RibEntry(router_id, nexthop);
+
+ try {
+ ribUpdates.put(new RibUpdate(Operation.UPDATE, p, rib));
+ } catch (InterruptedException e) {
+ log.debug("Interrupted while pushing onto update queue");
+ }
+ }
+ }
+
+ @Override
+ public void newRibUpdate(RibUpdate update) {
+ try {
+ ribUpdates.put(update);
+ } catch (InterruptedException e) {
+ log.debug("Interrupted while putting on ribUpdates queue", e);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ public synchronized void processRibAdd(RibUpdate update) {
+ Prefix prefix = update.getPrefix();
+
+ log.debug("Processing prefix add {}", prefix);
+
+ RibEntry rib = ptree.put(prefix, update.getRibEntry());
+
+ if (rib != null && !rib.equals(update.getRibEntry())) {
+ //There was an existing nexthop for this prefix. This update supersedes that,
+ //so we need to remove the old flows for this prefix from the switches
+ _processDeletePrefix(prefix, rib);
+ }
+
+ if (update.getRibEntry().getNextHop().equals(
+ InetAddresses.forString("0.0.0.0"))) {
+ //Route originated by SDN domain
+ //We don't handle these at the moment
+ log.debug("Own route {} to {}", prefix,
+ update.getRibEntry().getNextHop().getHostAddress());
+ return;
+ }
+
+ _processRibAdd(update);
+ }
+
+ private void _processRibAdd(RibUpdate update) {
+ Prefix prefix = update.getPrefix();
+ RibEntry rib = update.getRibEntry();
+
+ InetAddress dstIpAddress = rib.getNextHop();
+
+ //See if we know the MAC address of the next hop
+ MACAddress nextHopMacAddress = proxyArp.getMacAddress(rib.getNextHop());
+
+ //Find the attachment point (egress interface) of the next hop
+ Interface egressInterface = null;
+ if (bgpPeers.containsKey(dstIpAddress)) {
+ //Route to a peer
+ log.debug("Route to peer {}", dstIpAddress);
+ BgpPeer peer = bgpPeers.get(dstIpAddress);
+ egressInterface = interfaces.get(peer.getInterfaceName());
+ }
+ else {
+ //Route to non-peer
+ log.debug("Route to non-peer {}", dstIpAddress);
+ egressInterface = interfacePtrie.match(
+ new Prefix(dstIpAddress.getAddress(), 32));
+ if (egressInterface == null) {
+ log.warn("No outgoing interface found for {}", dstIpAddress.getHostAddress());
+ return;
+ }
+ }
+
+ if (nextHopMacAddress == null) {
+ prefixesWaitingOnArp.put(dstIpAddress,
+ new RibUpdate(Operation.UPDATE, prefix, rib));
+ proxyArp.sendArpRequest(dstIpAddress, this, true);
+ return;
+ }
+ else {
+ if (!bgpPeers.containsKey(dstIpAddress)) {
+ //If the prefix is for a non-peer we need to ensure there's a path,
+ //and push one if there isn't.
+ Path path = pushedPaths.get(dstIpAddress);
+ if (path == null) {
+ path = new Path(egressInterface, dstIpAddress);
+ calculateAndPushPath(path, nextHopMacAddress);
+ pushedPaths.put(dstIpAddress, path);
+ }
+
+ path.incrementUsers();
+ prefixToPath.put(prefix, path);
+ }
+
+ //For all prefixes we need to add the first-hop mac-rewriting flows
+ addPrefixFlows(prefix, egressInterface, nextHopMacAddress);
+ }
+ }
+
+ private void addPrefixFlows(Prefix prefix, Interface egressInterface, MACAddress nextHopMacAddress) {
+ log.debug("Adding flows for prefix {}, next hop mac {}",
+ prefix, nextHopMacAddress);
+
+ //We only need one flow mod per switch, so pick one interface on each switch
+ Map<Long, Interface> srcInterfaces = new HashMap<Long, Interface>();
+ for (Interface intf : interfaces.values()) {
+ if (!srcInterfaces.containsKey(intf.getDpid())
+ && !intf.equals(egressInterface)) {
+ srcInterfaces.put(intf.getDpid(), intf);
+ }
+ }
+
+ //Add a flow to rewrite mac for this prefix to all other border switches
+ for (Interface srcInterface : srcInterfaces.values()) {
+ DataPath shortestPath;
+ if (topology == null) {
+ shortestPath = topologyNetService.getDatabaseShortestPath(
+ srcInterface.getSwitchPort(),
+ egressInterface.getSwitchPort());
+ }
+ else {
+ shortestPath = topologyNetService.getTopologyShortestPath(
+ topology, srcInterface.getSwitchPort(),
+ egressInterface.getSwitchPort());
+ }
+
+ if (shortestPath == null){
+ log.debug("Shortest path between {} and {} not found",
+ srcInterface.getSwitchPort(),
+ egressInterface.getSwitchPort());
+ return; // just quit here?
+ }
+
+ //Set up the flow mod
+ OFFlowMod fm = (OFFlowMod) floodlightProvider.getOFMessageFactory()
+ .getMessage(OFType.FLOW_MOD);
+
+ fm.setIdleTimeout((short)0)
+ .setHardTimeout((short)0)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setCookie(MAC_RW_COOKIE)
+ .setCommand(OFFlowMod.OFPFC_ADD)
+ .setPriority(SDNIP_PRIORITY)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH
+ + OFActionDataLayerDestination.MINIMUM_LENGTH
+ + OFActionOutput.MINIMUM_LENGTH);
+
+ OFMatch match = new OFMatch();
+ match.setDataLayerType(Ethernet.TYPE_IPv4);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
+
+ match.setFromCIDR(prefix.toString(), OFMatch.STR_NW_DST);
+ fm.setMatch(match);
+
+ //Set up MAC rewrite action
+ OFActionDataLayerDestination macRewriteAction = new OFActionDataLayerDestination();
+ macRewriteAction.setDataLayerAddress(nextHopMacAddress.toBytes());
+
+ //Set up output action
+ OFActionOutput outputAction = new OFActionOutput();
+ outputAction.setMaxLength((short)0xffff);
+ Port outputPort = shortestPath.flowEntries().get(0).outPort();
+ outputAction.setPort(outputPort.value());
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(macRewriteAction);
+ actions.add(outputAction);
+ fm.setActions(actions);
+
+ pushedFlows.put(prefix, new PushedFlowMod(srcInterface.getDpid(), fm));
+ flowCache.write(srcInterface.getDpid(), fm);
+
+ /*
+ * XXX Rate limit hack!
+ * This should be solved properly by adding a rate limiting
+ * layer on top of the switches if we know they need it.
+ */
+ try {
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
+ // TODO handle this properly
+ log.error("Interrupted", e);
+ }
+ }
+ }
+
+ public synchronized void processRibDelete(RibUpdate update) {
+ Prefix prefix = update.getPrefix();
+
+ if (ptree.remove(prefix, update.getRibEntry())) {
+ /*
+ * Only delete flows if an entry was actually removed from the trie.
+ * If no entry was removed, the <prefix, nexthop> wasn't there so
+ * it's probably already been removed and we don't need to do anything
+ */
+ _processDeletePrefix(prefix, update.getRibEntry());
+ }
+ }
+
+ private void _processDeletePrefix(Prefix prefix, RibEntry ribEntry) {
+ deletePrefixFlows(prefix);
+
+ log.debug("Deleting {} to {}", prefix, ribEntry.getNextHop());
+
+ if (!bgpPeers.containsKey(ribEntry.getNextHop())) {
+ log.debug("Getting path for route with non-peer nexthop");
+ Path path = prefixToPath.remove(prefix);
+
+ if (path != null) {
+ //path could be null if we added to the Ptree but didn't push
+ //flows yet because we were waiting to resolve ARP
+
+ path.decrementUsers();
+ if (path.getUsers() <= 0 && !path.isPermanent()) {
+ deletePath(path);
+ pushedPaths.remove(path.getDstIpAddress());
+ }
+ }
+ }
+ }
+
+ private void deletePrefixFlows(Prefix prefix) {
+ log.debug("Deleting flows for prefix {}", prefix);
+
+ Collection<PushedFlowMod> pushedFlowMods
+ = pushedFlows.removeAll(prefix);
+
+ for (PushedFlowMod pfm : pushedFlowMods) {
+ if (log.isTraceEnabled()) {
+ log.trace("Pushing a DELETE flow mod to {}, matches prefix {} with mac-rewrite {}",
+ new Object[] {HexString.toHexString(pfm.getDpid()),
+ pfm.getFlowMod().getMatch().getNetworkDestination() +
+ pfm.getFlowMod().getMatch().getNetworkDestinationMaskLen(),
+ HexString.toHexString(((OFActionDataLayerDestination)pfm.getFlowMod().getActions().get(0))
+ .getDataLayerAddress())});
+ }
+
+ sendDeleteFlowMod(pfm.getFlowMod(), pfm.getDpid());
+ }
+ }
+
+ private void deletePath(Path path) {
+ log.debug("Deleting flows for path to {}",
+ path.getDstIpAddress().getHostAddress());
+
+ for (PushedFlowMod pfm : path.getFlowMods()) {
+ if (log.isTraceEnabled()) {
+ log.trace("Pushing a DELETE flow mod to {}, dst MAC {}",
+ new Object[] {HexString.toHexString(pfm.getDpid()),
+ HexString.toHexString(pfm.getFlowMod().getMatch().getDataLayerDestination())
+ });
+ }
+
+ sendDeleteFlowMod(pfm.getFlowMod(), pfm.getDpid());
+ }
+ }
+
+ private void sendDeleteFlowMod(OFFlowMod addFlowMod, long dpid) {
+ flowCache.delete(dpid, addFlowMod);
+ }
+
+ //TODO test next-hop changes
+ //TODO check delete/add synchronization
+
+ /*
+ * On startup we need to calculate a full mesh of paths between all gateway
+ * switches
+ */
+ private void setupFullMesh(){
+ //For each border router, calculate and install a path from every other
+ //border switch to said border router. However, don't install the entry
+ //in to the first hop switch, as we need to install an entry to rewrite
+ //for each prefix received. This will be done later when prefixes have
+ //actually been received.
+
+ for (BgpPeer peer : bgpPeers.values()) {
+ Interface peerInterface = interfaces.get(peer.getInterfaceName());
+
+ //We know there's not already a Path here pushed, because this is
+ //called before all other routing
+ Path path = new Path(peerInterface, peer.getIpAddress());
+ path.setPermanent();
+
+ //See if we know the MAC address of the peer. If not we can't
+ //do anything until we learn it
+ MACAddress macAddress = proxyArp.getMacAddress(peer.getIpAddress());
+ if (macAddress == null) {
+ log.debug("Don't know MAC for {}", peer.getIpAddress().getHostAddress());
+ //Put in the pending paths list first
+ pathsWaitingOnArp.put(peer.getIpAddress(), path);
+
+ proxyArp.sendArpRequest(peer.getIpAddress(), this, true);
+ continue;
+ }
+
+ //If we know the MAC, lets go ahead and push the paths to this peer
+ calculateAndPushPath(path, macAddress);
+ }
+ }
+
+ private void calculateAndPushPath(Path path, MACAddress dstMacAddress) {
+ Interface dstInterface = path.getDstInterface();
+
+ log.debug("Setting up path to {}, {}", path.getDstIpAddress().getHostAddress(),
+ dstMacAddress);
+
+ List<PushedFlowMod> pushedFlows = new ArrayList<PushedFlowMod>();
+
+ for (Interface srcInterface : interfaces.values()) {
+ if (dstInterface.equals(srcInterface)){
+ continue;
+ }
+
+ DataPath shortestPath;
+ if (topology == null) {
+ shortestPath = topologyNetService.getDatabaseShortestPath(
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
+ }
+ else {
+ shortestPath = topologyNetService.getTopologyShortestPath(topology,
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
+ }
+
+ if (shortestPath == null){
+ log.warn("Shortest path between {} and {} not found",
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
+ return;
+ }
+
+ List<PushedFlowMod> pushedFlowMods = installPath(shortestPath.flowEntries(), dstMacAddress);
+ pushedFlows.addAll(pushedFlowMods);
+ }
+
+ path.setFlowMods(pushedFlows);
+ }
+
+ private List<PushedFlowMod> installPath(List<FlowEntry> flowEntries, MACAddress dstMacAddress){
+ List<PushedFlowMod> flowMods = new ArrayList<PushedFlowMod>();
+
+ //Set up the flow mod
+ OFFlowMod fm =
+ (OFFlowMod) floodlightProvider.getOFMessageFactory()
+ .getMessage(OFType.FLOW_MOD);
+
+ OFActionOutput action = new OFActionOutput();
+ action.setMaxLength((short)0xffff);
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(action);
+
+ fm.setIdleTimeout((short)0)
+ .setHardTimeout((short)0)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setCookie(L2_FWD_COOKIE)
+ .setCommand(OFFlowMod.OFPFC_ADD)
+ .setPriority(SDNIP_PRIORITY)
+ .setActions(actions)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
+
+ //Don't push the first flow entry. We need to push entries in the
+ //first switch based on IP prefix which we don't know yet.
+ for (int i = 1; i < flowEntries.size(); i++){
+ FlowEntry flowEntry = flowEntries.get(i);
+
+ OFMatch match = new OFMatch();
+ match.setDataLayerDestination(dstMacAddress.toBytes());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+ ((OFActionOutput) fm.getActions().get(0)).setPort(flowEntry.outPort().value());
+
+ fm.setMatch(match);
+
+ flowMods.add(new PushedFlowMod(flowEntry.dpid().value(), fm));
+
+ flowCache.write(flowEntry.dpid().value(), fm);
+
+ try {
+ fm = fm.clone();
+ } catch (CloneNotSupportedException e1) {
+ log.error("Failure cloning flow mod", e1);
+ }
+ }
+
+ return flowMods;
+ }
+
+ private void setupBgpPaths(){
+ for (BgpPeer bgpPeer : bgpPeers.values()){
+ Interface peerInterface = interfaces.get(bgpPeer.getInterfaceName());
+
+ DataPath path = topologyNetService.getDatabaseShortestPath(
+ peerInterface.getSwitchPort(), bgpdAttachmentPoint);
+
+ if (path == null){
+ log.debug("Unable to compute path for BGP traffic for {}",
+ bgpPeer.getIpAddress());
+ continue;
+ }
+
+ //Set up the flow mod
+ OFFlowMod fm =
+ (OFFlowMod) floodlightProvider.getOFMessageFactory()
+ .getMessage(OFType.FLOW_MOD);
+
+ OFActionOutput action = new OFActionOutput();
+ action.setMaxLength((short)0xffff);
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(action);
+
+ fm.setIdleTimeout((short)0)
+ .setHardTimeout((short)0)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setCookie(BGP_COOKIE)
+ .setCommand(OFFlowMod.OFPFC_ADD)
+ .setPriority(SDNIP_PRIORITY)
+ .setActions(actions)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
+
+ //Forward = gateway -> bgpd, reverse = bgpd -> gateway
+ OFMatch forwardMatchSrc = new OFMatch();
+
+ String interfaceCidrAddress = peerInterface.getIpAddress().getHostAddress()
+ + "/32";
+ String peerCidrAddress = bgpPeer.getIpAddress().getHostAddress()
+ + "/32";
+
+ //Common match fields
+ forwardMatchSrc.setDataLayerType(Ethernet.TYPE_IPv4);
+ forwardMatchSrc.setNetworkProtocol(IPv4.PROTOCOL_TCP);
+ //forwardMatchSrc.setTransportDestination(BGP_PORT);
+ forwardMatchSrc.setWildcards(forwardMatchSrc.getWildcards() & ~OFMatch.OFPFW_IN_PORT
+ & ~OFMatch.OFPFW_DL_TYPE & ~OFMatch.OFPFW_NW_PROTO);
+
+
+ OFMatch reverseMatchSrc = forwardMatchSrc.clone();
+
+ forwardMatchSrc.setFromCIDR(peerCidrAddress, OFMatch.STR_NW_SRC);
+ forwardMatchSrc.setFromCIDR(interfaceCidrAddress, OFMatch.STR_NW_DST);
+
+ OFMatch forwardMatchDst = forwardMatchSrc.clone();
+
+ forwardMatchSrc.setTransportSource(BGP_PORT);
+ forwardMatchSrc.setWildcards(forwardMatchSrc.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+ forwardMatchDst.setTransportDestination(BGP_PORT);
+ forwardMatchDst.setWildcards(forwardMatchDst.getWildcards() & ~OFMatch.OFPFW_TP_DST);
+
+ reverseMatchSrc.setFromCIDR(interfaceCidrAddress, OFMatch.STR_NW_SRC);
+ reverseMatchSrc.setFromCIDR(peerCidrAddress, OFMatch.STR_NW_DST);
+
+ OFMatch reverseMatchDst = reverseMatchSrc.clone();
+
+ reverseMatchSrc.setTransportSource(BGP_PORT);
+ reverseMatchSrc.setWildcards(forwardMatchSrc.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+ reverseMatchDst.setTransportDestination(BGP_PORT);
+ reverseMatchDst.setWildcards(forwardMatchDst.getWildcards() & ~OFMatch.OFPFW_TP_DST);
+
+ fm.setMatch(forwardMatchSrc);
+
+ OFMatch forwardIcmpMatch = new OFMatch();
+ forwardIcmpMatch.setDataLayerType(Ethernet.TYPE_IPv4);
+ forwardIcmpMatch.setNetworkProtocol(IPv4.PROTOCOL_ICMP);
+ forwardIcmpMatch.setWildcards(forwardIcmpMatch.getWildcards() &
+ ~OFMatch.OFPFW_DL_TYPE & ~OFMatch.OFPFW_NW_PROTO);
+
+ OFMatch reverseIcmpMatch = forwardIcmpMatch.clone();
+ forwardIcmpMatch.setFromCIDR(interfaceCidrAddress, OFMatch.STR_NW_DST);
+ reverseIcmpMatch.setFromCIDR(interfaceCidrAddress, OFMatch.STR_NW_SRC);
+
+ for (FlowEntry flowEntry : path.flowEntries()){
+ OFFlowMod forwardFlowModSrc, forwardFlowModDst;
+ OFFlowMod reverseFlowModSrc, reverseFlowModDst;
+ OFFlowMod forwardIcmp, reverseIcmp;
+ try {
+ forwardFlowModSrc = fm.clone();
+ forwardFlowModDst = fm.clone();
+ reverseFlowModSrc = fm.clone();
+ reverseFlowModDst = fm.clone();
+ forwardIcmp = fm.clone();
+ reverseIcmp = fm.clone();
+ } catch (CloneNotSupportedException e) {
+ log.warn("Clone failed", e);
+ continue;
+ }
+
+ forwardMatchSrc.setInputPort(flowEntry.inPort().value());
+ forwardFlowModSrc.setMatch(forwardMatchSrc);
+ ((OFActionOutput)forwardFlowModSrc.getActions().get(0))
+ .setPort(flowEntry.outPort().value());
+
+ forwardMatchDst.setInputPort(flowEntry.inPort().value());
+ forwardFlowModDst.setMatch(forwardMatchDst);
+ ((OFActionOutput)forwardFlowModDst.getActions().get(0))
+ .setPort(flowEntry.outPort().value());
+
+ reverseMatchSrc.setInputPort(flowEntry.outPort().value());
+ reverseFlowModSrc.setMatch(reverseMatchSrc);
+ ((OFActionOutput)reverseFlowModSrc.getActions().get(0))
+ .setPort(flowEntry.inPort().value());
+
+ reverseMatchDst.setInputPort(flowEntry.outPort().value());
+ reverseFlowModDst.setMatch(reverseMatchDst);
+ ((OFActionOutput)reverseFlowModDst.getActions().get(0))
+ .setPort(flowEntry.inPort().value());
+
+ ((OFActionOutput)forwardIcmp.getActions().get(0))
+ .setPort(flowEntry.outPort().value());
+ forwardIcmp.setMatch(forwardIcmpMatch);
+
+ ((OFActionOutput)reverseIcmp.getActions().get(0))
+ .setPort(flowEntry.inPort().value());
+ reverseIcmp.setMatch(reverseIcmpMatch);
+
+ List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(6);
+ flowModList.add(forwardFlowModSrc);
+ flowModList.add(forwardFlowModDst);
+ flowModList.add(reverseFlowModSrc);
+ flowModList.add(reverseFlowModDst);
+ flowModList.add(forwardIcmp);
+ flowModList.add(reverseIcmp);
+ flowCache.write(flowEntry.dpid().value(), flowModList);
+ }
+ }
+ }
+
+ @Override
+ public void arpResponse(InetAddress ipAddress, MACAddress macAddress) {
+ log.debug("Received ARP response: {} => {}",
+ ipAddress.getHostAddress(), macAddress);
+
+ /*
+ * We synchronize on this to prevent changes to the ptree while we're pushing
+ * flows to the switches. If the ptree changes, the ptree and switches
+ * could get out of sync.
+ */
+ synchronized (this) {
+ Path path = pathsWaitingOnArp.remove(ipAddress);
+
+ if (path != null) {
+ log.debug("Pushing path to {} at {} on {}", new Object[] {
+ path.getDstIpAddress().getHostAddress(), macAddress,
+ path.getDstInterface().getSwitchPort()});
+ //These paths should always be to BGP peers. Paths to non-peers are
+ //handled once the first prefix is ready to push
+ if (pushedPaths.containsKey(path.getDstInterface())) {
+ //A path already got pushed to this endpoint while we were waiting
+ //for ARP. We'll copy over the permanent attribute if it is set on this path.
+ if (path.isPermanent()) {
+ pushedPaths.get(path.getDstInterface()).setPermanent();
+ }
+ }
+ else {
+ calculateAndPushPath(path, macAddress);
+ pushedPaths.put(path.getDstIpAddress(), path);
+ }
+ }
+
+ Set<RibUpdate> prefixesToPush = prefixesWaitingOnArp.removeAll(ipAddress);
+
+ for (RibUpdate update : prefixesToPush) {
+ //These will always be adds
+
+ RibEntry rib = ptree.lookup(update.getPrefix());
+ if (rib != null && rib.equals(update.getRibEntry())) {
+ log.debug("Pushing prefix {} next hop {}", update.getPrefix(),
+ rib.getNextHop().getHostAddress());
+ //We only push prefix flows if the prefix is still in the ptree
+ //and the next hop is the same as our update. The prefix could
+ //have been removed while we were waiting for the ARP, or the
+ //next hop could have changed.
+ _processRibAdd(update);
+ } else {
+ log.debug("Received ARP response, but {},{} is no longer in ptree",
+ update.getPrefix(), update.getRibEntry());
+ }
+ }
+ }
+ }
+
+ private void setupArpFlows() {
+ OFMatch match = new OFMatch();
+ match.setDataLayerType(Ethernet.TYPE_ARP);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
+
+ OFFlowMod fm = new OFFlowMod();
+ fm.setMatch(match);
+
+ OFActionOutput action = new OFActionOutput();
+ action.setPort(OFPort.OFPP_CONTROLLER.getValue());
+ action.setMaxLength((short)0xffff);
+ List<OFAction> actions = new ArrayList<OFAction>(1);
+ actions.add(action);
+ fm.setActions(actions);
+
+ fm.setIdleTimeout((short)0)
+ .setHardTimeout((short)0)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setCookie(0)
+ .setCommand(OFFlowMod.OFPFC_ADD)
+ .setPriority(ARP_PRIORITY)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH);
+
+ for (String strdpid : switches){
+ flowCache.write(HexString.toLong(strdpid), fm);
+ }
+ }
+
+ private void setupDefaultDropFlows() {
+ OFFlowMod fm = new OFFlowMod();
+ fm.setMatch(new OFMatch());
+ fm.setActions(new ArrayList<OFAction>()); //No action means drop
+
+ fm.setIdleTimeout((short)0)
+ .setHardTimeout((short)0)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setCookie(0)
+ .setCommand(OFFlowMod.OFPFC_ADD)
+ .setPriority((short)0)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH);
+
+ OFFlowMod fmLLDP;
+ OFFlowMod fmBDDP;
+ try {
+ fmLLDP = fm.clone();
+ fmBDDP = fm.clone();
+ } catch (CloneNotSupportedException e1) {
+ log.error("Error cloning flow mod", e1);
+ return;
+ }
+
+ OFMatch matchLLDP = new OFMatch();
+ matchLLDP.setDataLayerType((short)0x8942);
+ matchLLDP.setWildcards(matchLLDP.getWildcards() & ~ OFMatch.OFPFW_DL_TYPE);
+ fmLLDP.setMatch(matchLLDP);
+
+ OFMatch matchBDDP = new OFMatch();
+ matchBDDP.setDataLayerType((short)0x88cc);
+ matchBDDP.setWildcards(matchBDDP.getWildcards() & ~ OFMatch.OFPFW_DL_TYPE);
+ fmBDDP.setMatch(matchBDDP);
+
+ OFActionOutput action = new OFActionOutput();
+ action.setPort(OFPort.OFPP_CONTROLLER.getValue());
+ action.setMaxLength((short)0xffff);
+ List<OFAction> actions = new ArrayList<OFAction>(1);
+ actions.add(action);
+
+ fmLLDP.setActions(actions);
+ fmBDDP.setActions(actions);
+
+ fmLLDP.setPriority(ARP_PRIORITY);
+ fmLLDP.setLengthU(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH);
+ fmBDDP.setPriority(ARP_PRIORITY);
+ fmBDDP.setLengthU(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH);
+
+ List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(3);
+ flowModList.add(fm);
+ flowModList.add(fmLLDP);
+ flowModList.add(fmBDDP);
+
+ for (String strdpid : switches){
+ flowCache.write(HexString.toLong(strdpid), flowModList);
+ }
+ }
+
+ private void beginRouting(){
+ log.debug("Topology is now ready, beginning routing function");
+ topology = topologyNetService.newDatabaseTopology();
+
+ setupArpFlows();
+ setupDefaultDropFlows();
+
+ setupBgpPaths();
+ setupFullMesh();
+
+ //Suppress link discovery on external-facing router ports
+ for (Interface intf : interfaces.values()) {
+ linkDiscoveryService.AddToSuppressLLDPs(intf.getDpid(), intf.getPort());
+ }
+
+ bgpUpdatesExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ doUpdatesThread();
+ }
+ });
+ }
+
+ private void checkSwitchesConnected(){
+ for (String dpid : switches){
+ if (floodlightProvider.getSwitches().get(HexString.toLong(dpid)) == null){
+ log.debug("Not all switches are here yet");
+ return;
+ }
+ }
+ switchesConnected = true;
+ }
+
+ //Actually we only need to go half way round to verify full mesh connectivity
+ //(n^2)/2
+ private void checkTopologyReady(){
+ for (Interface dstInterface : interfaces.values()) {
+ for (Interface srcInterface : interfaces.values()) {
+ if (dstInterface.equals(srcInterface)) {
+ continue;
+ }
+
+ DataPath shortestPath = topologyNetService.getDatabaseShortestPath(
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
+
+ if (shortestPath == null){
+ log.debug("Shortest path between {} and {} not found",
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
+ return;
+ }
+ }
+ }
+ topologyReady = true;
+ }
+
+ private void checkStatus(){
+ if (!switchesConnected){
+ checkSwitchesConnected();
+ }
+ boolean oldTopologyReadyStatus = topologyReady;
+ if (switchesConnected && !topologyReady){
+ checkTopologyReady();
+ }
+ if (!oldTopologyReadyStatus && topologyReady){
+ beginRouting();
+ }
+ }
+
+ private void doUpdatesThread() {
+ boolean interrupted = false;
+ try {
+ while (true) {
+ try {
+ RibUpdate update = ribUpdates.take();
+ switch (update.getOperation()){
+ case UPDATE:
+ if (validateUpdate(update)) {
+ processRibAdd(update);
+ }
+ else {
+ log.debug("Rib UPDATE out of order: {} via {}",
+ update.getPrefix(), update.getRibEntry().getNextHop());
+ }
+ break;
+ case DELETE:
+ if (validateUpdate(update)) {
+ processRibDelete(update);
+ }
+ else {
+ log.debug("Rib DELETE out of order: {} via {}",
+ update.getPrefix(), update.getRibEntry().getNextHop());
+ }
+ break;
+ }
+ } catch (InterruptedException e) {
+ log.debug("Interrupted while taking from updates queue", e);
+ interrupted = true;
+ } catch (Exception e) {
+ log.debug("exception", e);
+ }
+ }
+ } finally {
+ if (interrupted) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ private boolean validateUpdate(RibUpdate update) {
+ RibEntry newEntry = update.getRibEntry();
+ RibEntry oldEntry = ptree.lookup(update.getPrefix());
+
+ //If there is no existing entry we must assume this is the most recent
+ //update. However this might not always be the case as we might have a
+ //POST then DELETE reordering.
+ //if (oldEntry == null || !newEntry.getNextHop().equals(oldEntry.getNextHop())) {
+ if (oldEntry == null) {
+ return true;
+ }
+
+ // This handles the case where routes are gathered in the initial
+ // request because they don't have sequence number info
+ if (newEntry.getSysUpTime() == -1 && newEntry.getSequenceNum() == -1) {
+ return true;
+ }
+
+ if (newEntry.getSysUpTime() > oldEntry.getSysUpTime()) {
+ return true;
+ }
+ else if (newEntry.getSysUpTime() == oldEntry.getSysUpTime()) {
+ if (newEntry.getSequenceNum() > oldEntry.getSequenceNum()) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void topologyChanged() {
+ if (topologyReady) {
+ return;
+ }
+
+ boolean refreshNeeded = false;
+ for (LDUpdate ldu : topologyService.getLastLinkUpdates()){
+ if (!ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.LINK_UPDATED)){
+ //We don't need to recalculate anything for just link updates
+ //They happen very frequently
+ refreshNeeded = true;
+ }
+
+ log.debug("Topo change {}", ldu.getOperation());
+
+ if (ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.LINK_ADDED)){
+ synchronized (linkUpdates) {
+ linkUpdates.add(ldu);
+ }
+ }
+ }
+
+ if (refreshNeeded && !topologyReady){
+ topologyChangeDetectorTask.reschedule(TOPO_DETECTION_WAIT, TimeUnit.SECONDS);
+ }
+ }
+
+ @Override
+ public void addedSwitch(IOFSwitch sw) {
+ if (!topologyReady) {
+ sw.clearAllFlowMods();
+ }
+
+ flowCache.switchConnected(sw);
+ }
+
+ @Override
+ public void removedSwitch(IOFSwitch sw) {}
+
+ @Override
+ public void switchPortChanged(Long switchId) {}
+
+ @Override
+ public String getName() {
+ return "BgpRoute";
+ }
+
+ /*
+ * IConfigInfoService methods
+ */
+
+ @Override
+ public boolean isInterfaceAddress(InetAddress address) {
+ Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
+ return (intf != null && intf.getIpAddress().equals(address));
+ }
+
+ @Override
+ public boolean inConnectedNetwork(InetAddress address) {
+ Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
+ return (intf != null && !intf.getIpAddress().equals(address));
+ }
+
+ @Override
+ public boolean fromExternalNetwork(long inDpid, short inPort) {
+ for (Interface intf : interfaces.values()) {
+ if (intf.getDpid() == inDpid && intf.getPort() == inPort) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Interface getOutgoingInterface(InetAddress dstIpAddress) {
+ return interfacePtrie.match(new Prefix(dstIpAddress.getAddress(), 32));
+ }
+
+ @Override
+ public boolean hasLayer3Configuration() {
+ return !interfaces.isEmpty();
+ }
+
+ @Override
+ public MACAddress getRouterMacAddress() {
+ return bgpdMacAddress;
+ }
+
+ @Override
+ public short getVlan() {
+ return vlan;
+ }
+
+ /*
+ * TODO This is a hack to get the REST API to work for ProxyArpManager.
+ * The REST API is currently tied to the Floodlight module system and we
+ * need to separate it to allow ONOS modules to use it. For now we will
+ * proxy calls through to the ProxyArpManager (which is not a Floodlight
+ * module) through this class which is a module.
+ */
+ @Override
+ public MACAddress getMacAddress(InetAddress ipAddress) {
+ return proxyArp.getMacAddress(ipAddress);
+ }
+
+ @Override
+ public void sendArpRequest(InetAddress ipAddress, IArpRequester requester,
+ boolean retry) {
+ proxyArp.sendArpRequest(ipAddress, requester, retry);
+ }
+
+ @Override
+ public List<String> getMappings() {
+ return proxyArp.getMappings();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java
new file mode 100644
index 0000000..ddc1e25
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResource.java
@@ -0,0 +1,176 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.util.Iterator;
+
+import net.onrc.onos.ofcontroller.bgproute.RibUpdate.Operation;
+
+import org.restlet.resource.Delete;
+import org.restlet.resource.Get;
+import org.restlet.resource.Post;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BgpRouteResource extends ServerResource {
+
+ protected final static Logger log = LoggerFactory.getLogger(BgpRouteResource.class);
+
+ @Get
+ public String get(String fmJson) {
+ String dest = (String) getRequestAttributes().get("dest");
+ String output = "";
+ IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
+ get(IBgpRouteService.class.getCanonicalName());
+
+ if (dest != null) {
+ //TODO Needs to be changed to use the new RestClient.get().
+
+ // the dest here refers to router-id
+ //bgpdRestIp includes port number, such as 1.1.1.1:8080
+ String BGPdRestIp = bgpRoute.getBGPdRestIp();
+ String url="http://"+BGPdRestIp+"/wm/bgp/"+dest;
+
+ //Doesn't actually do anything with the response
+ RestClient.get(url);
+
+ output="Get rib from bgpd finished!\n";
+ return output;
+ }
+ else {
+ IPatriciaTrie<RibEntry> ptree = bgpRoute.getPtree();
+ output += "{\n \"rib\": [\n";
+ boolean printed = false;
+
+ synchronized(ptree) {
+ Iterator<IPatriciaTrie.Entry<RibEntry>> it = ptree.iterator();
+ while (it.hasNext()) {
+ IPatriciaTrie.Entry<RibEntry> entry = it.next();
+
+ if (printed == true) {
+ output += ",\n";
+ }
+
+ output += " {\"prefix\": \"" + entry.getPrefix() +"\", ";
+ output += "\"nexthop\": \"" + entry.getValue().getNextHop().getHostAddress() +"\"}";
+
+ printed = true;
+ }
+ }
+
+ output += "\n ]\n}\n";
+ }
+
+ return output;
+ }
+
+ @Post
+ public String store(String fmJson) {
+ IBgpRouteService bgpRoute = (IBgpRouteService) getContext().getAttributes().
+ get(IBgpRouteService.class.getCanonicalName());
+
+ String strSysuptime = (String) getRequestAttributes().get("sysuptime");
+ String strSequence = (String) getRequestAttributes().get("sequence");
+ String routerId = (String) getRequestAttributes().get("routerid");
+ String prefix = (String) getRequestAttributes().get("prefix");
+ String mask = (String) getRequestAttributes().get("mask");
+ String nexthop = (String) getRequestAttributes().get("nexthop");
+ String capability = (String) getRequestAttributes().get("capability");
+
+ log.debug("sysuptime: {}", strSysuptime);
+ log.debug("sequence: {}", strSequence);
+
+ String reply = "";
+
+ if (capability == null) {
+ // this is a prefix add
+ Prefix p;
+ long sysUpTime, sequenceNum;
+ try {
+ p = new Prefix(prefix, Integer.valueOf(mask));
+ sysUpTime = Long.parseLong(strSysuptime);
+ sequenceNum = Long.parseLong(strSequence);
+ } catch (NumberFormatException e) {
+ reply = "[POST: mask format is wrong]";
+ log.info(reply);
+ return reply + "\n";
+ } catch (IllegalArgumentException e1) {
+ reply = "[POST: prefix format is wrong]";
+ log.info(reply);
+ return reply + "\n";
+ }
+
+ RibEntry rib = new RibEntry(routerId, nexthop, sysUpTime, sequenceNum);
+
+ bgpRoute.newRibUpdate(new RibUpdate(Operation.UPDATE, p, rib));
+
+ reply = "[POST: " + prefix + "/" + mask + ":" + nexthop + "]";
+ log.info(reply);
+ }
+ else if(capability.equals("1")) {
+ reply = "[POST-capability: " + capability + "]\n";
+ log.info(reply);
+ // to store the number in the top node of the Ptree
+ }
+ else {
+ reply = "[POST-capability: " + capability + "]\n";
+ log.info(reply);
+ // to store the number in the top node of the Ptree
+ }
+
+ return reply + "\n";
+ }
+
+ @Delete
+ public String delete(String fmJson) {
+ IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
+ get(IBgpRouteService.class.getCanonicalName());
+
+ String strSysuptime = (String) getRequestAttributes().get("sysuptime");
+ String strSequence = (String) getRequestAttributes().get("sequence");
+ String routerId = (String) getRequestAttributes().get("routerid");
+ String prefix = (String) getRequestAttributes().get("prefix");
+ String mask = (String) getRequestAttributes().get("mask");
+ String nextHop = (String) getRequestAttributes().get("nexthop");
+ String capability = (String) getRequestAttributes().get("capability");
+
+ log.debug("sysuptime: {}", strSysuptime);
+ log.debug("sequence: {}", strSequence);
+
+ String reply = "";
+
+ if (capability == null) {
+ // this is a prefix delete
+ Prefix p;
+ long sysUpTime, sequenceNum;
+ try {
+ p = new Prefix(prefix, Integer.valueOf(mask));
+ sysUpTime = Long.parseLong(strSysuptime);
+ sequenceNum = Long.parseLong(strSequence);
+ } catch (NumberFormatException e) {
+ reply = "[DELE: mask format is wrong]";
+ log.info(reply);
+ return reply + "\n";
+ } catch (IllegalArgumentException e1) {
+ reply = "[DELE: prefix format is wrong]";
+ log.info(reply);
+ return reply + "\n";
+ }
+
+ RibEntry r = new RibEntry(routerId, nextHop, sysUpTime, sequenceNum);
+
+ bgpRoute.newRibUpdate(new RibUpdate(Operation.DELETE, p, r));
+
+ reply =reply + "[DELE: " + prefix + "/" + mask + ":" + nextHop + "]";
+ }
+ else {
+ // clear the local rib: Ptree
+ bgpRoute.clearPtree();
+ reply = "[DELE-capability: " + capability + "; The local RibEntry is cleared!]\n";
+
+ // to store the number in the top node of the Ptree
+ }
+
+ log.info(reply);
+ return reply + "\n";
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResourceSynch.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResourceSynch.java
new file mode 100644
index 0000000..fe0ad87
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteResourceSynch.java
@@ -0,0 +1,71 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+
+import org.restlet.resource.Post;
+import org.restlet.resource.Delete;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class BgpRouteResourceSynch extends ServerResource {
+
+ protected final static Logger log = LoggerFactory
+ .getLogger(BgpRouteResource.class);
+
+ @Post
+ public String store(String fmJson) {
+
+ IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
+ get(IBgpRouteService.class.getCanonicalName());
+
+ String router_id = (String) getRequestAttributes().get("routerid");
+ String prefix = (String) getRequestAttributes().get("prefix");
+ String mask = (String) getRequestAttributes().get("mask");
+ String nexthop = (String) getRequestAttributes().get("nexthop");
+
+ try{
+
+ String BGPdRestIp = bgpRoute.getBGPdRestIp();
+
+ //bgpdRestIp includes port number, such as 1.1.1.1:8080
+ RestClient.post("http://"+BGPdRestIp+"/wm/bgp/"+router_id+"/"+prefix+"/"+mask+"/"+nexthop);
+ }catch(Exception e)
+ {e.printStackTrace();}
+
+ String reply = "";
+ reply = "[POST: " + prefix + "/" + mask + ":" + nexthop + "/synch]";
+ log.info(reply);
+
+ return reply + "\n";
+
+
+ }
+
+ @Delete
+ public String delete(String fmJson) {
+ IBgpRouteService bgpRoute = (IBgpRouteService)getContext().getAttributes().
+ get(IBgpRouteService.class.getCanonicalName());
+
+ String routerId = (String) getRequestAttributes().get("routerid");
+ String prefix = (String) getRequestAttributes().get("prefix");
+ String mask = (String) getRequestAttributes().get("mask");
+ String nextHop = (String) getRequestAttributes().get("nexthop");
+
+ String reply = "";
+ try{
+ String BGPdRestIp = bgpRoute.getBGPdRestIp();
+
+ RestClient.delete("http://"+BGPdRestIp+"/wm/bgp/"+routerId+"/"+prefix+"/"+mask+"/"+nextHop);
+
+ }catch(Exception e)
+ {e.printStackTrace();}
+
+ reply =reply + "[DELE: " + prefix + "/" + mask + ":" + nextHop + "/synch]";
+
+ log.info(reply);
+
+
+ return reply + "\n";
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/BgpRouteWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteWebRoutable.java
similarity index 70%
rename from src/main/java/net/floodlightcontroller/bgproute/BgpRouteWebRoutable.java
rename to src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteWebRoutable.java
index 37d5696..26971b0 100644
--- a/src/main/java/net/floodlightcontroller/bgproute/BgpRouteWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRouteWebRoutable.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.bgproute;
+package net.onrc.onos.ofcontroller.bgproute;
import org.restlet.Context;
import org.restlet.Restlet;
@@ -12,7 +12,8 @@
Router router = new Router(context);
router.attach("/json", BgpRouteResource.class);
router.attach("/rib/{dest}", BgpRouteResource.class);
- router.attach("/{routerid}/{prefix}/{mask}/{nexthop}", BgpRouteResource.class);
+ router.attach("/{sysuptime}/{sequence}/{routerid}/{prefix}/{mask}/{nexthop}", BgpRouteResource.class);
+ router.attach("/{routerid}/{prefix}/{mask}/{nexthop}/synch", BgpRouteResourceSynch.class);
router.attach("/{routerid}/{capability}", BgpRouteResource.class);
return router;
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java
new file mode 100644
index 0000000..4c81d1b
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java
@@ -0,0 +1,87 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.util.Collections;
+import java.util.List;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.openflow.util.HexString;
+
+public class Configuration {
+ private long bgpdAttachmentDpid;
+ private short bgpdAttachmentPort;
+ private MACAddress bgpdMacAddress;
+ private short vlan;
+ private List<String> switches;
+ private List<Interface> interfaces;
+ private List<BgpPeer> peers;
+
+ public Configuration() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public long getBgpdAttachmentDpid() {
+ return bgpdAttachmentDpid;
+ }
+
+ @JsonProperty("bgpdAttachmentDpid")
+ public void setBgpdAttachmentDpid(String bgpdAttachmentDpid) {
+ this.bgpdAttachmentDpid = HexString.toLong(bgpdAttachmentDpid);
+ }
+
+ public short getBgpdAttachmentPort() {
+ return bgpdAttachmentPort;
+ }
+
+ @JsonProperty("bgpdAttachmentPort")
+ public void setBgpdAttachmentPort(short bgpdAttachmentPort) {
+ this.bgpdAttachmentPort = bgpdAttachmentPort;
+ }
+
+ public MACAddress getBgpdMacAddress() {
+ return bgpdMacAddress;
+ }
+
+ @JsonProperty("bgpdMacAddress")
+ public void setBgpdMacAddress(String strMacAddress) {
+ this.bgpdMacAddress = MACAddress.valueOf(strMacAddress);
+ }
+
+ public List<String> getSwitches() {
+ return Collections.unmodifiableList(switches);
+ }
+
+ @JsonProperty("vlan")
+ public void setVlan(short vlan) {
+ this.vlan = vlan;
+ }
+
+ public short getVlan() {
+ return vlan;
+ }
+
+ @JsonProperty("switches")
+ public void setSwitches(List<String> switches) {
+ this.switches = switches;
+ }
+
+ public List<Interface> getInterfaces() {
+ return Collections.unmodifiableList(interfaces);
+ }
+
+ @JsonProperty("interfaces")
+ public void setInterfaces(List<Interface> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public List<BgpPeer> getPeers() {
+ return Collections.unmodifiableList(peers);
+ }
+
+ @JsonProperty("bgpPeers")
+ public void setPeers(List<BgpPeer> peers) {
+ this.peers = peers;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/FlowCache.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/FlowCache.java
new file mode 100644
index 0000000..1d16eb2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/FlowCache.java
@@ -0,0 +1,158 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFPort;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FlowCache {
+ private final static Logger log = LoggerFactory.getLogger(FlowCache.class);
+
+ private IFloodlightProviderService floodlightProvider;
+
+ private Map<Long, List<OFFlowMod>> flowCache;
+
+ private Comparator<OFFlowMod> cookieComparator = new Comparator<OFFlowMod>() {
+ @Override
+ public int compare(OFFlowMod fm1, OFFlowMod fm2) {
+ long difference = fm2.getCookie() - fm1.getCookie();
+
+ if (difference > 0) {
+ return 1;
+ }
+ else if (difference < 0) {
+ return -1;
+ }
+ else {
+ return 0;
+ }
+ }
+ };
+
+ public FlowCache(IFloodlightProviderService floodlightProvider) {
+ this.floodlightProvider = floodlightProvider;
+
+ flowCache = new HashMap<Long, List<OFFlowMod>>();
+ }
+
+ public synchronized void write(long dpid, OFFlowMod flowMod) {
+ List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(1);
+ flowModList.add(flowMod);
+ write(dpid, flowModList);
+ }
+
+ public synchronized void write(long dpid, List<OFFlowMod> flowMods) {
+ ensureCacheForSwitch(dpid);
+
+ List<OFFlowMod> clones = new ArrayList<OFFlowMod>(flowMods.size());
+
+ //Somehow the OFFlowMods we get passed in will change later on.
+ //No idea how this happens, but we can just clone to prevent problems
+ try {
+ for (OFFlowMod fm : flowMods) {
+ clones.add(fm.clone());
+ }
+ } catch (CloneNotSupportedException e) {
+ log.debug("Clone exception", e);
+ }
+
+ flowCache.get(dpid).addAll(clones);
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+
+ if (sw == null) {
+ log.debug("Switch not found when writing flow mods");
+ return;
+ }
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>(clones.size());
+ msgList.addAll(clones);
+
+ try {
+ sw.write(msgList, null);
+ } catch (IOException e) {
+ log.error("Error writing to switch", e);
+ }
+
+
+ }
+
+ public synchronized void delete(long dpid, OFFlowMod flowMod) {
+ List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(1);
+ flowModList.add(flowMod);
+ delete(dpid, flowModList);
+ }
+
+ public synchronized void delete(long dpid, List<OFFlowMod> flowMods) {
+ ensureCacheForSwitch(dpid);
+
+ //Remove the flow mods from the cache first before we alter them
+ flowCache.get(dpid).removeAll(flowMods);
+
+ //Alter the original flow mods to make them delete flow mods
+ for (OFFlowMod fm : flowMods) {
+ fm.setCommand(OFFlowMod.OFPFC_DELETE_STRICT)
+ .setOutPort(OFPort.OFPP_NONE)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH);
+
+ fm.getActions().clear();
+ }
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.debug("Switch not found when writing flow mods");
+ return;
+ }
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>(flowMods.size());
+ msgList.addAll(flowMods);
+
+ try {
+ sw.write(msgList, null);
+ } catch (IOException e) {
+ log.error("Error writing to switch", e);
+ }
+ }
+
+ //TODO can the Prontos handle being sent all flow mods in one message?
+ public synchronized void switchConnected(IOFSwitch sw) {
+ log.debug("Switch connected: {}", sw);
+
+ ensureCacheForSwitch(sw.getId());
+
+ List<OFFlowMod> flowMods = flowCache.get(sw.getId());
+
+ Collections.sort(flowMods, cookieComparator);
+
+ sw.clearAllFlowMods();
+
+ List<OFMessage> messages = new ArrayList<OFMessage>(flowMods.size());
+ messages.addAll(flowMods);
+
+ try {
+ sw.write(messages, null);
+ } catch (IOException e) {
+ log.error("Failure writing flow mods to switch {}",
+ HexString.toHexString(sw.getId()));
+ }
+ }
+
+ private void ensureCacheForSwitch(long dpid) {
+ if (!flowCache.containsKey(dpid)) {
+ flowCache.put(dpid, new ArrayList<OFFlowMod>());
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/IBgpRouteService.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/IBgpRouteService.java
new file mode 100644
index 0000000..954976c
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/IBgpRouteService.java
@@ -0,0 +1,27 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+public interface IBgpRouteService extends IFloodlightService {
+
+ //public RibEntry lookupRib(byte[] dest);
+
+ //public Ptree getPtree();
+ public IPatriciaTrie<RibEntry> getPtree();
+
+ public String getBGPdRestIp();
+
+ public String getRouterId();
+
+ public void clearPtree();
+
+ /**
+ * Pass a RIB update to the {@link IBgpRouteService}
+ * @param update
+ */
+ public void newRibUpdate(RibUpdate update);
+
+ //TODO This functionality should be provided by some sort of Ptree listener framework
+ //public void prefixAdded(PtreeNode node);
+ //public void prefixDeleted(PtreeNode node);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/IPatriciaTrie.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/IPatriciaTrie.java
new file mode 100644
index 0000000..1fb0716
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/IPatriciaTrie.java
@@ -0,0 +1,20 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.util.Iterator;
+
+public interface IPatriciaTrie<V> {
+ public V put(Prefix prefix, V value);
+
+ public V lookup(Prefix prefix);
+
+ public V match(Prefix prefix);
+
+ public boolean remove(Prefix prefix, V value);
+
+ public Iterator<Entry<V>> iterator();
+
+ interface Entry<V> {
+ public Prefix getPrefix();
+ public V getValue();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java
new file mode 100644
index 0000000..5db8f0a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java
@@ -0,0 +1,89 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.openflow.util.HexString;
+
+import com.google.common.net.InetAddresses;
+
+public class Interface {
+ private final String name;
+ private final SwitchPort switchPort;
+ private final long dpid;
+ private final short port;
+ private final InetAddress ipAddress;
+ private final int prefixLength;
+
+ @JsonCreator
+ public Interface (@JsonProperty("name") String name,
+ @JsonProperty("dpid") String dpid,
+ @JsonProperty("port") short port,
+ @JsonProperty("ipAddress") String ipAddress,
+ @JsonProperty("prefixLength") int prefixLength) {
+ this.name = name;
+ this.dpid = HexString.toLong(dpid);
+ this.port = port;
+ this.ipAddress = InetAddresses.forString(ipAddress);
+ this.prefixLength = prefixLength;
+ this.switchPort = new SwitchPort(new Dpid(this.dpid), new Port(this.port));
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public SwitchPort getSwitchPort() {
+ //TODO SwitchPort, Dpid and Port are mutable, but they could probably
+ //be made immutable which would prevent the need to copy
+ return new SwitchPort(new Dpid(dpid), new Port(port));
+ }
+
+ public long getDpid() {
+ return dpid;
+ }
+
+ public short getPort() {
+ return port;
+ }
+
+ public InetAddress getIpAddress() {
+ return ipAddress;
+ }
+
+ public int getPrefixLength() {
+ return prefixLength;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null || !(other instanceof Interface)) {
+ return false;
+ }
+
+ Interface otherInterface = (Interface)other;
+
+ //Don't check switchPort as it's comprised of dpid and port
+ return (name.equals(otherInterface.name)) &&
+ (dpid == otherInterface.dpid) &&
+ (port == otherInterface.port) &&
+ (ipAddress.equals(otherInterface.ipAddress)) &&
+ (prefixLength == otherInterface.prefixLength);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash = 31 * hash + name.hashCode();
+ hash = 31 * hash + (int)(dpid ^ dpid >>> 32);
+ hash = 31 * hash + (int)port;
+ hash = 31 * hash + ipAddress.hashCode();
+ hash = 31 * hash + prefixLength;
+ return hash;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Path.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Path.java
new file mode 100644
index 0000000..5cf4b09
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Path.java
@@ -0,0 +1,61 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ * A path is always assumed to be from all other interfaces (external-facing
+ * switchports) to the destination interface.
+ */
+
+public class Path {
+
+ private Interface dstInterface;
+ private InetAddress dstIpAddress;
+ private int numUsers = 0;
+
+ private List<PushedFlowMod> flowMods = null;
+ private boolean permanent = false;
+
+ public Path(Interface dstInterface, InetAddress dstIpAddress) {
+ this.dstInterface = dstInterface;
+ this.dstIpAddress = dstIpAddress;
+ }
+
+ public Interface getDstInterface() {
+ return dstInterface;
+ }
+
+ public InetAddress getDstIpAddress() {
+ return dstIpAddress;
+ }
+
+ public void incrementUsers() {
+ numUsers++;
+ }
+
+ public void decrementUsers() {
+ numUsers--;
+ }
+
+ public int getUsers() {
+ return numUsers;
+ }
+
+ public List<PushedFlowMod> getFlowMods() {
+ return Collections.unmodifiableList(flowMods);
+ }
+
+ public void setFlowMods(List<PushedFlowMod> flowMods) {
+ this.flowMods = flowMods;
+ }
+
+ public boolean isPermanent() {
+ return permanent;
+ }
+
+ public void setPermanent() {
+ permanent = true;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java
new file mode 100644
index 0000000..89dfb30
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrie.java
@@ -0,0 +1,506 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+public class PatriciaTrie<V> implements IPatriciaTrie<V> {
+ private final byte maskBits[] = {(byte)0x00, (byte)0x80, (byte)0xc0, (byte)0xe0, (byte)0xf0,
+ (byte)0xf8, (byte)0xfc, (byte)0xfe, (byte)0xff};
+
+ private int maxPrefixLength;
+
+ private Node top;
+
+ public PatriciaTrie(int maxPrefixLength) {
+ this.maxPrefixLength = maxPrefixLength;
+ }
+
+ @Override
+ public synchronized V put(Prefix prefix, V value) {
+ if (prefix.getPrefixLength() > maxPrefixLength) {
+ throw new IllegalArgumentException(String.format(
+ "Prefix length %d is greater than max prefix length %d",
+ prefix.getPrefixLength(), maxPrefixLength));
+ }
+
+ if (prefix == null || value == null) {
+ throw new NullPointerException();
+ }
+
+ Node node = top;
+ Node match = null;
+
+ while (node != null
+ && node.prefix.getPrefixLength() <= prefix.getPrefixLength()
+ && key_match(node.prefix.getAddress(), node.prefix.getPrefixLength(), prefix.getAddress(), prefix.getPrefixLength()) == true) {
+ if (node.prefix.getPrefixLength() == prefix.getPrefixLength()) {
+ /*
+ * Prefix is already in tree. This may be an aggregate node, in which case
+ * we are inserting a new prefix, or it could be an actual node, in which
+ * case we are inserting a new nexthop for the prefix and should return
+ * the old nexthop.
+ */
+ V oldValue = node.value;
+ node.value = value;
+ return oldValue;
+ }
+
+ match = node;
+
+ if (bit_check(prefix.getAddress(), node.prefix.getPrefixLength()) == true) {
+ node = node.right;
+ } else {
+ node = node.left;
+ }
+ }
+
+ Node add = null;
+
+ if (node == null) {
+ //add = new Node(p, r);
+ add = new Node(prefix);
+ add.value = value;
+
+ if (match != null) {
+ node_link(match, add);
+ } else {
+ top = add;
+ }
+ } else {
+ add = node_common(node, prefix.getAddress(), prefix.getPrefixLength());
+ if (add == null) {
+ //I think this is -ENOMEM?
+ //return null;
+ }
+
+ if (match != null) {
+ node_link(match, add);
+ } else {
+ top = add;
+ }
+ node_link(add, node);
+
+ if (add.prefix.getPrefixLength() != prefix.getPrefixLength()) {
+ match = add;
+
+ //add = new Node(p, r);
+ add = new Node(prefix);
+ add.value = value;
+ node_link(match, add);
+ }
+ else {
+ add.value = value;
+ }
+ }
+
+ //If we added a new Node, there was no previous mapping
+ return null;
+ //return addReference(add);
+ }
+
+ /*exact match*/
+ @Override
+ public synchronized V lookup(Prefix prefix) {
+ if (prefix.getPrefixLength() > maxPrefixLength) {
+ return null;
+ }
+
+ /*
+ Node node = top;
+
+ while (node != null
+ && node.prefix.getPrefixLength() <= p.getPrefixLength()
+ && key_match(node.prefix.getAddress(), node.prefix.getPrefixLength(), p.getAddress(), p.getPrefixLength()) == true) {
+ if (node.prefix.getPrefixLength() == p.getPrefixLength()) {
+ //return addReference(node);
+ return node.rib;
+ }
+
+ if (bit_check(p.getAddress(), node.prefix.getPrefixLength()) == true) {
+ node = node.right;
+ } else {
+ node = node.left;
+ }
+ }
+ */
+
+ Node node = findNode(prefix);
+
+ return node == null ? null : node.value;
+ }
+
+ /*closest containing prefix*/
+ @Override
+ public synchronized V match(Prefix prefix) {
+ //TODO
+ if (prefix.getPrefixLength() > maxPrefixLength) {
+ return null;
+ }
+
+ Node closestNode = findClosestNode(prefix);
+
+ return closestNode == null ? null : closestNode.value;
+ }
+
+ @Override
+ public synchronized boolean remove(Prefix prefix, V value) {
+ Node child;
+ Node parent;
+
+ if (prefix == null || value == null) {
+ return false;
+ }
+
+ Node node = findNode(prefix);
+
+ if (node == null || node.isAggregate() || !node.value.equals(value)) {
+ //Given <prefix, nexthop> mapping is not in the tree
+ return false;
+ }
+
+ if (node.left != null && node.right != null) {
+ //Remove the RibEntry entry and leave this node as an aggregate node
+ //In the future, maybe we should re-evaluate what the aggregate prefix should be?
+ //It shouldn't necessarily stay the same.
+ //More complicated if the above prefix is also aggregate.
+ node.value = null;
+ return true;
+ }
+
+ if (node.left != null) {
+ child = node.left;
+ } else {
+ child = node.right;
+ }
+
+ parent = node.parent;
+
+ if (child != null) {
+ child.parent = parent;
+ }
+
+ if (parent != null) {
+ if (parent.left == node) {
+ parent.left = child;
+ } else {
+ parent.right = child;
+ }
+ } else {
+ top = child;
+ }
+
+ /*
+ * TODO not sure what to do here. I think this is lazily deleting aggregate nodes,
+ * notice that it used to do nothing if it detected both children were not null earlier.
+ * But here, what we really should do is reevaluate the aggregate prefix of the parent
+ * node (if it is indeed an aggregate). Because at the moment, no aggregate node will ever
+ * be removed. BUT, I don't actually think this presents a correctness problem, at
+ * least from an external point of view.
+ */
+ //if (parent != null && parent.refCount == 0) {
+ //node_remove(parent);
+ //}
+
+ return true;
+ }
+
+ @Override
+ public Iterator<Entry<V>> iterator() {
+ return new PatriciaTrieIterator(top);
+ }
+
+ private Node findNode(Prefix prefix) {
+ Node node = top;
+
+ while (node != null
+ && node.prefix.getPrefixLength() <= prefix.getPrefixLength()
+ && key_match(node.prefix.getAddress(), node.prefix.getPrefixLength(), prefix.getAddress(), prefix.getPrefixLength()) == true) {
+ if (node.prefix.getPrefixLength() == prefix.getPrefixLength()) {
+ //return addReference(node);
+ return node;
+ }
+
+ if (bit_check(prefix.getAddress(), node.prefix.getPrefixLength()) == true) {
+ node = node.right;
+ } else {
+ node = node.left;
+ }
+ }
+
+ return null;
+ }
+
+ private Node findClosestNode(Prefix prefix) {
+ Node node = top;
+ Node match = null;
+
+ while (node != null
+ && node.prefix.getPrefixLength() <= prefix.getPrefixLength()
+ && key_match(node.prefix.getAddress(), node.prefix.getPrefixLength(), prefix.getAddress(), prefix.getPrefixLength()) == true) {
+ if (!node.isAggregate()) {
+ match = node;
+ }
+
+ if (bit_check(prefix.getAddress(), node.prefix.getPrefixLength()) == true) {
+ node = node.right;
+ } else {
+ node = node.left;
+ }
+ }
+
+ return match;
+ }
+
+ /*
+ * Receives a 1-based bit index
+ * Returns a 1-based byte index
+ * eg. (0 => 1), 1 => 1, 8 => 1, 9 => 2, 17 => 3
+ */
+ private int getByteContainingBit(int bitNumber) {
+ return Math.max((bitNumber + 7) / 8, 1);
+ }
+
+ private boolean key_match(byte [] key1, int key1_len, byte [] key2, int key2_len) {
+ //int offset;
+ //int shift;
+
+ if (key1_len > key2_len) {
+ return false;
+ }
+
+ int offset = (Math.min(key1_len, key2_len)) / 8;
+ int shift = (Math.min(key1_len, key2_len)) % 8;
+
+ if (shift != 0) {
+ if ((maskBits[shift] & (key1[offset] ^ key2[offset])) != 0) {
+ return false;
+ }
+ }
+
+ while (offset != 0) {
+ offset--;
+ if (key1[offset] != key2[offset]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean bit_check(byte [] key, int key_bits) {
+ int offset = key_bits / 8;
+ int shift = 7 - (key_bits % 8);
+ int bit = key[offset] & 0xff;
+
+ bit >>= shift;
+
+ if ((bit & 1) == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private void node_link(Node node, Node add) {
+ boolean bit = bit_check(add.prefix.getAddress(), node.prefix.getPrefixLength());
+
+ if (bit == true) {
+ node.right = add;
+ } else {
+ node.left = add;
+ }
+ add.parent = node;
+ }
+
+ private Node node_common(Node node, byte [] key, int key_bits) {
+ int i;
+ int limit = Math.min(node.prefix.getPrefixLength(), key_bits) / 8;
+
+ for (i = 0; i < limit; i++) {
+ if (node.prefix.getAddress()[i] != key[i]) {
+ break;
+ }
+ }
+
+ int common_len = i * 8;
+ int boundary = 0;
+
+ if (common_len != key_bits) {
+ byte diff = (byte)(node.prefix.getAddress()[i] ^ key[i]);
+ byte mask = (byte)0x80;
+ int shift_mask = 0;
+
+ while (common_len < key_bits && ((mask & diff) == 0)) {
+ boundary = 1;
+
+ shift_mask = (mask & 0xff);
+ shift_mask >>= 1;
+ mask = (byte)shift_mask;
+
+ common_len++;
+ }
+ }
+
+ //Node add = new Node(null, common_len, maxKeyOctets);
+ //if (add == null)
+ //Another -ENOMEM;
+ //return null;
+
+ //Creating a new Prefix with a prefix length of common_len
+ //Bits are copied from node's up until the common_len'th bit
+ //RibEntry is null, because this is an aggregate prefix - it's not
+ //actually been added to the trie.
+
+ byte[] newPrefix = new byte[getByteContainingBit(maxPrefixLength)];
+
+ int j;
+ for (j = 0; j < i; j++)
+ newPrefix[j] = node.prefix.getAddress()[j];
+
+ if (boundary != 0)
+ newPrefix[j] = (byte)(node.prefix.getAddress()[j] & maskBits[common_len % 8]);
+
+ //return new Node(new Prefix(newPrefix, common_len), null);
+ return new Node(new Prefix(newPrefix, common_len));
+ //return add;
+ }
+
+ private class Node {
+ public Node parent = null;
+ public Node left = null;
+ public Node right = null;
+
+ public final Prefix prefix;
+ public V value;
+
+ //public Node(Prefix p, RibEntry r) {
+ // this.prefix = p;
+ // this.rib = r;
+ //}
+ public Node(Prefix p) {
+ this.prefix = p;
+ }
+
+ public boolean isAggregate() {
+ return value == null;
+ }
+
+ public Entry<V> getEntry() {
+ return new PatriciaTrieEntry(prefix, value);
+ }
+ }
+
+ private class PatriciaTrieEntry implements Entry<V> {
+ private Prefix prefix;
+ private V value;
+
+ public PatriciaTrieEntry(Prefix prefix, V value) {
+ this.prefix = prefix;
+ this.value = value;
+ }
+
+ @Override
+ public Prefix getPrefix() {
+ return prefix;
+ }
+
+ @Override
+ public V getValue() {
+ return value;
+ }
+ }
+
+ private class PatriciaTrieIterator implements Iterator<Entry<V>> {
+
+ private Node current;
+ private boolean started = false;
+
+ public PatriciaTrieIterator(Node start) {
+ current = start;
+
+ //If the start is an aggregate node fast forward to find the next valid node
+ if (current != null && current.isAggregate()) {
+ current = findNext(current);
+ }
+ }
+
+ @Override
+ public boolean hasNext() {
+ if (current == null) {
+ return false;
+ }
+
+ if (!started) {
+ return true;
+ }
+
+ return findNext(current) != null;
+ }
+
+ @Override
+ public Entry<V> next() {
+ if (current == null) {
+ throw new NoSuchElementException();
+ }
+
+ if (!started) {
+ started = true;
+ return current.getEntry();
+ }
+
+ current = findNext(current);
+ if (current == null) {
+ throw new NoSuchElementException();
+ }
+
+ return current.getEntry();
+ }
+
+ @Override
+ public void remove() {
+ // TODO This could be implemented, if it were needed
+ throw new NoSuchElementException();
+ }
+
+ private Node findNext(Node node) {
+ Node next = null;
+
+ if (node.left != null) {
+ next = node.left;
+ //addReference(next);
+ //delReference(node);
+ //return next;
+ }
+ else if (node.right != null) {
+ next = node.right;
+ //addReference(next);
+ //delReference(node);
+ //return next;
+ }
+ else {
+ //Node start = node;
+ while (node.parent != null) {
+ if (node.parent.left == node && node.parent.right != null) {
+ next = node.parent.right;
+ //addReference(next);
+ //delReference(start);
+ //return next;
+ break;
+ }
+ node = node.parent;
+ }
+ }
+
+ if (next == null) {
+ return null;
+ }
+
+ //If the node doesn't have a value, it's not an actual node, it's an artifically
+ //inserted aggregate node. We don't want to return these to the user.
+ if (next.isAggregate()) {
+ return findNext(next);
+ }
+
+ return next;
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Prefix.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Prefix.java
new file mode 100644
index 0000000..05ce0a4
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Prefix.java
@@ -0,0 +1,135 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+
+import com.google.common.net.InetAddresses;
+
+public class Prefix {
+ private final int MAX_BYTES = 4;
+
+ private final int prefixLength;
+ private final byte[] address;
+
+ //For verifying the arguments and pretty printing
+ private final InetAddress inetAddress;
+
+ public Prefix(byte[] addr, int prefixLength) {
+ if (addr == null || addr.length != MAX_BYTES ||
+ prefixLength < 0 || prefixLength > MAX_BYTES * Byte.SIZE) {
+ throw new IllegalArgumentException();
+ }
+
+ address = canonicalizeAddress(addr, prefixLength);
+ this.prefixLength = prefixLength;
+
+ try {
+ inetAddress = InetAddress.getByAddress(address);
+ } catch (UnknownHostException e) {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public Prefix(String strAddress, int prefixLength) {
+ byte[] addr = null;
+ addr = InetAddresses.forString(strAddress).getAddress();
+
+ if (addr == null || addr.length != MAX_BYTES ||
+ prefixLength < 0 || prefixLength > MAX_BYTES * Byte.SIZE) {
+ throw new IllegalArgumentException();
+ }
+
+ address = canonicalizeAddress(addr, prefixLength);
+ this.prefixLength = prefixLength;
+
+ try {
+ inetAddress = InetAddress.getByAddress(address);
+ } catch (UnknownHostException e) {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ private byte[] canonicalizeAddress(byte[] address, int prefixLength) {
+ byte[] result = new byte[address.length];
+
+ if (prefixLength == 0) {
+ for (int i = 0; i < MAX_BYTES; i++) {
+ result[i] = 0;
+ }
+
+ return result;
+ }
+
+ result = Arrays.copyOf(address, address.length);
+
+ //Set all bytes after the end of the prefix to 0
+ int lastByteIndex = (prefixLength - 1) / Byte.SIZE;
+ for (int i = lastByteIndex; i < MAX_BYTES; i++) {
+ result[i] = 0;
+ }
+
+ byte lastByte = address[lastByteIndex];
+ byte mask = 0;
+ byte msb = (byte) 0x80;
+ int lastBit = (prefixLength - 1) % Byte.SIZE;
+ for (int i = 0; i < Byte.SIZE; i++) {
+ if (i <= lastBit) {
+ mask |= (msb >> i);
+ }
+ }
+
+ result[lastByteIndex] = (byte) (lastByte & mask);
+
+ return result;
+ }
+
+ public int getPrefixLength() {
+ return prefixLength;
+ }
+
+ public byte[] getAddress() {
+ return address;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null || !(other instanceof Prefix)) {
+ return false;
+ }
+
+ Prefix otherPrefix = (Prefix) other;
+
+ return (Arrays.equals(address, otherPrefix.address)) &&
+ (prefixLength == otherPrefix.prefixLength);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash = 31 * hash + prefixLength;
+ hash = 31 * hash + Arrays.hashCode(address);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ return inetAddress.getHostAddress() + "/" + prefixLength;
+ }
+
+ public String printAsBits() {
+ String result = "";
+ for (int i = 0; i < address.length; i++) {
+ byte b = address[i];
+ for (int j = 0; j < Byte.SIZE; j++) {
+ byte mask = (byte) (0x80 >>> j);
+ result += ((b & mask) == 0)? "0" : "1";
+ if (i*Byte.SIZE+j == prefixLength-1) {
+ return result;
+ }
+ }
+ result += " ";
+ }
+ return result.substring(0, result.length() - 1);
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/Ptree.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Ptree.java
similarity index 80%
rename from src/main/java/net/floodlightcontroller/bgproute/Ptree.java
rename to src/main/java/net/onrc/onos/ofcontroller/bgproute/Ptree.java
index d53789e..041061c 100644
--- a/src/main/java/net/floodlightcontroller/bgproute/Ptree.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Ptree.java
@@ -1,24 +1,33 @@
-package net.floodlightcontroller.bgproute;
+package net.onrc.onos.ofcontroller.bgproute;
+/*
+ * TODO This Ptree needs to be refactored if we're going to use it permenantly.
+ *
+ * The biggest problem is it leaks PTreeNode references - these need to stay within
+ * the Ptree as they contain data fundamental to the structure of the tree.
+ * You should put RIB entries in and get RIB entries out.
+ * Also we need to get rid of the referencing scheme to determine when to delete nodes.
+ * Deletes should be explicit, and there's no need to keep track of references if
+ * we don't leak them out the the Ptree.
+ */
public class Ptree {
- int maxKeyBits;
- int maxKeyOctets;
- int refCount;
- PtreeNode top;
- byte maskBits[] = { (byte)0x00, (byte)0x80, (byte)0xc0, (byte)0xe0, (byte)0xf0, (byte)0xf8, (byte)0xfc, (byte)0xfe, (byte)0xff };
+ private int maxKeyBits;
+ private int maxKeyOctets;
+ //private int refCount;
+ private PtreeNode top;
+ private byte maskBits[] = { (byte)0x00, (byte)0x80, (byte)0xc0, (byte)0xe0, (byte)0xf0, (byte)0xf8, (byte)0xfc, (byte)0xfe, (byte)0xff };
- // Constructor.
- Ptree(int max_key_bits) {
+ public Ptree(int max_key_bits) {
maxKeyBits = max_key_bits;
maxKeyOctets = bit_to_octet(max_key_bits);
- refCount = 0;
+ //refCount = 0;
}
-
- public PtreeNode acquire(byte [] key) {
+
+ public synchronized PtreeNode acquire(byte [] key) {
return acquire(key, maxKeyBits);
}
- public PtreeNode acquire(byte [] key, int key_bits) {
+ public synchronized PtreeNode acquire(byte [] key, int key_bits) {
if (key_bits > maxKeyBits) {
return null;
}
@@ -76,7 +85,7 @@
return addReference(add);
}
- public PtreeNode lookup(byte [] key, int key_bits) {
+ public synchronized PtreeNode lookup(byte [] key, int key_bits) {
if (key_bits > maxKeyBits) {
return null;
}
@@ -99,7 +108,7 @@
return null;
}
- public PtreeNode match(byte [] key, int key_bits) {
+ public synchronized PtreeNode match(byte [] key, int key_bits) {
if (key_bits > maxKeyBits) {
return null;
}
@@ -127,14 +136,14 @@
return null;
}
- public PtreeNode begin() {
+ public synchronized PtreeNode begin() {
if (top == null) {
return null;
}
return addReference(top);
}
- public PtreeNode next(PtreeNode node) {
+ public synchronized PtreeNode next(PtreeNode node) {
PtreeNode next;
if (node.left != null) {
@@ -175,7 +184,7 @@
return node;
}
- public void delReference(PtreeNode node) {
+ public synchronized void delReference(PtreeNode node) {
if (node.refCount > 0) {
node.refCount--;
}
diff --git a/src/main/java/net/floodlightcontroller/bgproute/PtreeNode.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PtreeNode.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/bgproute/PtreeNode.java
rename to src/main/java/net/onrc/onos/ofcontroller/bgproute/PtreeNode.java
index 4d2c265..264b0ee 100644
--- a/src/main/java/net/floodlightcontroller/bgproute/PtreeNode.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PtreeNode.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.bgproute;
+package net.onrc.onos.ofcontroller.bgproute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,8 +13,8 @@
public int refCount;
- public Rib rib;
- protected static Logger log = LoggerFactory.getLogger(BgpRoute.class);
+ public RibEntry rib;
+ protected final static Logger log = LoggerFactory.getLogger(BgpRoute.class);
PtreeNode(byte [] key, int key_bits, int max_key_octet) {
parent = null;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java
new file mode 100644
index 0000000..fd9ba6f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java
@@ -0,0 +1,32 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import org.openflow.protocol.OFFlowMod;
+
+/**
+ * Wraps up a DPID and a OFFlowMod so we know how to delete
+ * the flow if we have to.
+ *
+ * TODO This functionality should be handled by ONOS's flow layer in future.
+ *
+ */
+public class PushedFlowMod {
+ private long dpid;
+ private OFFlowMod flowMod;
+
+ public PushedFlowMod(long dpid, OFFlowMod flowMod) {
+ this.dpid = dpid;
+ try {
+ this.flowMod = flowMod.clone();
+ } catch (CloneNotSupportedException e) {
+ this.flowMod = flowMod;
+ }
+ }
+
+ public long getDpid() {
+ return dpid;
+ }
+
+ public OFFlowMod getFlowMod() {
+ return flowMod;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/RestClient.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RestClient.java
new file mode 100644
index 0000000..a9f2abe
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RestClient.java
@@ -0,0 +1,104 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class RestClient {
+ protected final static Logger log = LoggerFactory.getLogger(RestClient.class);
+
+ public static String get(String str) {
+ StringBuilder response = new StringBuilder();
+
+ try {
+
+ URL url = new URL(str);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setConnectTimeout(2 * 1000); //2 seconds
+ conn.setRequestMethod("GET");
+ conn.setRequestProperty("Accept", "application/json");
+
+ if (conn.getResponseCode() != 200) {
+ throw new RuntimeException("Failed : HTTP error code : "
+ + conn.getResponseCode());
+ }
+
+ if (!conn.getContentType().equals("application/json")){
+ log.warn("The content received from {} is not json", str);
+ }
+
+ BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
+ String line;
+ while ((line = br.readLine()) != null) {
+ response.append(line);
+ }
+
+ br.close();
+ conn.disconnect();
+
+ } catch (MalformedURLException e) {
+ log.error("Malformed URL for GET request", e);
+ } catch (ConnectTimeoutException e) {
+ log.warn("Couldn't connect remote REST server");
+ } catch (IOException e) {
+ log.warn("Couldn't connect remote REST server");
+ }
+
+ return response.toString();
+ }
+
+ public static void post (String str) {
+
+ try {
+ URL url = new URL(str);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setDoOutput(true);
+ conn.setRequestMethod("POST");
+ conn.setRequestProperty("Content-Type", "application/json");
+
+ if (conn.getResponseCode() != 200) {
+ throw new RuntimeException("Failed : HTTP error code : "
+ + conn.getResponseCode());
+ }
+
+ conn.disconnect();
+
+ } catch (MalformedURLException e) {
+ log.error("Malformed URL for GET request", e);
+ } catch (IOException e) {
+ log.warn("Couldn't connect remote REST server");
+ }
+ }
+
+
+ public static void delete (String str) {
+
+ try {
+ URL url = new URL(str);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("DELETE");
+ conn.setRequestProperty("Accept", "application/json");
+
+
+ if (conn.getResponseCode() != 200) {
+ throw new RuntimeException("Failed : HTTP error code : "
+ + conn.getResponseCode());
+ }
+
+ conn.disconnect();
+
+ } catch (MalformedURLException e) {
+ log.error("Malformed URL for GET request", e);
+ } catch (IOException e) {
+ log.warn("Couldn't connect remote REST server");
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java
new file mode 100644
index 0000000..ccf8951
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java
@@ -0,0 +1,80 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+
+import com.google.common.net.InetAddresses;
+
+public class RibEntry {
+ private final InetAddress routerId;
+ private final InetAddress nextHop;
+
+ /*
+ * Store the sequence number information provided on the update here for
+ * now. I think this *should* really be in the RibUpdate, and we should
+ * store RibUpdates in the Ptrie. But, that's a bigger change to change
+ * what the Ptrie stores.
+ */
+ private final long sysUpTime;
+ private final long sequenceNum;
+
+ /*
+ * Marker for RibEntries where we don't have sequence number info.
+ * The user of this class should make sure they don't check this data
+ * if they don't provide it.
+ */
+ private final static long NULL_TIME = -1;
+
+ public RibEntry(InetAddress routerId, InetAddress nextHop) {
+ this.routerId = routerId;
+ this.nextHop = nextHop;
+ sequenceNum = NULL_TIME;
+ sysUpTime = NULL_TIME;
+ }
+
+ public RibEntry(String routerId, String nextHop) {
+ this.routerId = InetAddresses.forString(routerId);
+ this.nextHop = InetAddresses.forString(nextHop);
+ sequenceNum = NULL_TIME;
+ sysUpTime = NULL_TIME;
+ }
+
+ public RibEntry(String routerId, String nextHop, long sysUpTime
+ , long sequenceNum) {
+ this.routerId = InetAddresses.forString(routerId);
+ this.nextHop = InetAddresses.forString(nextHop);
+ this.sequenceNum = sequenceNum;
+ this.sysUpTime = sysUpTime;
+ }
+
+ public InetAddress getNextHop() {
+ return nextHop;
+ }
+
+ public long getSysUpTime() {
+ return sysUpTime;
+ }
+
+ public long getSequenceNum() {
+ return sequenceNum;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null || !(other instanceof RibEntry)) {
+ return false;
+ }
+
+ RibEntry otherRibEntry = (RibEntry) other;
+
+ return this.routerId.equals(otherRibEntry.routerId)
+ && this.nextHop.equals(otherRibEntry.nextHop);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash = 31 * hash + routerId.hashCode();
+ hash = 31 * hash + nextHop.hashCode();
+ return hash;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibUpdate.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibUpdate.java
new file mode 100644
index 0000000..d866304
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibUpdate.java
@@ -0,0 +1,27 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+public class RibUpdate {
+ public enum Operation {UPDATE, DELETE};
+
+ private final Operation operation;
+ private final Prefix prefix;
+ private final RibEntry ribEntry;
+
+ public RibUpdate(Operation operation, Prefix prefix, RibEntry ribEntry) {
+ this.operation = operation;
+ this.prefix = prefix;
+ this.ribEntry = ribEntry;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public Prefix getPrefix() {
+ return prefix;
+ }
+
+ public RibEntry getRibEntry() {
+ return ribEntry;
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/IDeviceStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
similarity index 61%
rename from src/main/java/net/floodlightcontroller/devicemanager/IDeviceStorage.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
index f41e32c..be495b9 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/IDeviceStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
@@ -1,7 +1,7 @@
-package net.floodlightcontroller.devicemanager;
+package net.onrc.onos.ofcontroller.core;
-import net.floodlightcontroller.core.INetMapStorage;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
public interface IDeviceStorage extends INetMapStorage {
@@ -9,7 +9,7 @@
public IDeviceObject updateDevice(IDevice device);
public void removeDevice(IDevice device);
public IDeviceObject getDeviceByMac(String mac);
- public IDeviceObject getDeviceByIP(String ip);
+ public IDeviceObject getDeviceByIP(int ipv4Address);
public void changeDeviceAttachments(IDevice device);
public void changeDeviceIPv4Address(IDevice device);
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
new file mode 100644
index 0000000..8889092
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
@@ -0,0 +1,68 @@
+package net.onrc.onos.ofcontroller.core;
+
+import java.util.List;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+
+public interface ILinkStorage extends INetMapStorage {
+
+ /*
+ * Init with Storage conf
+ */
+ public void init(String conf);
+
+ /*
+ * Generic operation method
+ */
+ public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION op);
+
+ /*
+ * Link creation
+ */
+ public boolean addLink(Link link);
+ public boolean addLink(Link link, LinkInfo linfo);
+ public boolean addLinks(List<Link> links);
+
+ /*
+ * Link deletion
+ */
+ public boolean deleteLink(Link link);
+ public boolean deleteLinks(List<Link> links);
+
+ /*
+ * Utility method to delete links associated with dpid and port
+ * If only dpid is used, All links associated for switch are removed
+ * Useful for port up/down and also switch join/remove events
+ */
+ public boolean deleteLinksOnPort(Long dpid, short port);
+
+ /*
+ * Get Links from Storage
+ * If dpid and port both are specified specific link is retrieved
+ * If only dpid is set all links associated with Switch are retrieved
+ */
+ public List<Link> getLinks(Long dpid, short port);
+
+ /**
+ * Get list of all reverse links connected to the port specified by given DPID and port number.
+ * @param dpid DPID of desired port.
+ * @param port Port number of desired port.
+ * @return List of reverse links. Empty list if no port was found.
+ */
+ public List<Link> getReverseLinks(Long dpid, short port);
+
+ public List<Link> getLinks(String dpid);
+
+ /**
+ * Get list of all reverse links connected to the switch specified by
+ * given DPID.
+ * @param dpid DPID of desired switch.
+ * @return List of reverse links. Empty list if no port was found.
+ */
+ public List<Link> getReverseLinks(String dpid);
+
+ public List<Link> getActiveLinks();
+
+ public LinkInfo getLinkInfo(Link link);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java
new file mode 100644
index 0000000..8392a32
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java
@@ -0,0 +1,5 @@
+package net.onrc.onos.ofcontroller.core;
+
+public interface INetMapService {
+
+}
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
similarity index 90%
rename from src/main/java/net/floodlightcontroller/core/INetMapStorage.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
index 67c6631..b052540 100644
--- a/src/main/java/net/floodlightcontroller/core/INetMapStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
@@ -1,7 +1,7 @@
/**
*
*/
-package net.floodlightcontroller.core;
+package net.onrc.onos.ofcontroller.core;
/**
* @author pankaj
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
new file mode 100644
index 0000000..49ffd4e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -0,0 +1,555 @@
+package net.onrc.onos.ofcontroller.core;
+
+import net.onrc.onos.ofcontroller.flowmanager.web.DatapathSummarySerializer;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.frames.Adjacency;
+import com.tinkerpop.frames.Property;
+import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy;
+import com.tinkerpop.frames.annotations.gremlin.GremlinParam;
+import com.tinkerpop.frames.VertexFrame;
+
+/*
+ * This is the interfaces to make the objects for Cassandra DB.
+ * They are interfaces, but it is also implementation,
+ * so this handles various control to the objects.
+ * Please take a look at tinkerpop/frames annotation doc to understand more.
+ */
+public interface INetMapTopologyObjects {
+
+ public interface IBaseObject extends VertexFrame {
+
+ @JsonProperty("state")
+ @Property("state")
+ public String getState();
+
+ @Property("state")
+ public void setState(final String state);
+
+ @JsonIgnore
+ @Property("type")
+ public String getType();
+ @Property("type")
+ public void setType(final String type);
+
+ }
+
+ public interface ISwitchObject extends IBaseObject{
+
+ @JsonProperty("dpid")
+ @Property("dpid")
+ public String getDPID();
+
+ @Property("dpid")
+ public void setDPID(String dpid);
+
+ @JsonProperty("ports")
+ @Adjacency(label="on")
+ public Iterable<IPortObject> getPorts();
+
+ // Requires Frames 2.3.0
+ @JsonIgnore
+ @GremlinGroovy("it.out('on').has('number',port_num)")
+ public IPortObject getPort(@GremlinParam("port_num") final short port_num);
+
+ @Adjacency(label="on")
+ public void addPort(final IPortObject port);
+
+ @Adjacency(label="on")
+ public void removePort(final IPortObject port);
+
+ @JsonIgnore
+ @GremlinGroovy("it.out('on').out('host')")
+ public Iterable<IDeviceObject> getDevices();
+
+ @JsonIgnore
+ @Adjacency(label="switch",direction = Direction.IN)
+ public Iterable<IFlowEntry> getFlowEntries();
+
+ }
+
+ public interface IPortObject extends IBaseObject{
+
+ @JsonProperty("number")
+ @Property("number")
+ public Short getNumber();
+
+ @JsonIgnore
+ @Property("port_id")
+ public void setPortId(String id);
+
+ @JsonIgnore
+ @Property("port_id")
+ public String getPortId();
+
+ @Property("number")
+ public void setNumber(Short n);
+
+ @JsonProperty("desc")
+ @Property("desc")
+ public String getDesc();
+
+ @Property("desc")
+ public void setDesc(String s);
+
+ @JsonIgnore
+ @Property("port_state")
+ public Integer getPortState();
+
+ @Property("port_state")
+ public void setPortState(Integer s);
+
+ @JsonIgnore
+ @Adjacency(label="on",direction = Direction.IN)
+ public ISwitchObject getSwitch();
+
+ @JsonProperty("devices")
+ @Adjacency(label="host")
+ public Iterable<IDeviceObject> getDevices();
+
+ @Adjacency(label="host")
+ public void setDevice(final IDeviceObject device);
+
+ @Adjacency(label="host")
+ public void removeDevice(final IDeviceObject device);
+
+
+ @JsonIgnore
+ @Adjacency(label="inport",direction = Direction.IN)
+ public Iterable<IFlowEntry> getInFlowEntries();
+
+ @JsonIgnore
+ @Adjacency(label="outport",direction = Direction.IN)
+ public Iterable<IFlowEntry> getOutFlowEntries();
+
+
+ @JsonIgnore
+ @Adjacency(label="link")
+ public Iterable<IPortObject> getLinkedPorts();
+
+ @JsonIgnore
+ @Adjacency(label="link",direction = Direction.IN)
+ public Iterable<IPortObject> getReverseLinkedPorts();
+
+ @Adjacency(label="link")
+ public void removeLink(final IPortObject dest_port);
+
+ @Adjacency(label="link")
+ public void setLinkPort(final IPortObject dest_port);
+
+ // @JsonIgnore
+ // @Adjacency(label="link")
+ // public Iterable<ILinkObject> getLinks();
+ }
+
+ public interface IDeviceObject extends IBaseObject {
+
+ @JsonProperty("mac")
+ @Property("dl_addr")
+ public String getMACAddress();
+
+ @Property("dl_addr")
+ public void setMACAddress(String macaddr);
+
+ @JsonIgnore
+ @Adjacency(label="host",direction = Direction.IN)
+ public Iterable<IPortObject> getAttachedPorts();
+
+ @JsonIgnore
+ @Adjacency(label="host",direction=Direction.IN)
+ public void setHostPort(final IPortObject port);
+
+ @JsonIgnore
+ @Adjacency(label="host",direction=Direction.IN)
+ public void removeHostPort(final IPortObject port);
+
+ @JsonIgnore
+ @GremlinGroovy("it.in('host').in('on')")
+ public Iterable<ISwitchObject> getSwitch();
+
+ //
+ // IPv4 Addresses
+ //
+ @JsonProperty("ipv4addresses")
+ @Adjacency(label="hasAddress")
+ public Iterable<IIpv4Address> getIpv4Addresses();
+
+ @JsonIgnore
+ @GremlinGroovy("it.out('hasAddress').has('ipv4_address', ipv4Address)")
+ public IIpv4Address getIpv4Address(@GremlinParam("ipv4Address") final int ipv4Address);
+
+ @Adjacency(label="hasAddress")
+ public void addIpv4Address(final IIpv4Address ipv4Address);
+
+ @Adjacency(label="hasAddress")
+ public void removeIpv4Address(final IIpv4Address ipv4Address);
+
+/* @JsonProperty("dpid")
+ @GremlinGroovy("_().in('host').in('on').next().getProperty('dpid')")
+ public Iterable<String> getSwitchDPID();
+
+ @JsonProperty("number")
+ @GremlinGroovy("_().in('host').transform{it.number}")
+ public Iterable<Short> getPortNumber();
+
+ @JsonProperty("AttachmentPoint")
+ @GremlinGroovy("_().in('host').in('on').path(){it.number}{it.dpid}")
+ public Iterable<SwitchPort> getAttachmentPoints();*/
+ }
+
+ public interface IIpv4Address extends IBaseObject {
+
+ @JsonProperty("ipv4")
+ @Property("ipv4_address")
+ public int getIpv4Address();
+
+ @Property("ipv4_address")
+ public void setIpv4Address(int ipv4Address);
+
+ @JsonIgnore
+ @GremlinGroovy("it.in('hasAddress')")
+ public IDeviceObject getDevice();
+ }
+
+ public interface IFlowPath extends IBaseObject {
+ @JsonProperty("flowId")
+ @Property("flow_id")
+ public String getFlowId();
+
+ @Property("flow_id")
+ public void setFlowId(String flowId);
+
+ @JsonProperty("installerId")
+ @Property("installer_id")
+ public String getInstallerId();
+
+ @Property("installer_id")
+ public void setInstallerId(String installerId);
+
+ @JsonProperty("flowPathType")
+ @Property("flow_path_type")
+ public String getFlowPathType();
+
+ @Property("flow_path_type")
+ public void setFlowPathType(String flowPathType);
+
+ @JsonProperty("flowPathUserState")
+ @Property("user_state")
+ public String getFlowPathUserState();
+
+ @Property("user_state")
+ public void setFlowPathUserState(String userState);
+
+ @JsonProperty("flowPathFlags")
+ @Property("flow_path_flags")
+ public Long getFlowPathFlags();
+
+ @Property("flow_path_flags")
+ public void setFlowPathFlags(Long flowPathFlags);
+
+ @JsonProperty("srcDpid")
+ @Property("src_switch")
+ public String getSrcSwitch();
+
+ @Property("src_switch")
+ public void setSrcSwitch(String srcSwitch);
+
+ @JsonProperty("srcPort")
+ @Property("src_port")
+ public Short getSrcPort();
+
+ @Property("src_port")
+ public void setSrcPort(Short srcPort);
+
+ @JsonProperty("dstDpid")
+ @Property("dst_switch")
+ public String getDstSwitch();
+
+ @Property("dst_switch")
+ public void setDstSwitch(String dstSwitch);
+
+ @JsonProperty("dstPort")
+ @Property("dst_port")
+ public Short getDstPort();
+
+ @Property("dst_port")
+ public void setDstPort(Short dstPort);
+
+ @JsonProperty("dataPath")
+ @JsonSerialize(using=DatapathSummarySerializer.class)
+ @Property("data_path_summary")
+ public String getDataPathSummary();
+
+ @Property("data_path_summary")
+ public void setDataPathSummary(String dataPathSummary);
+
+ @JsonIgnore
+ @Adjacency(label="flow", direction=Direction.IN)
+ public Iterable<IFlowEntry> getFlowEntries();
+
+ @Adjacency(label="flow", direction=Direction.IN)
+ public void addFlowEntry(final IFlowEntry flowEntry);
+
+ @Adjacency(label="flow", direction=Direction.IN)
+ public void removeFlowEntry(final IFlowEntry flowEntry);
+
+ //
+ // Matching fields
+ //
+ @JsonIgnore
+ @Property("matchSrcMac")
+ public String getMatchSrcMac();
+
+ @Property("matchSrcMac")
+ public void setMatchSrcMac(String matchSrcMac);
+
+ @JsonIgnore
+ @Property("matchDstMac")
+ public String getMatchDstMac();
+
+ @Property("matchDstMac")
+ public void setMatchDstMac(String matchDstMac);
+
+ @JsonIgnore
+ @Property("matchEthernetFrameType")
+ public Short getMatchEthernetFrameType();
+
+ @Property("matchEthernetFrameType")
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+ @JsonIgnore
+ @Property("matchVlanId")
+ public Short getMatchVlanId();
+
+ @Property("matchVlanId")
+ public void setMatchVlanId(Short matchVlanId);
+
+ @JsonIgnore
+ @Property("matchVlanPriority")
+ public Byte getMatchVlanPriority();
+
+ @Property("matchVlanPriority")
+ public void setMatchVlanPriority(Byte matchVlanPriority);
+
+ @JsonIgnore
+ @Property("matchSrcIPv4Net")
+ public String getMatchSrcIPv4Net();
+
+ @Property("matchSrcIPv4Net")
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net);
+
+ @JsonIgnore
+ @Property("matchDstIPv4Net")
+ public String getMatchDstIPv4Net();
+
+ @Property("matchDstIPv4Net")
+ public void setMatchDstIPv4Net(String matchDstIPv4Net);
+
+ @JsonIgnore
+ @Property("matchIpProto")
+ public Byte getMatchIpProto();
+
+ @Property("matchIpProto")
+ public void setMatchIpProto(Byte matchIpProto);
+
+ @JsonIgnore
+ @Property("matchIpToS")
+ public Byte getMatchIpToS();
+
+ @Property("matchIpToS")
+ public void setMatchIpToS(Byte matchIpToS);
+
+ @JsonIgnore
+ @Property("matchSrcTcpUdpPort")
+ public Short getMatchSrcTcpUdpPort();
+
+ @Property("matchSrcTcpUdpPort")
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+ @JsonIgnore
+ @Property("matchDstTcpUdpPort")
+ public Short getMatchDstTcpUdpPort();
+
+ @Property("matchDstTcpUdpPort")
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
+ //
+ // Action-related fields
+ //
+ @Property("actions")
+ public String getActions();
+
+ @Property("actions")
+ public void setActions(String actionsStr);
+
+ //
+ // Other fields
+ //
+ @JsonIgnore
+ @GremlinGroovy("it.in('flow').out('switch')")
+ public Iterable<ISwitchObject> getSwitches();
+
+ @JsonIgnore
+ @Property("state")
+ public String getState();
+ }
+
+ public interface IFlowEntry extends IBaseObject {
+ @Property("flow_entry_id")
+ public String getFlowEntryId();
+
+ @Property("flow_entry_id")
+ public void setFlowEntryId(String flowEntryId);
+
+ @Property("switch_dpid")
+ public String getSwitchDpid();
+
+ @Property("switch_dpid")
+ public void setSwitchDpid(String switchDpid);
+
+ @Property("user_state")
+ public String getUserState();
+
+ @Property("user_state")
+ public void setUserState(String userState);
+
+ @Property("switch_state")
+ public String getSwitchState();
+
+ @Property("switch_state")
+ public void setSwitchState(String switchState);
+
+ @Property("error_state_type")
+ public String getErrorStateType();
+
+ @Property("error_state_type")
+ public void setErrorStateType(String errorStateType);
+
+ @Property("error_state_code")
+ public String getErrorStateCode();
+
+ @Property("error_state_code")
+ public void setErrorStateCode(String errorStateCode);
+
+ //
+ // Matching fields
+ //
+ @Property("matchInPort")
+ public Short getMatchInPort();
+
+ @Property("matchInPort")
+ public void setMatchInPort(Short matchInPort);
+
+ @Property("matchSrcMac")
+ public String getMatchSrcMac();
+
+ @Property("matchSrcMac")
+ public void setMatchSrcMac(String matchSrcMac);
+
+ @Property("matchDstMac")
+ public String getMatchDstMac();
+
+ @Property("matchDstMac")
+ public void setMatchDstMac(String matchDstMac);
+
+ @Property("matchEthernetFrameType")
+ public Short getMatchEthernetFrameType();
+
+ @Property("matchEthernetFrameType")
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+ @Property("matchVlanId")
+ public Short getMatchVlanId();
+
+ @Property("matchVlanId")
+ public void setMatchVlanId(Short matchVlanId);
+
+ @Property("matchVlanPriority")
+ public Byte getMatchVlanPriority();
+
+ @Property("matchVlanPriority")
+ public void setMatchVlanPriority(Byte matchVlanPriority);
+
+ @Property("matchSrcIPv4Net")
+ public String getMatchSrcIPv4Net();
+
+ @Property("matchSrcIPv4Net")
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net);
+
+ @Property("matchDstIPv4Net")
+ public String getMatchDstIPv4Net();
+
+ @Property("matchDstIPv4Net")
+ public void setMatchDstIPv4Net(String matchDstIPv4Net);
+
+ @Property("matchIpProto")
+ public Byte getMatchIpProto();
+
+ @Property("matchIpProto")
+ public void setMatchIpProto(Byte matchIpProto);
+
+ @Property("matchIpToS")
+ public Byte getMatchIpToS();
+
+ @Property("matchIpToS")
+ public void setMatchIpToS(Byte matchIpToS);
+
+ @Property("matchSrcTcpUdpPort")
+ public Short getMatchSrcTcpUdpPort();
+
+ @Property("matchSrcTcpUdpPort")
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+ @Property("matchDstTcpUdpPort")
+ public Short getMatchDstTcpUdpPort();
+
+ @Property("matchDstTcpUdpPort")
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
+ //
+ // Action-related fields
+ //
+ @Property("actionOutputPort")
+ public Short getActionOutputPort();
+
+ @Property("actionOutputPort")
+ public void setActionOutputPort(Short actionOutputPort);
+
+ @Property("actions")
+ public String getActions();
+
+ @Property("actions")
+ public void setActions(String actionsStr);
+
+ //
+ // Other fields
+ //
+ @Adjacency(label="flow")
+ public IFlowPath getFlow();
+
+ @Adjacency(label="flow")
+ public void setFlow(IFlowPath flow);
+
+ @Adjacency(label="switch")
+ public ISwitchObject getSwitch();
+
+ @Adjacency(label="switch")
+ public void setSwitch(ISwitchObject sw);
+
+ @Adjacency(label="inport")
+ public IPortObject getInPort();
+
+ @Adjacency(label="inport")
+ public void setInPort(IPortObject port);
+
+ @Adjacency(label="outport")
+ public IPortObject getOutPort();
+
+ @Adjacency(label="outport")
+ public void setOutPort(IPortObject port);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
new file mode 100644
index 0000000..f5ccc49
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
@@ -0,0 +1,32 @@
+package net.onrc.onos.ofcontroller.core;
+
+import java.util.List;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+
+public interface INetMapTopologyService extends INetMapService {
+
+ public interface ITopoSwitchService {
+ Iterable<ISwitchObject> getActiveSwitches();
+ Iterable<ISwitchObject> getAllSwitches();
+ Iterable<ISwitchObject> getInactiveSwitches();
+ Iterable<IPortObject> getPortsOnSwitch(String dpid);
+ IPortObject getPortOnSwitch(String dpid, short port_num);
+ void close();
+
+ }
+
+ public interface ITopoLinkService {
+ List<Link> getActiveLinks();
+ List<Link> getLinksOnSwitch(String dpid);
+ void close();
+ }
+ public interface ITopoDeviceService {
+ Iterable<IDeviceObject> getActiveDevices();
+ Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
+ Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
new file mode 100644
index 0000000..5deae69
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package net.onrc.onos.ofcontroller.core;
+
+import org.openflow.protocol.OFPhysicalPort;
+
+import net.floodlightcontroller.core.IOFSwitchListener;
+
+/**
+ * @author y-higuchi
+ *
+ */
+public interface IOFSwitchPortListener extends IOFSwitchListener {
+
+ /**
+ * Fired when ports on a switch area added
+ */
+ public void switchPortAdded(Long switchId, OFPhysicalPort port);
+
+ /**
+ * Fired when ports on a switch area removed
+ */
+ public void switchPortRemoved(Long switchId, OFPhysicalPort port);
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java b/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java
new file mode 100644
index 0000000..c9b0e2f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package net.onrc.onos.ofcontroller.core;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+/**
+ * @author y-higuchi
+ *
+ */
+public interface IOnosRemoteSwitch extends IOFSwitch {
+
+ /**
+ * Setup an unconnected switch with the info required.
+ * @param dpid of the switch
+ */
+ public void setupRemoteSwitch(Long dpid);
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
new file mode 100644
index 0000000..2cfab3f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
@@ -0,0 +1,60 @@
+package net.onrc.onos.ofcontroller.core;
+
+import java.util.List;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.protocol.OFPhysicalPort;
+
+public interface ISwitchStorage extends INetMapStorage {
+
+ public enum SwitchState {
+ INACTIVE,
+ ACTIVE
+ }
+
+ /*
+ * Initialize
+ */
+ public void init(String conf);
+ /*
+ * Update the switch details
+ */
+ public boolean updateSwitch(String dpid, SwitchState state, DM_OPERATION op);
+ /*
+ * Add a switch and all its associated ports
+ */
+ public boolean addSwitch(IOFSwitch sw);
+ /*
+ * Add a switch
+ */
+ public boolean addSwitch(String dpid);
+ /*
+ * Delete switch and associated ports
+ */
+ public boolean deleteSwitch(String dpid);
+ /*
+ * Deactivate the switch and associated ports
+ */
+ public boolean deactivateSwitch(String dpid);
+ /*
+ * Update the port details
+ */
+ public boolean updatePort(String dpid, short port, int state, String desc);
+ /*
+ * Associate a port on switch
+ */
+ public boolean addPort(String dpid, OFPhysicalPort port);
+ /*
+ * Delete a port on a switch by num
+ */
+ public boolean deletePort(String dpid, short port);
+
+ /**
+ * Get list of all ports on the switch specified by given DPID.
+ *
+ * @param dpid DPID of desired switch.
+ * @return List of port IDs. Empty list if no port was found.
+ */
+ public List<Short> getPorts(String dpid);
+}
diff --git a/src/main/java/net/floodlightcontroller/core/Main.java b/src/main/java/net/onrc/onos/ofcontroller/core/Main.java
similarity index 92%
rename from src/main/java/net/floodlightcontroller/core/Main.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/Main.java
index 91b317a..a80ac36 100644
--- a/src/main/java/net/floodlightcontroller/core/Main.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/Main.java
@@ -1,8 +1,9 @@
-package net.floodlightcontroller.core;
+package net.onrc.onos.ofcontroller.core;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
+import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.internal.CmdLineSettings;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.FloodlightModuleLoader;
@@ -10,7 +11,7 @@
import net.floodlightcontroller.restserver.IRestApiService;
/**
- * Host for the Floodlight main method
+ * Host for the ONOS main method
* @author alexreimers
*/
public class Main {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/config/DefaultConfiguration.java b/src/main/java/net/onrc/onos/ofcontroller/core/config/DefaultConfiguration.java
new file mode 100644
index 0000000..d9a291f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/config/DefaultConfiguration.java
@@ -0,0 +1,47 @@
+package net.onrc.onos.ofcontroller.core.config;
+
+import java.net.InetAddress;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.bgproute.Interface;
+
+import org.openflow.util.HexString;
+
+public class DefaultConfiguration implements IConfigInfoService {
+
+ @Override
+ public boolean isInterfaceAddress(InetAddress address) {
+ return false;
+ }
+
+ @Override
+ public boolean inConnectedNetwork(InetAddress address) {
+ return false;
+ }
+
+ @Override
+ public boolean fromExternalNetwork(long inDpid, short inPort) {
+ return false;
+ }
+
+ @Override
+ public Interface getOutgoingInterface(InetAddress dstIpAddress) {
+ return null;
+ }
+
+ @Override
+ public boolean hasLayer3Configuration() {
+ return false;
+ }
+
+ @Override
+ public MACAddress getRouterMacAddress() {
+ return MACAddress.valueOf(HexString.fromHexString("000000000001"));
+ }
+
+ @Override
+ public short getVlan() {
+ return 0;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/config/IConfigInfoService.java b/src/main/java/net/onrc/onos/ofcontroller/core/config/IConfigInfoService.java
new file mode 100644
index 0000000..7bbf483
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/config/IConfigInfoService.java
@@ -0,0 +1,48 @@
+package net.onrc.onos.ofcontroller.core.config;
+
+import java.net.InetAddress;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.bgproute.Interface;
+import net.onrc.onos.ofcontroller.core.module.IOnosService;
+
+/**
+ * Provides information about the layer 3 properties of the network.
+ * This is based on IP addresses configured on ports in the network.
+ *
+ */
+public interface IConfigInfoService extends IOnosService {
+ public boolean isInterfaceAddress(InetAddress address);
+ public boolean inConnectedNetwork(InetAddress address);
+ public boolean fromExternalNetwork(long inDpid, short inPort);
+
+ /**
+ * Retrieves the {@link Interface} object for the interface that packets
+ * to dstIpAddress will be sent out of. Returns null if dstIpAddress is not
+ * in a directly connected network, or if no interfaces are configured.
+ * @param dstIpAddress Destination IP address that we want to match to
+ * an outgoing interface
+ * @return The {@link Interface} object if found, null if not
+ */
+ public Interface getOutgoingInterface(InetAddress dstIpAddress);
+
+ /**
+ * Returns whether this controller has a layer 3 configuration
+ * (i.e. interfaces and IP addresses)
+ * @return True if IP addresses are configured, false if not
+ */
+ public boolean hasLayer3Configuration();
+
+ public MACAddress getRouterMacAddress();
+
+ /**
+ * We currently have basic vlan support for the situation when the contr
+ * is running within a single vlan. In this case, packets sent from the
+ * controller (e.g. ARP) need to be tagged with that vlan.
+ * @return The vlan id configured in the config file,
+ * or 0 if no vlan is configured.
+ */
+ public short getVlan();
+
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
new file mode 100644
index 0000000..f5f8b00
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
@@ -0,0 +1,314 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.SwitchPort;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+import com.google.common.net.InetAddresses;
+import com.thinkaurelius.titan.core.TitanException;
+
+/**
+ * This is the class for storing the information of devices into CassandraDB
+ * @author Pankaj
+ */
+public class DeviceStorageImpl implements IDeviceStorage {
+ protected final static Logger log = LoggerFactory.getLogger(DeviceStorageImpl.class);
+
+ private GraphDBOperation ope;
+
+ /***
+ * Initialize function. Before you use this class, please call this method
+ * @param conf configuration file for Cassandra DB
+ */
+ @Override
+ public void init(String conf) {
+ try {
+ ope = new GraphDBOperation(conf);
+ } catch (TitanException e) {
+ log.error("Couldn't open graph operation", e);
+ }
+ }
+
+ /***
+ * Finalize/close function. After you use this class, please call this method.
+ * It will close the DB connection.
+ */
+ @Override
+ public void close() {
+ ope.close();
+ }
+
+ /***
+ * Finalize/close function. After you use this class, please call this method.
+ * It will close the DB connection. This is for Java garbage collection.
+ */
+ @Override
+ public void finalize() {
+ close();
+ }
+
+ /***
+ * This function is for adding the device into the DB.
+ * @param device The device you want to add into the DB.
+ * @return IDeviceObject which was added in the DB.
+ */
+ @Override
+ public IDeviceObject addDevice(IDevice device) {
+ IDeviceObject obj = null;
+ for (int i = 0; i < 6; i++) {
+ try {
+ if (i > 0) {
+ log.debug("Retrying add device: i is {}", i);
+ }
+ if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+ log.debug("Adding device {}: found existing device", device.getMACAddressString());
+ } else {
+ obj = ope.newDevice();
+ log.debug("Adding device {}: creating new device", device.getMACAddressString());
+ }
+
+ changeDeviceAttachments(device, obj);
+
+ changeDeviceIpv4Addresses(device, obj);
+
+ obj.setMACAddress(device.getMACAddressString());
+ obj.setType("device");
+ obj.setState("ACTIVE");
+ ope.commit();
+
+ break;
+ //log.debug("Adding device {}",device.getMACAddressString());
+ } catch (TitanException e) {
+ ope.rollback();
+ log.error("Adding device {} failed", device.getMACAddressString(), e);
+ obj = null;
+ }
+ }
+
+ return obj;
+ }
+
+ /***
+ * This function is for updating the Device properties.
+ * @param device The device you want to add into the DB.
+ * @return IDeviceObject which was added in the DB.
+ */
+ @Override
+ public IDeviceObject updateDevice(IDevice device) {
+ return addDevice(device);
+ }
+
+ /***
+ * This function is for removing the Device from the DB.
+ * @param device The device you want to delete from the DB.
+ */
+ @Override
+ public void removeDevice(IDevice device) {
+ IDeviceObject dev;
+
+ if ((dev = ope.searchDevice(device.getMACAddressString())) != null) {
+ removeDevice(dev);
+ }
+ }
+
+ public void removeDevice(IDeviceObject deviceObject) {
+ String deviceMac = deviceObject.getMACAddress();
+
+ removeDeviceImpl(deviceObject);
+
+ try {
+ ope.commit();
+ log.debug("DeviceStorage:removeDevice mac:{} done", deviceMac);
+ } catch (TitanException e) {
+ ope.rollback();
+ log.error("DeviceStorage:removeDevice mac:{} failed", deviceMac);
+ }
+ }
+
+ public void removeDeviceImpl(IDeviceObject deviceObject) {
+ for (IIpv4Address ipv4AddressVertex : deviceObject.getIpv4Addresses()) {
+ ope.removeIpv4Address(ipv4AddressVertex);
+ }
+
+ ope.removeDevice(deviceObject);
+ }
+
+ /***
+ * This function is for getting the Device from the DB by Mac address of the device.
+ * @param mac The device mac address you want to get from the DB.
+ * @return IDeviceObject you want to get.
+ */
+ @Override
+ public IDeviceObject getDeviceByMac(String mac) {
+ return ope.searchDevice(mac);
+ }
+
+ /***
+ * This function is for getting the Device from the DB by IP address of the device.
+ * @param ip The device ip address you want to get from the DB.
+ * @return IDeviceObject you want to get.
+ */
+ @Override
+ public IDeviceObject getDeviceByIP(int ipv4Address) {
+ try {
+ IIpv4Address ipv4AddressVertex = ope.searchIpv4Address(ipv4Address);
+ if (ipv4AddressVertex != null) {
+ return ipv4AddressVertex.getDevice();
+ }
+ return null;
+ }
+ catch (TitanException e) {
+ log.error("DeviceStorage:getDeviceByIP:{} failed");
+ return null;
+ }
+ }
+
+ /***
+ * This function is for changing the Device attachment point.
+ * @param device The device you want change the attachment point
+ */
+ @Override
+ public void changeDeviceAttachments(IDevice device) {
+ IDeviceObject obj = null;
+ try {
+ if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+ log.debug("Changing device ports {}: found existing device", device.getMACAddressString());
+ changeDeviceAttachments(device, obj);
+ ope.commit();
+ } else {
+ log.debug("failed to search device...now adding {}", device.getMACAddressString());
+ addDevice(device);
+ }
+ } catch (TitanException e) {
+ ope.rollback();
+ log.error(":addDevice mac:{} failed", device.getMACAddressString());
+ }
+ }
+
+ /***
+ * This function is for changing the Device attachment point.
+ * @param device The new device you want change the attachment point
+ * @param obj The old device IDeviceObject that is going to change the attachment point.
+ */
+ public void changeDeviceAttachments(IDevice device, IDeviceObject obj) {
+ SwitchPort[] attachmentPoints = device.getAttachmentPoints();
+ List<IPortObject> attachedPorts = Lists.newArrayList(obj.getAttachedPorts());
+
+ for (SwitchPort ap : attachmentPoints) {
+ //Check if there is the port
+ IPortObject port = ope.searchPort(HexString.toHexString(ap.getSwitchDPID()),
+ (short) ap.getPort());
+ log.debug("New Switch Port is {},{}",
+ HexString.toHexString(ap.getSwitchDPID()), (short) ap.getPort());
+
+ if (port != null){
+ if (attachedPorts.contains(port)) {
+ log.debug("This is the port you already attached {}: do nothing", device.getMACAddressString());
+ //This port will be remained, so remove from the removed port lists.
+ attachedPorts.remove(port);
+ } else {
+ log.debug("Adding device {}: attaching to port", device.getMACAddressString());
+ port.setDevice(obj);
+ }
+
+ log.debug("port number is {}", port.getNumber().toString());
+ log.debug("port desc is {}", port.getDesc());
+ }
+ }
+
+ for (IPortObject port: attachedPorts) {
+ log.debug("Detaching the device {}: detaching from port", device.getMACAddressString());
+ port.removeDevice(obj);
+
+ if (!obj.getAttachedPorts().iterator().hasNext()) {
+ // XXX If there are no more ports attached to the device,
+ // delete it. Otherwise we have a situation where the
+ // device remains forever with an IP address attached.
+ // When we implement device probing we should get rid of this.
+ removeDevice(obj);
+ }
+ }
+ }
+
+ /***
+ * This function is for changing the Device IPv4 address.
+ * @param device The new device you want change the ipaddress
+ */
+ @Override
+ public void changeDeviceIPv4Address(IDevice device) {
+ log.debug("Changing IP address for {} to {}", device.getMACAddressString(),
+ device.getIPv4Addresses());
+ IDeviceObject obj;
+ try {
+ if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+ changeDeviceIpv4Addresses(device, obj);
+
+ ope.commit();
+ } else {
+ log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
+ }
+ } catch (TitanException e) {
+ ope.rollback();
+ log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(), e);
+ }
+ }
+
+ private void changeDeviceIpv4Addresses(IDevice device, IDeviceObject deviceObject) {
+ List<String> dbIpv4Addresses = new ArrayList<String>();
+ List<Integer> intDbIpv4Addresses = new ArrayList<Integer>();
+ for (IIpv4Address ipv4Vertex : deviceObject.getIpv4Addresses()) {
+ dbIpv4Addresses.add(InetAddresses.fromInteger(ipv4Vertex.getIpv4Address()).getHostAddress());
+ intDbIpv4Addresses.add(ipv4Vertex.getIpv4Address());
+ }
+
+ List<String> memIpv4Addresses = new ArrayList<String>();
+ for (int addr : device.getIPv4Addresses()) {
+ memIpv4Addresses.add(InetAddresses.fromInteger(addr).getHostAddress());
+ }
+
+ log.debug("Device IP addresses {}, database IP addresses {}",
+ memIpv4Addresses, dbIpv4Addresses);
+
+ for (int ipv4Address : device.getIPv4Addresses()) {
+ //if (deviceObject.getIpv4Address(ipv4Address) == null) {
+ if (!intDbIpv4Addresses.contains(ipv4Address)) {
+ IIpv4Address dbIpv4Address = ope.ensureIpv4Address(ipv4Address);
+
+ /*
+ IDeviceObject oldDevice = dbIpv4Address.getDevice();
+ if (oldDevice != null) {
+ oldDevice.removeIpv4Address(dbIpv4Address);
+ }
+ */
+
+ log.debug("Adding IP address {}",
+ InetAddresses.fromInteger(ipv4Address).getHostAddress());
+ deviceObject.addIpv4Address(dbIpv4Address);
+ }
+ }
+
+ List<Integer> deviceIpv4Addresses = Arrays.asList(device.getIPv4Addresses());
+ for (IIpv4Address dbIpv4Address : deviceObject.getIpv4Addresses()) {
+ if (!deviceIpv4Addresses.contains(dbIpv4Address.getIpv4Address())) {
+ log.debug("Removing IP address {}",
+ InetAddresses.fromInteger(dbIpv4Address.getIpv4Address())
+ .getHostAddress());
+ deviceObject.removeIpv4Address(dbIpv4Address);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
new file mode 100644
index 0000000..7a3d43e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -0,0 +1,522 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.pipes.PipeFunction;
+import com.tinkerpop.pipes.transform.PathPipe;
+
+/**
+ * This is the class for storing the information of links into GraphDB
+ */
+public class LinkStorageImpl implements ILinkStorage {
+
+ protected final static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
+ protected GraphDBOperation op;
+
+
+ /**
+ * Initialize the object. Open LinkStorage using given configuration file.
+ * @param conf Path (absolute path for now) to configuration file.
+ */
+ @Override
+ public void init(String conf) {
+ this.op = new GraphDBOperation(conf);
+ }
+
+ // Method designing policy:
+ // op.commit() and op.rollback() MUST called in public (first-class) methods.
+ // A first-class method MUST NOT call other first-class method.
+ // Routine process should be implemented in private method.
+ // A private method MUST NOT call commit or rollback.
+
+
+ /**
+ * Update a record in the LinkStorage in a way provided by dmop.
+ * @param link Record of a link to be updated.
+ * @param linkinfo Meta-information of a link to be updated.
+ * @param dmop Operation to be done.
+ */
+ @Override
+ public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION dmop) {
+ boolean success = false;
+
+ switch (dmop) {
+ case CREATE:
+ case INSERT:
+ if (link != null) {
+ try {
+ if (addLinkImpl(link)) {
+ op.commit();
+ success = true;
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
+ }
+ }
+ break;
+ case UPDATE:
+ if (link != null && linkinfo != null) {
+ try {
+ if (setLinkInfoImpl(link, linkinfo)) {
+ op.commit();
+ success = true;
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
+ }
+ }
+ break;
+ case DELETE:
+ if (link != null) {
+ try {
+ if (deleteLinkImpl(link)) {
+ op.commit();
+ success = true;
+ log.debug("LinkStorageImpl:update {} link:{} succeeded", dmop, link);
+ } else {
+ op.rollback();
+ log.debug("LinkStorageImpl:update {} link:{} failed", dmop, link);
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
+ }
+ }
+ break;
+ }
+
+ return success;
+ }
+
+ @Override
+ public boolean addLink(Link link) {
+ return addLink(link, null);
+ }
+
+ @Override
+ public boolean addLink(Link link, LinkInfo linfo) {
+ boolean success = false;
+
+ try {
+ if (addLinkImpl(link)) {
+ // Set LinkInfo only if linfo is non-null.
+ if (linfo != null && (! setLinkInfoImpl(link, linfo))) {
+ log.debug("Adding linkinfo failed: {}", link);
+ op.rollback();
+ }
+ op.commit();
+ success = true;
+ } else {
+ // If we fail here that's because the ports aren't added
+ // before we try to add the link
+ log.debug("Adding link failed: {}", link);
+ op.rollback();
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:addLink link:{} linfo:{} failed", link, linfo);
+ }
+
+ return success;
+ }
+
+ /**
+ * Update multiple records in the LinkStorage in a way provided by op.
+ * @param links List of records to be updated.
+ * @param op Operation to be done.
+ */
+ @Override
+ public boolean addLinks(List<Link> links) {
+ boolean success = false;
+
+ for (Link lt: links) {
+ if (! addLinkImpl(lt)) {
+ return false;
+ }
+ }
+
+ try {
+ op.commit();
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:addLinks link:s{} failed", links);
+ }
+
+ return success;
+ }
+
+ /**
+ * Delete a record in the LinkStorage.
+ * @param lt Record to be deleted.
+ */
+ @Override
+ public boolean deleteLink(Link lt) {
+ boolean success = false;
+
+ log.debug("LinkStorageImpl:deleteLink(): {}", lt);
+
+ try {
+ if (deleteLinkImpl(lt)) {
+ op.commit();
+ success = true;
+ log.debug("LinkStorageImpl:deleteLink(): deleted edges {}", lt);
+ } else {
+ op.rollback();
+ log.error("LinkStorageImpl:deleteLink(): failed invalid vertices {}", lt);
+ }
+ } catch (Exception e) {
+ op.rollback();
+ log.error("LinkStorageImpl:deleteLink(): failed {} {}",
+ new Object[]{lt, e.toString()});
+ e.printStackTrace();
+ }
+
+ return success;
+ }
+
+ /**
+ * Delete multiple records in LinkStorage.
+ * @param links List of records to be deleted.
+ */
+ @Override
+ public boolean deleteLinks(List<Link> links) {
+ boolean success = false;
+
+ try {
+ for (Link lt : links) {
+ if (! deleteLinkImpl(lt)) {
+ op.rollback();
+ return false;
+ }
+ }
+ op.commit();
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:deleteLinks failed invalid vertices {}", links);
+ }
+
+ return success;
+ }
+
+ /**
+ * Get list of all links connected to the port specified by given DPID and port number.
+ * @param dpid DPID of desired port.
+ * @param port Port number of desired port.
+ * @return List of links. Empty list if no port was found.
+ */
+ @Override
+ public List<Link> getLinks(Long dpid, short port) {
+ List<Link> links = new ArrayList<Link>();
+
+ IPortObject srcPort = op.searchPort(HexString.toHexString(dpid), port);
+ if (srcPort == null)
+ return links;
+ ISwitchObject srcSw = srcPort.getSwitch();
+ if (srcSw == null)
+ return links;
+
+ for(IPortObject dstPort : srcPort.getLinkedPorts()) {
+ ISwitchObject dstSw = dstPort.getSwitch();
+ if (dstSw != null) {
+ Link link = new Link(dpid, port,
+ HexString.toLong(dstSw.getDPID()),
+ dstPort.getNumber());
+ links.add(link);
+ }
+ }
+ return links;
+ }
+
+ /**
+ * Get list of all reverse links connected to the port specified by given DPID and port number.
+ * @param dpid DPID of desired port.
+ * @param port Port number of desired port.
+ * @return List of reverse links. Empty list if no port was found.
+ */
+ @Override
+ public List<Link> getReverseLinks(Long dpid, short port) {
+ List<Link> links = new ArrayList<Link>();
+
+ IPortObject srcPort = op.searchPort(HexString.toHexString(dpid), port);
+ if (srcPort == null)
+ return links;
+ ISwitchObject srcSw = srcPort.getSwitch();
+ if (srcSw == null)
+ return links;
+
+ for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
+ ISwitchObject dstSw = dstPort.getSwitch();
+ if (dstSw != null) {
+ Link link = new Link(HexString.toLong(dstSw.getDPID()),
+ dstPort.getNumber(),
+ dpid, port);
+ links.add(link);
+ }
+ }
+ return links;
+ }
+
+ /**
+ * Delete records of the links connected to the port specified by given DPID and port number.
+ * @param dpid DPID of desired port.
+ * @param port Port number of desired port.
+ */
+ @Override
+ public boolean deleteLinksOnPort(Long dpid, short port) {
+ boolean success = false;
+
+ List<Link> linksToDelete = getLinks(dpid, port);
+ try {
+ for(Link l : linksToDelete) {
+ if (! deleteLinkImpl(l)) {
+ op.rollback();
+ log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port);
+ return false;
+ }
+ }
+ op.commit();
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port);
+ }
+
+ return success;
+ }
+
+ /**
+ * Get list of all links connected to the switch specified by given DPID.
+ * @param dpid DPID of desired switch.
+ * @return List of links. Empty list if no port was found.
+ */
+ @Override
+ public List<Link> getLinks(String dpid) {
+ List<Link> links = new ArrayList<Link>();
+
+ ISwitchObject srcSw = op.searchSwitch(dpid);
+
+ if(srcSw != null) {
+ for(IPortObject srcPort : srcSw.getPorts()) {
+ for(IPortObject dstPort : srcPort.getLinkedPorts()) {
+ ISwitchObject dstSw = dstPort.getSwitch();
+ if(dstSw != null) {
+ Link link = new Link(HexString.toLong(dpid),
+ srcPort.getNumber(),
+ HexString.toLong(dstSw.getDPID()),
+ dstPort.getNumber());
+ links.add(link);
+ }
+ }
+ }
+ }
+
+ return links;
+ }
+
+ /**
+ * Get list of all reverse links connected to the switch specified by
+ * given DPID.
+ * @param dpid DPID of desired switch.
+ * @return List of reverse links. Empty list if no port was found.
+ */
+ @Override
+ public List<Link> getReverseLinks(String dpid) {
+ List<Link> links = new ArrayList<Link>();
+
+ ISwitchObject srcSw = op.searchSwitch(dpid);
+
+ if(srcSw != null) {
+ for(IPortObject srcPort : srcSw.getPorts()) {
+ for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
+ ISwitchObject dstSw = dstPort.getSwitch();
+ if(dstSw != null) {
+ Link link = new Link(
+ HexString.toLong(dstSw.getDPID()),
+ dstPort.getNumber(),
+
+ HexString.toLong(dpid),
+ srcPort.getNumber());
+ links.add(link);
+ }
+ }
+ }
+ }
+
+ return links;
+ }
+
+ /**
+ * Get list of all links whose state is ACTIVE.
+ * @return List of active links. Empty list if no port was found.
+ */
+ public List<Link> getActiveLinks() {
+ Iterable<ISwitchObject> switches = op.getActiveSwitches();
+
+ List<Link> links = new ArrayList<Link>();
+
+ for (ISwitchObject srcSw : switches) {
+ for(IPortObject srcPort : srcSw.getPorts()) {
+ for(IPortObject dstPort : srcPort.getLinkedPorts()) {
+ ISwitchObject dstSw = dstPort.getSwitch();
+
+ if(dstSw != null && dstSw.getState().equals("ACTIVE")) {
+ links.add(new Link(HexString.toLong(srcSw.getDPID()),
+ srcPort.getNumber(),
+ HexString.toLong(dstSw.getDPID()),
+ dstPort.getNumber()));
+ }
+ }
+ }
+ }
+
+ return links;
+ }
+
+ @Override
+ public LinkInfo getLinkInfo(Link link) {
+ // TODO implement this
+ return null;
+ }
+
+ /**
+ * Finalize the object.
+ */
+ public void finalize() {
+ close();
+ }
+
+ /**
+ * Close LinkStorage.
+ */
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+// graph.shutdown();
+ }
+
+ /**
+ * Update a record of link with meta-information in the LinkStorage.
+ * @param link Record of a link to update.
+ * @param linkinfo Meta-information of a link to be updated.
+ */
+ private boolean setLinkInfoImpl(Link link, LinkInfo linkinfo) {
+ // TODO implement this
+
+ return false;
+ }
+
+ private boolean addLinkImpl(Link lt) {
+ boolean success = false;
+
+ IPortObject vportSrc = null, vportDst = null;
+
+ // get source port vertex
+ String dpid = HexString.toHexString(lt.getSrc());
+ short port = lt.getSrcPort();
+ vportSrc = op.searchPort(dpid, port);
+
+ // get dest port vertex
+ dpid = HexString.toHexString(lt.getDst());
+ port = lt.getDstPort();
+ vportDst = op.searchPort(dpid, port);
+
+ if (vportSrc != null && vportDst != null) {
+ IPortObject portExist = null;
+ // check if the link exists
+ for (IPortObject V : vportSrc.getLinkedPorts()) {
+ if (V.equals(vportDst)) {
+ portExist = V;
+ break;
+ }
+ }
+
+ if (portExist == null) {
+ vportSrc.setLinkPort(vportDst);
+ success = true;
+ } else {
+ log.debug("LinkStorageImpl:addLinkImpl failed link exists {} {} src {} dst {}",
+ new Object[]{op, lt, vportSrc, vportDst});
+ }
+ }
+
+ return success;
+ }
+
+ private boolean deleteLinkImpl(Link lt) {
+ boolean success = false;
+ IPortObject vportSrc = null, vportDst = null;
+
+ // get source port vertex
+ String dpid = HexString.toHexString(lt.getSrc());
+ short port = lt.getSrcPort();
+ vportSrc = op.searchPort(dpid, port);
+
+ // get dst port vertex
+ dpid = HexString.toHexString(lt.getDst());
+ port = lt.getDstPort();
+ vportDst = op.searchPort(dpid, port);
+
+ // FIXME: This needs to remove all edges
+ if (vportSrc != null && vportDst != null) {
+ vportSrc.removeLink(vportDst);
+ log.debug("deleteLinkImpl(): deleted edges src {} dst {}", new Object[]{
+ lt, vportSrc, vportDst});
+ success = true;
+ }
+
+ return success;
+ }
+
+ // TODO should be moved to TopoLinkServiceImpl (never used in this class)
+ static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Link compute(PathPipe<Vertex> pipe ) {
+ long s_dpid = 0;
+ long d_dpid = 0;
+ short s_port = 0;
+ short d_port = 0;
+ List<Vertex> V = new ArrayList<Vertex>();
+ V = (List<Vertex>)pipe.next();
+ Vertex src_sw = V.get(0);
+ Vertex dest_sw = V.get(3);
+ Vertex src_port = V.get(1);
+ Vertex dest_port = V.get(2);
+ s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
+ d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
+ s_port = (Short) src_port.getProperty("number");
+ d_port = (Short) dest_port.getProperty("number");
+
+ Link l = new Link(s_dpid,s_port,d_dpid,d_port);
+
+ return l;
+ }
+ }
+
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
new file mode 100644
index 0000000..dcfdc73
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
@@ -0,0 +1,503 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage;
+
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is the class for storing the information of switches into GraphDB
+ */
+public class SwitchStorageImpl implements ISwitchStorage {
+ protected GraphDBOperation op;
+ protected final static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ /***
+ * Initialize function. Before you use this class, please call this method
+ * @param conf configuration file for Cassandra DB
+ */
+ @Override
+ public void init(String conf) {
+ GraphDBConnection conn = GraphDBConnection.getInstance(conf);
+ op = new GraphDBOperation(conn);
+ }
+
+ /***
+ * Finalize/close function. After you use this class, please call this method.
+ * It will close the DB connection.
+ */
+ public void finalize() {
+ close();
+ }
+
+ /***
+ * Finalize/close function. After you use this class, please call this method.
+ * It will close the DB connection. This is for Java garbage collection.
+ */
+ @Override
+ public void close() {
+ op.close();
+ }
+
+ // Method designing policy:
+ // op.commit() and op.rollback() MUST called in public (first-class) methods.
+ // A first-class method MUST NOT call other first-class method.
+ // Routine process should be implemented in private method.
+ // A private method MUST NOT call commit or rollback.
+
+ /***
+ * This function is for updating the switch into the DB.
+ * @param dpid The switch dpid you want to update from the DB
+ * @param state The state of the switch like ACTIVE, INACTIVE
+ * @param dmope The DM_OPERATION of the switch
+ */
+ /*
+ * Jono, 11/8/2013
+ * We don't need this update method that demultiplexes DM_OPERATIONS,
+ * we can have clients just call the required methods directly.
+ * We especially don't need this update method to re-implement
+ * the functions of other methods.
+ */
+ @Deprecated
+ @Override
+ public boolean updateSwitch(String dpid, SwitchState state, DM_OPERATION dmope) {
+ boolean success = false;
+ ISwitchObject sw = null;
+
+ log.info("SwitchStorage:update {} dpid:{}", dmope, dpid);
+ switch(dmope) {
+ case UPDATE:
+ try {
+ sw = op.searchSwitch(dpid);
+ if (sw != null) {
+ setSwitchStateImpl(sw, state);
+ op.commit();
+ success = true;
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
+ }
+ break;
+ case INSERT:
+ case CREATE:
+ try {
+ sw = addSwitchImpl(dpid);
+ if (sw != null) {
+ if (state != SwitchState.ACTIVE) {
+ setSwitchStateImpl(sw, state);
+ }
+ op.commit();
+ success = true;
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
+ }
+ break;
+ case DELETE:
+ try {
+ sw = op.searchSwitch(dpid);
+ if (sw != null) {
+ deleteSwitchImpl(sw);
+ op.commit();
+ success = true;
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
+ }
+ break;
+ default:
+ }
+
+ return success;
+ }
+
+ @Override
+ public boolean addSwitch(IOFSwitch sw) {
+ boolean success = false;
+
+ String dpid = sw.getStringId();
+ log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
+
+ try {
+ ISwitchObject curr = op.searchSwitch(dpid);
+ if (curr != null) {
+ //If existing the switch. set The SW state ACTIVE.
+ log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
+ setSwitchStateImpl(curr, SwitchState.ACTIVE);
+ } else {
+ curr = addSwitchImpl(dpid);
+ }
+
+ for (OFPhysicalPort port: sw.getPorts()) {
+ //addPort(dpid, port);
+ addPortImpl(curr, port);
+
+ }
+
+ // XXX for now delete devices when we change a port to prevent
+ // having stale devices.
+ DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+ for (IPortObject portObject : curr.getPorts()) {
+ for (IDeviceObject deviceObject : portObject.getDevices()) {
+ // The deviceStorage has to remove on the object gained by its own
+ // FramedGraph, it can't use our objects from here
+ deviceStorage.removeDeviceImpl(deviceStorage.getDeviceByMac(deviceObject.getMACAddress()));
+ }
+ }
+
+ op.commit();
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ log.error("SwitchStorage:addSwitch dpid:{} failed", dpid, e);
+ }
+
+ return success;
+ }
+
+ /***
+ * This function is for adding the switch into the DB.
+ * @param dpid The switch dpid you want to add into the DB.
+ */
+ // This method is only called by tests, so we probably don't need it.
+ // If we need both addSwitch interfaces, one should call the other
+ // rather than implementing the same logic twice.
+ @Deprecated
+ @Override
+ public boolean addSwitch(String dpid) {
+ boolean success = false;
+
+ log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
+ try {
+ ISwitchObject sw = op.searchSwitch(dpid);
+ if (sw != null) {
+ //If existing the switch. set The SW state ACTIVE.
+ log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
+ setSwitchStateImpl(sw, SwitchState.ACTIVE);
+ } else {
+ addSwitchImpl(dpid);
+ }
+ op.commit();
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("SwitchStorage:addSwitch dpid:{} failed", dpid, e);
+ }
+
+ return success;
+ }
+
+ /***
+ * This function is for deleting the switch into the DB.
+ * @param dpid The switch dpid you want to delete from the DB.
+ */
+ @Override
+ public boolean deleteSwitch(String dpid) {
+ boolean success = false;
+
+ try {
+ ISwitchObject sw = op.searchSwitch(dpid);
+ if (sw != null) {
+ deleteSwitchImpl(sw);
+ op.commit();
+ }
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("SwitchStorage:deleteSwitch {} failed", dpid);
+ }
+
+ return success;
+ }
+
+ public boolean deactivateSwitch(String dpid) {
+ boolean success = false;
+
+ try {
+ ISwitchObject switchObject = op.searchSwitch(dpid);
+ if (switchObject != null) {
+ setSwitchStateImpl(switchObject, SwitchState.INACTIVE);
+
+ for (IPortObject portObject : switchObject.getPorts()) {
+ portObject.setState("INACTIVE");
+ }
+ op.commit();
+ success = true;
+ }
+ else {
+ log.warn("Switch {} not found when trying to deactivate", dpid);
+ }
+ } catch (Exception e) {
+ // TODO what type of exception is thrown when we can't commit?
+ op.rollback();
+ log.error("SwitchStorage:deactivateSwitch {} failed", dpid, e);
+ }
+
+ return success;
+ }
+
+ public boolean updatePort(String dpid, short portNum, int state, String desc) {
+ boolean success = false;
+
+ try {
+ ISwitchObject sw = op.searchSwitch(dpid);
+
+ if (sw != null) {
+ IPortObject p = sw.getPort(portNum);
+ log.info("SwitchStorage:updatePort dpid:{} port:{}", dpid, portNum);
+ if (p != null) {
+ setPortStateImpl(p, state, desc);
+ op.commit();
+ }
+ success = true;
+ } else {
+ log.error("SwitchStorage:updatePort dpid:{} port:{} : failed switch does not exist", dpid, portNum);
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, portNum);
+ }
+
+ return success;
+ }
+
+ /***
+ * This function is for adding the switch port into the DB.
+ * @param dpid The switch dpid that has the port.
+ * @param phport The port you want to add the switch.
+ */
+ @Override
+ public boolean addPort(String dpid, OFPhysicalPort phport) {
+ boolean success = false;
+
+ if(((OFPortConfig.OFPPC_PORT_DOWN.getValue() & phport.getConfig()) > 0) ||
+ ((OFPortState.OFPPS_LINK_DOWN.getValue() & phport.getState()) > 0)) {
+ // just dispatch to deletePort()
+ // TODO This is wrong. We need to make sure the port is in the
+ // DB with the correct info and port state.
+ return deletePort(dpid, phport.getPortNumber());
+ }
+
+ try {
+ ISwitchObject sw = op.searchSwitch(dpid);
+
+ if (sw != null) {
+ IPortObject portObject = addPortImpl(sw, phport);
+
+ // XXX for now delete devices when we change a port to prevent
+ // having stale devices.
+ DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+
+ for (IDeviceObject deviceObject : portObject.getDevices()) {
+ deviceStorage.removeDevice(deviceObject);
+ }
+
+ op.commit();
+ success = true;
+ } else {
+ log.error("SwitchStorage:addPort dpid:{} port:{} : failed switch does not exist", dpid, phport.getPortNumber());
+ }
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, phport.getPortNumber());
+ }
+
+ return success;
+ }
+
+ /***
+ * This function is for deleting the switch port from the DB.
+ * @param dpid The switch dpid that has the port.
+ * @param port The port you want to delete the switch.
+ */
+ @Override
+ public boolean deletePort(String dpid, short port) {
+ boolean success = false;
+
+ DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+
+ try {
+ ISwitchObject sw = op.searchSwitch(dpid);
+
+ if (sw != null) {
+ IPortObject p = sw.getPort(port);
+ if (p != null) {
+ log.info("SwitchStorage:deletePort dpid:{} port:{} found and set INACTIVE", dpid, port);
+ //deletePortImpl(p);
+ p.setState("INACTIVE");
+
+ // XXX for now delete devices when we change a port to prevent
+ // having stale devices.
+ for (IDeviceObject d : p.getDevices()) {
+ deviceStorage.removeDevice(d);
+ }
+ op.commit();
+ }
+ }
+
+ success = true;
+ } catch (Exception e) {
+ op.rollback();
+ e.printStackTrace();
+ log.error("SwitchStorage:deletePort dpid:{} port:{} failed", dpid, port);
+ }
+
+ return success;
+ }
+
+ /**
+ * Get list of all ports on the switch specified by given DPID.
+ *
+ * @param dpid DPID of desired switch.
+ * @return List of port IDs. Empty list if no port was found.
+ */
+ @Override
+ public List<Short> getPorts(String dpid) {
+ List<Short> ports = new ArrayList<Short>();
+
+ ISwitchObject srcSw = op.searchSwitch(dpid);
+ if (srcSw != null) {
+ for (IPortObject srcPort : srcSw.getPorts()) {
+ ports.add(srcPort.getNumber());
+ }
+ }
+
+ return ports;
+ }
+
+ private ISwitchObject addSwitchImpl(String dpid) {
+ if (dpid != null) {
+ ISwitchObject sw = op.newSwitch(dpid);
+ sw.setState(SwitchState.ACTIVE.toString());
+ log.info("SwitchStorage:addSwitchImpl dpid:{} added", dpid);
+ return sw;
+ } else {
+ return null;
+ }
+ }
+
+ private void setSwitchStateImpl(ISwitchObject sw, SwitchState state) {
+ if (sw != null && state != null) {
+ sw.setState(state.toString());
+ log.info("SwitchStorage:setSwitchStateImpl dpid:{} updated {}",
+ sw.getDPID(), state.toString());
+ }
+ }
+
+ private void deleteSwitchImpl(ISwitchObject sw) {
+ if (sw != null) {
+ op.removeSwitch(sw);
+ log.info("SwitchStorage:DeleteSwitchImpl dpid:{} done",
+ sw.getDPID());
+ }
+ }
+
+
+ private IPortObject addPortImpl(ISwitchObject sw, OFPhysicalPort phport) {
+ IPortObject portObject = op.searchPort(sw.getDPID(), phport.getPortNumber());
+
+ log.info("SwitchStorage:addPort dpid:{} port:{}",
+ sw.getDPID(), phport.getPortNumber());
+
+ if (portObject != null) {
+ setPortStateImpl(portObject, phport.getState(), phport.getName());
+ portObject.setState("ACTIVE");
+
+ // This a convoluted way of checking if the port is attached
+ // or not, but doing it this way avoids using the
+ // ISwitchObject.getPort method which uses GremlinGroovy query
+ // and takes forever.
+ boolean attached = false;
+ for (IPortObject portsOnSwitch : sw.getPorts()) {
+ if (portsOnSwitch.getPortId() == portObject.getPortId()) {
+ attached = true;
+ break;
+ }
+ }
+
+ if (!attached) {
+ sw.addPort(portObject);
+ }
+
+ /*
+ if (sw.getPort(phport.getPortNumber()) == null) {
+ // The port exists but the switch has no "on" link to it
+ sw.addPort(portObject);
+ }*/
+
+ log.info("SwitchStorage:addPort dpid:{} port:{} exists setting as ACTIVE",
+ sw.getDPID(), phport.getPortNumber());
+ } else {
+ //addPortImpl(sw, phport.getPortNumber());
+ portObject = op.newPort(sw.getDPID(), phport.getPortNumber());
+ portObject.setState("ACTIVE");
+ setPortStateImpl(portObject, phport.getState(), phport.getName());
+ sw.addPort(portObject);
+ log.info("SwitchStorage:addPort dpid:{} port:{} done",
+ sw.getDPID(), phport.getPortNumber());
+ }
+
+ return portObject;
+ }
+ // TODO There's an issue here where a port with that ID could already
+ // exist when we try to add this one (because it's left over from an
+ // old topology). We need to remove an old port with the same ID when
+ // we add the new port. Also it seems that old ports like this are
+ // never cleaned up and will remain in the DB in the ACTIVE state forever.
+ /*private IPortObject addPortImpl(ISwitchObject sw, short portNum) {
+ IPortObject p = op.newPort(sw.getDPID(), portNum);
+ p.setState("ACTIVE");
+ sw.addPort(p);
+ log.info("SwitchStorage:addPortImpl dpid:{} port:{} done",
+ sw.getDPID(), portNum);
+
+ return p;
+ }*/
+
+ private void setPortStateImpl(IPortObject port, Integer state, String desc) {
+ if (port != null) {
+ if (state != null) {
+ port.setPortState(state);
+ }
+ if (desc != null) {
+ port.setDesc(desc);
+ }
+
+ log.info("SwitchStorage:setPortStateImpl port:{} state:{} desc:{} done",
+ new Object[] {port.getPortId(), state, desc});
+ }
+ }
+
+ private void deletePortImpl(IPortObject port) {
+ if (port != null) {
+ op.removePort(port);
+ log.info("SwitchStorage:deletePortImpl port:{} done",
+ port.getPortId());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
new file mode 100644
index 0000000..b692e8e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
@@ -0,0 +1,77 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl.ExtractLink;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.gremlin.java.GremlinPipeline;
+
+public class TopoLinkServiceImpl implements ITopoLinkService {
+
+ protected GraphDBOperation op;
+ protected final static Logger log = LoggerFactory.getLogger(TopoLinkServiceImpl.class);
+
+ public void finalize() {
+ close();
+ }
+
+ @Override
+ public void close() {
+ op.close();
+ }
+
+ @Override
+ public List<Link> getActiveLinks() {
+ // TODO Auto-generated method stub
+ op = new GraphDBOperation("");
+ op.commit(); //Commit to ensure we see latest data
+ Iterable<ISwitchObject> switches = op.getActiveSwitches();
+ List<Link> links = new ArrayList<Link>();
+ for (ISwitchObject sw : switches) {
+ GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
+ ExtractLink extractor = new ExtractLink();
+
+ pipe.start(sw.asVertex());
+ pipe.enablePath(true);
+ pipe.out("on").out("link").in("on").path().step(extractor);
+
+ while (pipe.hasNext() ) {
+ Link l = pipe.next();
+ links.add(l);
+ }
+
+ }
+ op.commit();
+ return links;
+ }
+
+ @Override
+ public List<Link> getLinksOnSwitch(String dpid) {
+ // TODO Auto-generated method stub
+ List<Link> links = new ArrayList<Link>();
+ ISwitchObject sw = op.searchSwitch(dpid);
+ GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
+ ExtractLink extractor = new ExtractLink();
+
+ pipe.start(sw.asVertex());
+ pipe.enablePath(true);
+ pipe.out("on").out("link").in("on").path().step(extractor);
+
+ while (pipe.hasNext() ) {
+ Link l = pipe.next();
+ links.add(l);
+ }
+ return links;
+
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
new file mode 100644
index 0000000..3a324b1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
@@ -0,0 +1,69 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoSwitchService;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TopoSwitchServiceImpl implements ITopoSwitchService {
+
+ private GraphDBOperation op;
+ protected final static Logger log = LoggerFactory.getLogger(TopoSwitchServiceImpl.class);
+
+ public TopoSwitchServiceImpl(String conf) {
+ op = new GraphDBOperation(conf);
+ }
+
+ public TopoSwitchServiceImpl() {
+ this("");
+ }
+
+ public void finalize() {
+ close();
+ }
+
+ @Override
+ public void close() {
+ op.close();
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getActiveSwitches() {
+ // TODO Auto-generated method stub
+ op.close(); //Commit to ensure we see latest data
+ return op.getActiveSwitches();
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getAllSwitches() {
+ // TODO Auto-generated method stub
+ op.close(); //Commit to ensure we see latest data
+ return op.getAllSwitches();
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getInactiveSwitches() {
+ // TODO Auto-generated method stub
+ op.close(); //Commit to ensure we see latest data
+ return op.getInactiveSwitches();
+ }
+
+ @Override
+ public Iterable<IPortObject> getPortsOnSwitch(String dpid) {
+ op.close(); //Commit to ensure we see latest data
+ ISwitchObject switchObject = op.searchSwitch(dpid);
+ if (switchObject != null) {
+ return switchObject.getPorts();
+ }
+ return null;
+ }
+
+ @Override
+ public IPortObject getPortOnSwitch(String dpid, short port_num) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/module/IOnosService.java b/src/main/java/net/onrc/onos/ofcontroller/core/module/IOnosService.java
new file mode 100644
index 0000000..5828366
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/module/IOnosService.java
@@ -0,0 +1,7 @@
+package net.onrc.onos.ofcontroller.core.module;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+public interface IOnosService extends IFloodlightService {
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java b/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java
new file mode 100644
index 0000000..6b8b514
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java
@@ -0,0 +1,94 @@
+package net.onrc.onos.ofcontroller.core.module;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.topology.ITopologyService;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.ofcontroller.core.config.DefaultConfiguration;
+import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.forwarding.Forwarding;
+import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
+import net.onrc.onos.ofcontroller.proxyarp.ProxyArpManager;
+
+public class OnosModuleLoader implements IFloodlightModule {
+ private IFloodlightProviderService floodlightProvider;
+ private ITopologyService topology;
+ private IConfigInfoService config;
+ private IRestApiService restApi;
+ private IFlowService flowService;
+ private IDatagridService datagrid;
+
+ private ProxyArpManager arpManager;
+ private Forwarding forwarding;
+
+ public OnosModuleLoader() {
+ arpManager = new ProxyArpManager();
+ forwarding = new Forwarding();
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ List<Class<? extends IFloodlightService>> services =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ services.add(IProxyArpService.class);
+ return services;
+ }
+
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
+ Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
+ new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
+ impls.put(IProxyArpService.class, arpManager);
+ return impls;
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
+ List<Class<? extends IFloodlightService>> dependencies =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ dependencies.add(IFloodlightProviderService.class);
+ dependencies.add(ITopologyService.class);
+ dependencies.add(IRestApiService.class);
+ dependencies.add(IFlowService.class);
+ dependencies.add(IDatagridService.class);
+ return dependencies;
+ }
+
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+ topology = context.getServiceImpl(ITopologyService.class);
+ restApi = context.getServiceImpl(IRestApiService.class);
+ flowService = context.getServiceImpl(IFlowService.class);
+ datagrid = context.getServiceImpl(IDatagridService.class);
+
+ //This could be null because it's not mandatory to have an
+ //IConfigInfoService loaded.
+ config = context.getServiceImpl(IConfigInfoService.class);
+ if (config == null) {
+ config = new DefaultConfiguration();
+ }
+
+ arpManager.init(floodlightProvider, topology, datagrid, config, restApi);
+ forwarding.init(floodlightProvider, flowService, datagrid);
+ }
+
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ arpManager.startUp();
+ forwarding.startUp();
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/web/ClearFlowTableResource.java b/src/main/java/net/onrc/onos/ofcontroller/core/web/ClearFlowTableResource.java
new file mode 100644
index 0000000..fe70877
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/web/ClearFlowTableResource.java
@@ -0,0 +1,55 @@
+package net.onrc.onos.ofcontroller.core.web;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openflow.util.HexString;
+import org.restlet.resource.Post;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClearFlowTableResource extends ServerResource {
+ final static Logger log = LoggerFactory.getLogger(ClearFlowTableResource.class);
+
+ @Post("json")
+ public List<String> ClearFlowTable(String jsonData){
+ IFloodlightProviderService floodlightProvider =
+ (IFloodlightProviderService) getContext().getAttributes()
+ .get(IFloodlightProviderService.class.getCanonicalName());
+
+ Map<Long, IOFSwitch> switches = floodlightProvider.getSwitches();
+
+ List<String> response = new ArrayList<String>();
+ ObjectMapper mapper = new ObjectMapper();
+ String[] dpids = null;
+ try {
+ dpids = mapper.readValue(jsonData, String[].class);
+ } catch (IOException e) {
+ log.debug("Error parsing switch dpid array: {}", e.getMessage());
+ response.add("Error parsing input");
+ return response;
+ }
+
+
+ for (String dpid : dpids){
+ IOFSwitch sw = switches.get(HexString.toLong(dpid));
+ if (sw != null){
+ sw.clearAllFlowMods();
+ response.add(dpid + " cleared");
+ }
+ else {
+ response.add(dpid + " not found");
+ }
+ }
+
+ return response;
+ }
+
+}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
similarity index 74%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
index 25b68fb..327c110 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
@@ -1,8 +1,8 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.core.web;
import java.util.List;
-import net.floodlightcontroller.linkdiscovery.internal.TopoLinkServiceImpl;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoSwitchesResource.java b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoSwitchesResource.java
new file mode 100644
index 0000000..6d3f161
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoSwitchesResource.java
@@ -0,0 +1,29 @@
+package net.onrc.onos.ofcontroller.core.web;
+
+import java.util.Iterator;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+
+public class TopoSwitchesResource extends ServerResource {
+
+ @Get("json")
+ public Iterator<ISwitchObject> retrieve() {
+ TopoSwitchServiceImpl impl = new TopoSwitchServiceImpl();
+
+ String filter = (String) getRequestAttributes().get("filter");
+
+ if (filter.equals("active")) {
+ return impl.getActiveSwitches().iterator();
+ }
+ if (filter.equals("inactive")) {
+ return impl.getInactiveSwitches().iterator();
+ } else {
+ return impl.getAllSwitches().iterator();
+ }
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/web/TopoDevicesResource.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/web/TopoDevicesResource.java
new file mode 100644
index 0000000..ac9409f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/web/TopoDevicesResource.java
@@ -0,0 +1,19 @@
+package net.onrc.onos.ofcontroller.devicemanager.web;
+
+import java.util.Iterator;
+
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+
+public class TopoDevicesResource extends ServerResource {
+
+ @Get("json")
+ public Iterator<IDeviceObject> retrieve() {
+ GraphDBOperation op = new GraphDBOperation("");
+
+ return op.getDevices().iterator();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/INetworkGraphService.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/INetworkGraphService.java
new file mode 100644
index 0000000..121eaf9
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/INetworkGraphService.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.ofcontroller.floodlightlistener;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+/**
+ * Interface for providing Network Graph Service to other module.
+ */
+public interface INetworkGraphService extends IFloodlightService {
+ // TODO
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
new file mode 100644
index 0000000..50fe8f8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -0,0 +1,494 @@
+package net.onrc.onos.ofcontroller.floodlightlistener;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.IOFSwitchListener;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.core.util.SingletonTask;
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.IDeviceListener;
+import net.floodlightcontroller.devicemanager.IDeviceService;
+import net.floodlightcontroller.routing.Link;
+import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.IDBConnection;
+import net.onrc.onos.graph.LocalTopologyEventListener;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage;
+import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.registry.controller.IControllerRegistryService;
+import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
+import net.onrc.onos.registry.controller.RegistryException;
+
+public class NetworkGraphPublisher implements IDeviceListener,
+ IOFSwitchListener,
+ IOFSwitchPortListener,
+ ILinkDiscoveryListener,
+ IFloodlightModule,
+ INetworkGraphService {
+
+ protected IDeviceStorage devStore;
+ protected ISwitchStorage swStore;
+ protected ILinkStorage linkStore;
+ protected final static Logger log = LoggerFactory.getLogger(NetworkGraphPublisher.class);
+ protected IDeviceService deviceService;
+ protected IControllerRegistryService registryService;
+ protected GraphDBOperation op;
+
+ protected static final String DBConfigFile = "dbconf";
+ protected static final String CleanupEnabled = "EnableCleanup";
+ protected IThreadPoolService threadPool;
+ protected IFloodlightProviderService floodlightProvider;
+
+ protected final int CLEANUP_TASK_INTERVAL = 60; // 1 min
+ protected SingletonTask cleanupTask;
+ protected ILinkDiscoveryService linkDiscovery;
+
+ protected IDatagridService datagridService;
+
+ /**
+ * Cleanup and synch switch state from registry
+ */
+ protected class SwitchCleanup implements ControlChangeCallback, Runnable {
+ @Override
+ public void run() {
+ try {
+ log.debug("Running cleanup thread");
+ switchCleanup();
+ }
+ catch (Exception e) {
+ log.error("Error in cleanup thread", e);
+ } finally {
+ op.close();
+ cleanupTask.reschedule(CLEANUP_TASK_INTERVAL,
+ TimeUnit.SECONDS);
+ }
+ }
+
+ @Override
+ public void controlChanged(long dpid, boolean hasControl) {
+ if (hasControl) {
+ log.debug("got control to set inactive sw {}", HexString.toHexString(dpid));
+ try {
+ // Get the affected ports
+ List<Short> ports = swStore.getPorts(HexString.toHexString(dpid));
+ // Get the affected links
+ List<Link> links = linkStore.getLinks(HexString.toHexString(dpid));
+ // Get the affected reverse links
+ List<Link> reverseLinks = linkStore.getReverseLinks(HexString.toHexString(dpid));
+ links.addAll(reverseLinks);
+
+ //if (swStore.updateSwitch(HexString.toHexString(dpid), SwitchState.INACTIVE, DM_OPERATION.UPDATE)) {
+ if (swStore.deactivateSwitch(HexString.toHexString(dpid))) {
+ registryService.releaseControl(dpid);
+
+ // TODO publish UPDATE_SWITCH event here
+ //
+ // NOTE: Here we explicitly send
+ // notification to remove the
+ // switch, because it is inactive
+ //
+ TopologyElement topologyElement =
+ new TopologyElement(dpid);
+ datagridService.notificationSendTopologyElementRemoved(topologyElement);
+
+ // Publish: remove the affected ports
+ for (Short port : ports) {
+ TopologyElement topologyElementPort =
+ new TopologyElement(dpid, port);
+ datagridService.notificationSendTopologyElementRemoved(topologyElementPort);
+ }
+ // Publish: remove the affected links
+ for (Link link : links) {
+ TopologyElement topologyElementLink =
+ new TopologyElement(link.getSrc(),
+ link.getSrcPort(),
+ link.getDst(),
+ link.getDstPort());
+ datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
+ }
+ }
+ } catch (Exception e) {
+ log.error("Error in SwitchCleanup:controlChanged ", e);
+ }
+ }
+ }
+ }
+
+ protected void switchCleanup() {
+ op.close();
+ Iterable<ISwitchObject> switches = op.getActiveSwitches();
+
+ log.debug("Checking for inactive switches");
+ // For each switch check if a controller exists in controller registry
+ for (ISwitchObject sw: switches) {
+ //log.debug("checking if switch is inactive: {}", sw.getDPID());
+ try {
+ long dpid = HexString.toLong(sw.getDPID());
+ String controller = registryService.getControllerForSwitch(dpid);
+ if (controller == null) {
+ log.debug("request Control to set inactive sw {}", HexString.toHexString(dpid));
+ registryService.requestControl(dpid, new SwitchCleanup());
+ //} else {
+ // log.debug("sw {} is controlled by controller: {}",HexString.toHexString(dpid),controller);
+ }
+ } catch (NumberFormatException e) {
+ log.debug("Caught NumberFormatException trying to requestControl in cleanup thread");
+ e.printStackTrace();
+ } catch (RegistryException e) {
+ log.debug("Caught RegistryException trying to requestControl in cleanup thread");
+ e.printStackTrace();
+ }
+ }
+ op.close();
+ }
+
+ @Override
+ public void linkDiscoveryUpdate(LDUpdate update) {
+ Link lt = new Link(update.getSrc(),update.getSrcPort(),update.getDst(),update.getDstPort());
+ //log.debug("{}:LinkDicoveryUpdate(): Updating Link {}",this.getClass(), lt);
+
+ switch (update.getOperation()) {
+ case LINK_REMOVED:
+ log.debug("LinkDiscoveryUpdate(): Removing link {}", lt);
+
+ if (linkStore.deleteLink(lt)) {
+ // TODO publish DELETE_LINK event here
+ TopologyElement topologyElement =
+ new TopologyElement(update.getSrc(),
+ update.getSrcPort(),
+ update.getDst(),
+ update.getDstPort());
+ datagridService.notificationSendTopologyElementRemoved(topologyElement);
+ }
+ break;
+ case LINK_UPDATED:
+ log.debug("LinkDiscoveryUpdate(): Updating link {}", lt);
+
+ LinkInfo linfo = linkStore.getLinkInfo(lt);
+ // TODO update "linfo" using portState derived using "update"
+ if (linkStore.update(lt, linfo, DM_OPERATION.UPDATE)) {
+ // TODO publish UPDATE_LINK event here
+ //
+ // TODO NOTE: Here we assume that updated
+ // link is UP.
+ //
+ TopologyElement topologyElement =
+ new TopologyElement(update.getSrc(),
+ update.getSrcPort(),
+ update.getDst(),
+ update.getDstPort());
+ datagridService.notificationSendTopologyElementUpdated(topologyElement);
+ }
+ break;
+ case LINK_ADDED:
+ log.debug("LinkDiscoveryUpdate(): Adding link {}", lt);
+
+ if (linkStore.addLink(lt)) {
+ // TODO publish ADD_LINK event here
+ TopologyElement topologyElement =
+ new TopologyElement(update.getSrc(),
+ update.getSrcPort(),
+ update.getDst(),
+ update.getDstPort());
+ datagridService.notificationSendTopologyElementAdded(topologyElement);
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ @Override
+ public void addedSwitch(IOFSwitch sw) {
+ if (registryService.hasControl(sw.getId())) {
+ if (swStore.addSwitch(sw)) {
+ // TODO publish ADD_SWITCH event here
+ TopologyElement topologyElement =
+ new TopologyElement(sw.getId());
+ datagridService.notificationSendTopologyElementAdded(topologyElement);
+
+ // Publish: add the ports
+ // TODO: Add only ports that are UP?
+ for (OFPhysicalPort port : sw.getPorts()) {
+ TopologyElement topologyElementPort =
+ new TopologyElement(sw.getId(), port.getPortNumber());
+ datagridService.notificationSendTopologyElementAdded(topologyElementPort);
+
+ // Allow links to be discovered on this port now that it's
+ // in the database
+ linkDiscovery.RemoveFromSuppressLLDPs(sw.getId(), port.getPortNumber());
+ }
+
+ // Add all links that might be connected already
+ List<Link> links = linkStore.getLinks(HexString.toHexString(sw.getId()));
+ // Add all reverse links as well
+ List<Link> reverseLinks = linkStore.getReverseLinks(HexString.toHexString(sw.getId()));
+ links.addAll(reverseLinks);
+
+ // Publish: add the links
+ for (Link link : links) {
+ TopologyElement topologyElementLink =
+ new TopologyElement(link.getSrc(),
+ link.getSrcPort(),
+ link.getDst(),
+ link.getDstPort());
+ datagridService.notificationSendTopologyElementAdded(topologyElementLink);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void removedSwitch(IOFSwitch sw) {
+ /*
+ if (registryService.hasControl(sw.getId())) {
+ // Get the affected ports
+ List<Short> ports = swStore.getPorts(HexString.toHexString(sw.getId()));
+ // Get the affected links
+ List<Link> links = linkStore.getLinks(HexString.toHexString(sw.getId()));
+ // Get the affected reverse links
+ List<Link> reverseLinks = linkStore.getReverseLinks(HexString.toHexString(sw.getId()));
+ links.addAll(reverseLinks);
+
+ if (swStore.deleteSwitch(sw.getStringId())) {
+ // TODO publish DELETE_SWITCH event here
+ TopologyElement topologyElement =
+ new TopologyElement(sw.getId());
+ datagridService.notificationSendTopologyElementRemoved(topologyElement);
+
+ // Publish: remove the affected ports
+ for (Short port : ports) {
+ TopologyElement topologyElementPort =
+ new TopologyElement(sw.getId(), port);
+ datagridService.notificationSendTopologyElementRemoved(topologyElementPort);
+ }
+ // Publish: remove the affected links
+ for (Link link : links) {
+ TopologyElement topologyElementLink =
+ new TopologyElement(link.getSrc(),
+ link.getSrcPort(),
+ link.getDst(),
+ link.getDstPort());
+ datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
+ }
+ }
+ }
+ */
+ }
+
+ @Override
+ public void switchPortChanged(Long switchId) {
+ // NOTE: Event not needed here. This callback always coincide with add/remove callback.
+ }
+
+
+ @Override
+ public void switchPortAdded(Long switchId, OFPhysicalPort port) {
+ if (swStore.addPort(HexString.toHexString(switchId), port)) {
+ // Allow links to be discovered on this port now that it's
+ // in the database
+ linkDiscovery.RemoveFromSuppressLLDPs(switchId, port.getPortNumber());
+
+ // TODO publish ADD_PORT event here
+ TopologyElement topologyElement =
+ new TopologyElement(switchId, port.getPortNumber());
+ datagridService.notificationSendTopologyElementAdded(topologyElement);
+
+ // Add all links that might be connected already
+ List<Link> links = linkStore.getLinks(switchId, port.getPortNumber());
+ // Add all reverse links as well
+ List<Link> reverseLinks = linkStore.getReverseLinks(switchId, port.getPortNumber());
+ links.addAll(reverseLinks);
+
+ // Publish: add the links
+ for (Link link : links) {
+ TopologyElement topologyElementLink =
+ new TopologyElement(link.getSrc(),
+ link.getSrcPort(),
+ link.getDst(),
+ link.getDstPort());
+ datagridService.notificationSendTopologyElementAdded(topologyElementLink);
+ }
+ }
+ }
+
+ @Override
+ public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
+ // Remove all links that might be connected already
+ List<Link> links = linkStore.getLinks(switchId, port.getPortNumber());
+ // Remove all reverse links as well
+ List<Link> reverseLinks = linkStore.getReverseLinks(switchId, port.getPortNumber());
+ links.addAll(reverseLinks);
+
+ if (swStore.deletePort(HexString.toHexString(switchId), port.getPortNumber())) {
+ // TODO publish DELETE_PORT event here
+ TopologyElement topologyElement =
+ new TopologyElement(switchId, port.getPortNumber());
+ datagridService.notificationSendTopologyElementRemoved(topologyElement);
+
+ // Publish: remove the links
+ for (Link link : links) {
+ TopologyElement topologyElementLink =
+ new TopologyElement(link.getSrc(),
+ link.getSrcPort(),
+ link.getDst(),
+ link.getDstPort());
+ datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "NetworkGraphPublisher";
+ }
+
+ @Override
+ public void deviceAdded(IDevice device) {
+ log.debug("{}:deviceAdded(): Adding device {}",this.getClass(),device.getMACAddressString());
+ devStore.addDevice(device);
+ for (int intIpv4Address : device.getIPv4Addresses()) {
+ datagridService.sendArpRequest(
+ ArpMessage.newReply(InetAddresses.fromInteger(intIpv4Address)));
+ }
+ }
+
+ @Override
+ public void deviceRemoved(IDevice device) {
+ // TODO Auto-generated method stub
+ devStore.removeDevice(device);
+ }
+
+ @Override
+ public void deviceMoved(IDevice device) {
+ devStore.changeDeviceAttachments(device);
+ }
+
+ @Override
+ public void deviceIPV4AddrChanged(IDevice device) {
+ devStore.changeDeviceIPv4Address(device);
+ }
+
+ @Override
+ public void deviceVlanChanged(IDevice device) {
+ // TODO Auto-generated method stub
+ }
+
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(INetworkGraphService.class);
+ return l;
+ }
+
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
+ Map<Class<? extends IFloodlightService>,
+ IFloodlightService> m =
+ new HashMap<Class<? extends IFloodlightService>,
+ IFloodlightService>();
+ m.put(INetworkGraphService.class, this);
+ return m;
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(IDeviceService.class);
+ l.add(IDatagridService.class);
+ l.add(IThreadPoolService.class);
+ return l;
+ }
+
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ Map<String, String> configMap = context.getConfigParams(this);
+ String conf = configMap.get(DBConfigFile);
+ op = new GraphDBOperation(conf);
+
+ floodlightProvider =
+ context.getServiceImpl(IFloodlightProviderService.class);
+ deviceService = context.getServiceImpl(IDeviceService.class);
+ linkDiscovery = context.getServiceImpl(ILinkDiscoveryService.class);
+ threadPool = context.getServiceImpl(IThreadPoolService.class);
+ registryService = context.getServiceImpl(IControllerRegistryService.class);
+ datagridService = context.getServiceImpl(IDatagridService.class);
+
+ devStore = new DeviceStorageImpl();
+ devStore.init(conf);
+
+ swStore = new SwitchStorageImpl();
+ swStore.init(conf);
+
+ linkStore = new LinkStorageImpl();
+ linkStore.init(conf);
+
+ log.debug("Initializing NetworkGraphPublisher module with {}", conf);
+
+ }
+
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ Map<String, String> configMap = context.getConfigParams(this);
+ String cleanupNeeded = configMap.get(CleanupEnabled);
+
+ deviceService.addListener(this);
+ floodlightProvider.addOFSwitchListener(this);
+ linkDiscovery.addListener(this);
+
+ log.debug("Adding EventListener");
+ IDBConnection conn = op.getDBConnection();
+ conn.addEventListener(new LocalTopologyEventListener((GraphDBConnection) conn));
+ // Setup the Cleanup task.
+ if (cleanupNeeded == null || !cleanupNeeded.equals("False")) {
+ ScheduledExecutorService ses = threadPool.getScheduledExecutor();
+ cleanupTask = new SingletonTask(ses, new SwitchCleanup());
+ cleanupTask.reschedule(CLEANUP_TASK_INTERVAL, TimeUnit.SECONDS);
+ }
+
+ //
+ // NOTE: No need to register with the Datagrid Service,
+ // because we don't need to receive any notifications from it.
+ //
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
new file mode 100644
index 0000000..1babafa
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -0,0 +1,687 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import net.onrc.onos.graph.GraphDBOperation;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.util.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class for performing Flow-related operations on the Database.
+ */
+public class FlowDatabaseOperation {
+ private final static Logger log = LoggerFactory.getLogger(FlowDatabaseOperation.class);
+
+ /**
+ * Add a flow.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param flowPath the Flow Path to install.
+ * @return true on success, otherwise false.
+ */
+ static boolean addFlow(GraphDBOperation dbHandler, FlowPath flowPath) {
+ IFlowPath flowObj = null;
+ boolean found = false;
+ try {
+ if ((flowObj = dbHandler.searchFlowPath(flowPath.flowId())) != null) {
+ found = true;
+ } else {
+ flowObj = dbHandler.newFlowPath();
+ }
+ } catch (Exception e) {
+ dbHandler.rollback();
+
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ String stacktrace = sw.toString();
+
+ log.error(":addFlow FlowId:{} failed: {}",
+ flowPath.flowId().toString(),
+ stacktrace);
+ return false;
+ }
+ if (flowObj == null) {
+ log.error(":addFlow FlowId:{} failed: Flow object not created",
+ flowPath.flowId().toString());
+ dbHandler.rollback();
+ return false;
+ }
+
+ //
+ // Remove the old Flow Entries
+ //
+ if (found) {
+ Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
+ LinkedList<IFlowEntry> deleteFlowEntries =
+ new LinkedList<IFlowEntry>();
+ for (IFlowEntry flowEntryObj : flowEntries)
+ deleteFlowEntries.add(flowEntryObj);
+ for (IFlowEntry flowEntryObj : deleteFlowEntries) {
+ flowObj.removeFlowEntry(flowEntryObj);
+ dbHandler.removeFlowEntry(flowEntryObj);
+ }
+ }
+
+ //
+ // Set the Flow key:
+ // - flowId
+ //
+ flowObj.setFlowId(flowPath.flowId().toString());
+ flowObj.setType("flow");
+
+ //
+ // Set the Flow attributes:
+ // - flowPath.installerId()
+ // - flowPath.flowPathType()
+ // - flowPath.flowPathUserState()
+ // - flowPath.flowPathFlags()
+ // - flowPath.dataPath().srcPort()
+ // - flowPath.dataPath().dstPort()
+ // - flowPath.matchSrcMac()
+ // - flowPath.matchDstMac()
+ // - flowPath.matchEthernetFrameType()
+ // - flowPath.matchVlanId()
+ // - flowPath.matchVlanPriority()
+ // - flowPath.matchSrcIPv4Net()
+ // - flowPath.matchDstIPv4Net()
+ // - flowPath.matchIpProto()
+ // - flowPath.matchIpToS()
+ // - flowPath.matchSrcTcpUdpPort()
+ // - flowPath.matchDstTcpUdpPort()
+ // - flowPath.flowEntryActions()
+ //
+ flowObj.setInstallerId(flowPath.installerId().toString());
+ flowObj.setFlowPathType(flowPath.flowPathType().toString());
+ flowObj.setFlowPathUserState(flowPath.flowPathUserState().toString());
+ flowObj.setFlowPathFlags(flowPath.flowPathFlags().flags());
+ flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
+ flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
+ flowObj.setDstSwitch(flowPath.dataPath().dstPort().dpid().toString());
+ flowObj.setDstPort(flowPath.dataPath().dstPort().port().value());
+ if (flowPath.flowEntryMatch().matchSrcMac()) {
+ flowObj.setMatchSrcMac(flowPath.flowEntryMatch().srcMac().toString());
+ }
+ if (flowPath.flowEntryMatch().matchDstMac()) {
+ flowObj.setMatchDstMac(flowPath.flowEntryMatch().dstMac().toString());
+ }
+ if (flowPath.flowEntryMatch().matchEthernetFrameType()) {
+ flowObj.setMatchEthernetFrameType(flowPath.flowEntryMatch().ethernetFrameType());
+ }
+ if (flowPath.flowEntryMatch().matchVlanId()) {
+ flowObj.setMatchVlanId(flowPath.flowEntryMatch().vlanId());
+ }
+ if (flowPath.flowEntryMatch().matchVlanPriority()) {
+ flowObj.setMatchVlanPriority(flowPath.flowEntryMatch().vlanPriority());
+ }
+ if (flowPath.flowEntryMatch().matchSrcIPv4Net()) {
+ flowObj.setMatchSrcIPv4Net(flowPath.flowEntryMatch().srcIPv4Net().toString());
+ }
+ if (flowPath.flowEntryMatch().matchDstIPv4Net()) {
+ flowObj.setMatchDstIPv4Net(flowPath.flowEntryMatch().dstIPv4Net().toString());
+ }
+ if (flowPath.flowEntryMatch().matchIpProto()) {
+ flowObj.setMatchIpProto(flowPath.flowEntryMatch().ipProto());
+ }
+ if (flowPath.flowEntryMatch().matchIpToS()) {
+ flowObj.setMatchIpToS(flowPath.flowEntryMatch().ipToS());
+ }
+ if (flowPath.flowEntryMatch().matchSrcTcpUdpPort()) {
+ flowObj.setMatchSrcTcpUdpPort(flowPath.flowEntryMatch().srcTcpUdpPort());
+ }
+ if (flowPath.flowEntryMatch().matchDstTcpUdpPort()) {
+ flowObj.setMatchDstTcpUdpPort(flowPath.flowEntryMatch().dstTcpUdpPort());
+ }
+ if (! flowPath.flowEntryActions().actions().isEmpty()) {
+ flowObj.setActions(flowPath.flowEntryActions().toString());
+ }
+ flowObj.setDataPathSummary(flowPath.dataPath().dataPathSummary());
+
+ if (found)
+ flowObj.setFlowPathUserState("FP_USER_MODIFY");
+ else
+ flowObj.setFlowPathUserState("FP_USER_ADD");
+
+ // Flow edges:
+ // HeadFE
+
+
+ //
+ // Flow Entries:
+ // flowPath.dataPath().flowEntries()
+ //
+ for (FlowEntry flowEntry : flowPath.dataPath().flowEntries()) {
+ if (flowEntry.flowEntryUserState() == FlowEntryUserState.FE_USER_DELETE)
+ continue; // Skip: all Flow Entries were deleted earlier
+
+ if (addFlowEntry(dbHandler, flowObj, flowEntry) == null) {
+ dbHandler.rollback();
+ return false;
+ }
+ }
+ dbHandler.commit();
+
+ return true;
+ }
+
+ /**
+ * Add a flow entry to the Network MAP.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param flowObj the corresponding Flow Path object for the Flow Entry.
+ * @param flowEntry the Flow Entry to install.
+ * @return the added Flow Entry object on success, otherwise null.
+ */
+ static IFlowEntry addFlowEntry(GraphDBOperation dbHandler,
+ IFlowPath flowObj,
+ FlowEntry flowEntry) {
+ // Flow edges
+ // HeadFE (TODO)
+
+ IFlowEntry flowEntryObj = null;
+ boolean found = false;
+ try {
+ if ((flowEntryObj =
+ dbHandler.searchFlowEntry(flowEntry.flowEntryId())) != null) {
+ found = true;
+ } else {
+ flowEntryObj = dbHandler.newFlowEntry();
+ }
+ } catch (Exception e) {
+ log.error(":addFlow FlowEntryId:{} failed",
+ flowEntry.flowEntryId().toString());
+ return null;
+ }
+ if (flowEntryObj == null) {
+ log.error(":addFlow FlowEntryId:{} failed: FlowEntry object not created",
+ flowEntry.flowEntryId().toString());
+ return null;
+ }
+
+ //
+ // Set the Flow Entry key:
+ // - flowEntry.flowEntryId()
+ //
+ flowEntryObj.setFlowEntryId(flowEntry.flowEntryId().toString());
+ flowEntryObj.setType("flow_entry");
+
+ //
+ // Set the Flow Entry Edges and attributes:
+ // - Switch edge
+ // - InPort edge
+ // - OutPort edge
+ //
+ // - flowEntry.dpid()
+ // - flowEntry.flowEntryUserState()
+ // - flowEntry.flowEntrySwitchState()
+ // - flowEntry.flowEntryErrorState()
+ // - flowEntry.matchInPort()
+ // - flowEntry.matchSrcMac()
+ // - flowEntry.matchDstMac()
+ // - flowEntry.matchEthernetFrameType()
+ // - flowEntry.matchVlanId()
+ // - flowEntry.matchVlanPriority()
+ // - flowEntry.matchSrcIPv4Net()
+ // - flowEntry.matchDstIPv4Net()
+ // - flowEntry.matchIpProto()
+ // - flowEntry.matchIpToS()
+ // - flowEntry.matchSrcTcpUdpPort()
+ // - flowEntry.matchDstTcpUdpPort()
+ // - flowEntry.actionOutputPort()
+ // - flowEntry.actions()
+ //
+ ISwitchObject sw = dbHandler.searchSwitch(flowEntry.dpid().toString());
+ flowEntryObj.setSwitchDpid(flowEntry.dpid().toString());
+ flowEntryObj.setSwitch(sw);
+ if (flowEntry.flowEntryMatch().matchInPort()) {
+ IPortObject inport =
+ dbHandler.searchPort(flowEntry.dpid().toString(),
+ flowEntry.flowEntryMatch().inPort().value());
+ flowEntryObj.setMatchInPort(flowEntry.flowEntryMatch().inPort().value());
+ flowEntryObj.setInPort(inport);
+ }
+ if (flowEntry.flowEntryMatch().matchSrcMac()) {
+ flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchDstMac()) {
+ flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchEthernetFrameType()) {
+ flowEntryObj.setMatchEthernetFrameType(flowEntry.flowEntryMatch().ethernetFrameType());
+ }
+ if (flowEntry.flowEntryMatch().matchVlanId()) {
+ flowEntryObj.setMatchVlanId(flowEntry.flowEntryMatch().vlanId());
+ }
+ if (flowEntry.flowEntryMatch().matchVlanPriority()) {
+ flowEntryObj.setMatchVlanPriority(flowEntry.flowEntryMatch().vlanPriority());
+ }
+ if (flowEntry.flowEntryMatch().matchSrcIPv4Net()) {
+ flowEntryObj.setMatchSrcIPv4Net(flowEntry.flowEntryMatch().srcIPv4Net().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchDstIPv4Net()) {
+ flowEntryObj.setMatchDstIPv4Net(flowEntry.flowEntryMatch().dstIPv4Net().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchIpProto()) {
+ flowEntryObj.setMatchIpProto(flowEntry.flowEntryMatch().ipProto());
+ }
+ if (flowEntry.flowEntryMatch().matchIpToS()) {
+ flowEntryObj.setMatchIpToS(flowEntry.flowEntryMatch().ipToS());
+ }
+ if (flowEntry.flowEntryMatch().matchSrcTcpUdpPort()) {
+ flowEntryObj.setMatchSrcTcpUdpPort(flowEntry.flowEntryMatch().srcTcpUdpPort());
+ }
+ if (flowEntry.flowEntryMatch().matchDstTcpUdpPort()) {
+ flowEntryObj.setMatchDstTcpUdpPort(flowEntry.flowEntryMatch().dstTcpUdpPort());
+ }
+
+ for (FlowEntryAction fa : flowEntry.flowEntryActions().actions()) {
+ if (fa.actionOutput() != null) {
+ IPortObject outport =
+ dbHandler.searchPort(flowEntry.dpid().toString(),
+ fa.actionOutput().port().value());
+ flowEntryObj.setActionOutputPort(fa.actionOutput().port().value());
+ flowEntryObj.setOutPort(outport);
+ }
+ }
+ if (! flowEntry.flowEntryActions().isEmpty()) {
+ flowEntryObj.setActions(flowEntry.flowEntryActions().toString());
+ }
+
+ // TODO: Hacks with hard-coded state names!
+ if (found)
+ flowEntryObj.setUserState("FE_USER_MODIFY");
+ else
+ flowEntryObj.setUserState("FE_USER_ADD");
+ flowEntryObj.setSwitchState(flowEntry.flowEntrySwitchState().toString());
+ //
+ // TODO: Take care of the FlowEntryErrorState.
+ //
+
+ // Flow Entries edges:
+ // Flow
+ // NextFE (TODO)
+ if (! found) {
+ flowObj.addFlowEntry(flowEntryObj);
+ flowEntryObj.setFlow(flowObj);
+ }
+
+ return flowEntryObj;
+ }
+
+ /**
+ * Delete a flow entry from the Network MAP.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param flowObj the corresponding Flow Path object for the Flow Entry.
+ * @param flowEntry the Flow Entry to delete.
+ * @return true on success, otherwise false.
+ */
+ static boolean deleteFlowEntry(GraphDBOperation dbHandler,
+ IFlowPath flowObj,
+ FlowEntry flowEntry) {
+ IFlowEntry flowEntryObj = null;
+ try {
+ flowEntryObj = dbHandler.searchFlowEntry(flowEntry.flowEntryId());
+ } catch (Exception e) {
+ log.error(":deleteFlowEntry FlowEntryId:{} failed",
+ flowEntry.flowEntryId().toString());
+ return false;
+ }
+ //
+ // TODO: Don't print an error for now, because multiple controller
+ // instances might be deleting the same flow entry.
+ //
+ /*
+ if (flowEntryObj == null) {
+ log.error(":deleteFlowEntry FlowEntryId:{} failed: FlowEntry object not found",
+ flowEntry.flowEntryId().toString());
+ return false;
+ }
+ */
+ if (flowEntryObj == null)
+ return true;
+
+ flowObj.removeFlowEntry(flowEntryObj);
+ dbHandler.removeFlowEntry(flowEntryObj);
+ return true;
+ }
+
+ /**
+ * Delete all previously added flows.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @return true on success, otherwise false.
+ */
+ static boolean deleteAllFlows(GraphDBOperation dbHandler) {
+ List<FlowId> allFlowIds = new LinkedList<FlowId>();
+
+ // Get all Flow IDs
+ Iterable<IFlowPath> allFlowPaths = dbHandler.getAllFlowPaths();
+ for (IFlowPath flowPathObj : allFlowPaths) {
+ if (flowPathObj == null)
+ continue;
+ String flowIdStr = flowPathObj.getFlowId();
+ if (flowIdStr == null)
+ continue;
+ FlowId flowId = new FlowId(flowIdStr);
+ allFlowIds.add(flowId);
+ }
+
+ // Delete all flows one-by-one
+ for (FlowId flowId : allFlowIds) {
+ deleteFlow(dbHandler, flowId);
+ }
+
+ return true;
+ }
+
+ /**
+ * Delete a previously added flow.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param flowId the Flow ID of the flow to delete.
+ * @return true on success, otherwise false.
+ */
+ static boolean deleteFlow(GraphDBOperation dbHandler, FlowId flowId) {
+ IFlowPath flowObj = null;
+ try {
+ flowObj = dbHandler.searchFlowPath(flowId);
+ } catch (Exception e) {
+ // TODO: handle exceptions
+ dbHandler.rollback();
+ log.error(":deleteFlow FlowId:{} failed", flowId.toString());
+ return false;
+ }
+ if (flowObj == null) {
+ dbHandler.commit();
+ return true; // OK: No such flow
+ }
+
+ //
+ // Remove all Flow Entries
+ //
+ Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
+ for (IFlowEntry flowEntryObj : flowEntries) {
+ flowObj.removeFlowEntry(flowEntryObj);
+ dbHandler.removeFlowEntry(flowEntryObj);
+ }
+ // Remove the Flow itself
+ dbHandler.removeFlowPath(flowObj);
+ dbHandler.commit();
+
+ return true;
+ }
+
+ /**
+ * Get a previously added flow.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param flowId the Flow ID of the flow to get.
+ * @return the Flow Path if found, otherwise null.
+ */
+ static FlowPath getFlow(GraphDBOperation dbHandler, FlowId flowId) {
+ IFlowPath flowObj = null;
+ try {
+ flowObj = dbHandler.searchFlowPath(flowId);
+ } catch (Exception e) {
+ // TODO: handle exceptions
+ dbHandler.rollback();
+ log.error(":getFlow FlowId:{} failed", flowId.toString());
+ return null;
+ }
+ if (flowObj == null) {
+ dbHandler.commit();
+ return null; // Flow not found
+ }
+
+ //
+ // Extract the Flow state
+ //
+ FlowPath flowPath = extractFlowPath(flowObj);
+ dbHandler.commit();
+
+ return flowPath;
+ }
+
+ /**
+ * Get all installed flows by all installers.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @return the Flow Paths if found, otherwise null.
+ */
+ static ArrayList<FlowPath> getAllFlows(GraphDBOperation dbHandler) {
+ Iterable<IFlowPath> flowPathsObj = null;
+ ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
+
+ try {
+ flowPathsObj = dbHandler.getAllFlowPaths();
+ } catch (Exception e) {
+ // TODO: handle exceptions
+ dbHandler.rollback();
+ log.error(":getAllFlowPaths failed");
+ return flowPaths;
+ }
+ if ((flowPathsObj == null) || (flowPathsObj.iterator().hasNext() == false)) {
+ dbHandler.commit();
+ return flowPaths; // No Flows found
+ }
+
+ for (IFlowPath flowObj : flowPathsObj) {
+ //
+ // Extract the Flow state
+ //
+ FlowPath flowPath = extractFlowPath(flowObj);
+ if (flowPath != null)
+ flowPaths.add(flowPath);
+ }
+
+ dbHandler.commit();
+
+ return flowPaths;
+ }
+
+ /**
+ * Extract Flow Path State from a Titan Database Object @ref IFlowPath.
+ *
+ * @param flowObj the object to extract the Flow Path State from.
+ * @return the extracted Flow Path State.
+ */
+ private static FlowPath extractFlowPath(IFlowPath flowObj) {
+ //
+ // Extract the Flow state
+ //
+ String flowIdStr = flowObj.getFlowId();
+ String installerIdStr = flowObj.getInstallerId();
+ String flowPathType = flowObj.getFlowPathType();
+ String flowPathUserState = flowObj.getFlowPathUserState();
+ Long flowPathFlags = flowObj.getFlowPathFlags();
+ String srcSwitchStr = flowObj.getSrcSwitch();
+ Short srcPortShort = flowObj.getSrcPort();
+ String dstSwitchStr = flowObj.getDstSwitch();
+ Short dstPortShort = flowObj.getDstPort();
+
+ if ((flowIdStr == null) ||
+ (installerIdStr == null) ||
+ (flowPathType == null) ||
+ (flowPathUserState == null) ||
+ (flowPathFlags == null) ||
+ (srcSwitchStr == null) ||
+ (srcPortShort == null) ||
+ (dstSwitchStr == null) ||
+ (dstPortShort == null)) {
+ // TODO: A work-around, becauuse of some bogus database objects
+ return null;
+ }
+
+ FlowPath flowPath = new FlowPath();
+ flowPath.setFlowId(new FlowId(flowIdStr));
+ flowPath.setInstallerId(new CallerId(installerIdStr));
+ flowPath.setFlowPathType(FlowPathType.valueOf(flowPathType));
+ flowPath.setFlowPathUserState(FlowPathUserState.valueOf(flowPathUserState));
+ flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
+ flowPath.dataPath().srcPort().setDpid(new Dpid(srcSwitchStr));
+ flowPath.dataPath().srcPort().setPort(new Port(srcPortShort));
+ flowPath.dataPath().dstPort().setDpid(new Dpid(dstSwitchStr));
+ flowPath.dataPath().dstPort().setPort(new Port(dstPortShort));
+ //
+ // Extract the match conditions common for all Flow Entries
+ //
+ {
+ FlowEntryMatch match = new FlowEntryMatch();
+ String matchSrcMac = flowObj.getMatchSrcMac();
+ if (matchSrcMac != null)
+ match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
+ String matchDstMac = flowObj.getMatchDstMac();
+ if (matchDstMac != null)
+ match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+
+ flowPath.setFlowEntryMatch(match);
+ }
+ //
+ // Extract the actions for the first Flow Entry
+ //
+ {
+ String actionsStr = flowObj.getActions();
+ if (actionsStr != null) {
+ FlowEntryActions flowEntryActions = new FlowEntryActions(actionsStr);
+ flowPath.setFlowEntryActions(flowEntryActions);
+ }
+ }
+
+ //
+ // Extract all Flow Entries
+ //
+ Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
+ for (IFlowEntry flowEntryObj : flowEntries) {
+ FlowEntry flowEntry = extractFlowEntry(flowEntryObj);
+ if (flowEntry == null)
+ continue;
+ flowPath.dataPath().flowEntries().add(flowEntry);
+ }
+
+ return flowPath;
+ }
+
+ /**
+ * Extract Flow Entry State from a Titan Database Object @ref IFlowEntry.
+ *
+ * @param flowEntryObj the object to extract the Flow Entry State from.
+ * @return the extracted Flow Entry State.
+ */
+ public static FlowEntry extractFlowEntry(IFlowEntry flowEntryObj) {
+ String flowEntryIdStr = flowEntryObj.getFlowEntryId();
+ String switchDpidStr = flowEntryObj.getSwitchDpid();
+ String userState = flowEntryObj.getUserState();
+ String switchState = flowEntryObj.getSwitchState();
+
+ if ((flowEntryIdStr == null) ||
+ (switchDpidStr == null) ||
+ (userState == null) ||
+ (switchState == null)) {
+ // TODO: A work-around, because of some bogus database objects
+ return null;
+ }
+
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setFlowEntryId(new FlowEntryId(flowEntryIdStr));
+ flowEntry.setDpid(new Dpid(switchDpidStr));
+
+ //
+ // Extract the match conditions
+ //
+ FlowEntryMatch match = new FlowEntryMatch();
+ Short matchInPort = flowEntryObj.getMatchInPort();
+ if (matchInPort != null)
+ match.enableInPort(new Port(matchInPort));
+ String matchSrcMac = flowEntryObj.getMatchSrcMac();
+ if (matchSrcMac != null)
+ match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
+ String matchDstMac = flowEntryObj.getMatchDstMac();
+ if (matchDstMac != null)
+ match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowEntryObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowEntryObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowEntryObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+ flowEntry.setFlowEntryMatch(match);
+
+ //
+ // Extract the actions
+ //
+ FlowEntryActions actions = new FlowEntryActions();
+ String actionsStr = flowEntryObj.getActions();
+ if (actionsStr != null)
+ actions = new FlowEntryActions(actionsStr);
+ flowEntry.setFlowEntryActions(actions);
+ flowEntry.setFlowEntryUserState(FlowEntryUserState.valueOf(userState));
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.valueOf(switchState));
+ //
+ // TODO: Take care of FlowEntryErrorState.
+ //
+ return flowEntry;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
new file mode 100644
index 0000000..6c200fa
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -0,0 +1,892 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.ofcontroller.topology.Topology;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.EventEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction;
+import net.onrc.onos.ofcontroller.util.FlowEntryActions;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+import net.onrc.onos.ofcontroller.util.FlowEntrySwitchState;
+import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathUserState;
+import net.onrc.onos.ofcontroller.util.serializers.KryoFactory;
+
+import com.esotericsoftware.kryo2.Kryo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class for FlowPath Maintenance.
+ * This class listens for FlowEvents to:
+ * - Maintain a local cache of the Network Topology.
+ * - Detect FlowPaths impacted by Topology change.
+ * - Recompute impacted FlowPath using cached Topology.
+ */
+class FlowEventHandler extends Thread implements IFlowEventHandlerService {
+ /** The logger. */
+ private final static Logger log = LoggerFactory.getLogger(FlowEventHandler.class);
+
+ private FlowManager flowManager; // The Flow Manager to use
+ private IDatagridService datagridService; // The Datagrid Service to use
+ private Topology topology; // The network topology
+ private KryoFactory kryoFactory = new KryoFactory();
+
+ // The queue with Flow Path and Topology Element updates
+ private BlockingQueue<EventEntry<?>> networkEvents =
+ new LinkedBlockingQueue<EventEntry<?>>();
+
+ // The pending Topology, FlowPath, and FlowEntry events
+ private List<EventEntry<TopologyElement>> topologyEvents =
+ new LinkedList<EventEntry<TopologyElement>>();
+ private List<EventEntry<FlowPath>> flowPathEvents =
+ new LinkedList<EventEntry<FlowPath>>();
+ private List<EventEntry<FlowEntry>> flowEntryEvents =
+ new LinkedList<EventEntry<FlowEntry>>();
+
+ // All internally computed Flow Paths
+ private Map<Long, FlowPath> allFlowPaths = new HashMap<Long, FlowPath>();
+
+ // The Flow Entries received as notifications with unmatched Flow Paths
+ private Map<Long, FlowEntry> unmatchedFlowEntryAdd =
+ new HashMap<Long, FlowEntry>();
+
+ //
+ // Transient state for processing the Flow Paths:
+ // - The Flow Paths that should be recomputed
+ // - The Flow Paths with modified Flow Entries
+ //
+ private Map<Long, FlowPath> shouldRecomputeFlowPaths =
+ new HashMap<Long, FlowPath>();
+ private Map<Long, FlowPath> modifiedFlowPaths =
+ new HashMap<Long, FlowPath>();
+
+ /**
+ * Constructor for a given Flow Manager and Datagrid Service.
+ *
+ * @param flowManager the Flow Manager to use.
+ * @param datagridService the Datagrid Service to use.
+ */
+ FlowEventHandler(FlowManager flowManager,
+ IDatagridService datagridService) {
+ this.flowManager = flowManager;
+ this.datagridService = datagridService;
+ this.topology = new Topology();
+ }
+
+ /**
+ * Get the network topology.
+ *
+ * @return the network topology.
+ */
+ protected Topology getTopology() { return this.topology; }
+
+ /**
+ * Startup processing.
+ */
+ private void startup() {
+ //
+ // Obtain the initial Topology state
+ //
+ Collection<TopologyElement> topologyElements =
+ datagridService.getAllTopologyElements();
+ for (TopologyElement topologyElement : topologyElements) {
+ EventEntry<TopologyElement> eventEntry =
+ new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_ADD, topologyElement);
+ topologyEvents.add(eventEntry);
+ }
+ //
+ // Obtain the initial Flow Path state
+ //
+ Collection<FlowPath> flowPaths = datagridService.getAllFlows();
+ for (FlowPath flowPath : flowPaths) {
+ EventEntry<FlowPath> eventEntry =
+ new EventEntry<FlowPath>(EventEntry.Type.ENTRY_ADD, flowPath);
+ flowPathEvents.add(eventEntry);
+ }
+ //
+ // Obtain the initial FlowEntry state
+ //
+ Collection<FlowEntry> flowEntries = datagridService.getAllFlowEntries();
+ for (FlowEntry flowEntry : flowEntries) {
+ EventEntry<FlowEntry> eventEntry =
+ new EventEntry<FlowEntry>(EventEntry.Type.ENTRY_ADD, flowEntry);
+ flowEntryEvents.add(eventEntry);
+ }
+
+ // Process the initial events (if any)
+ synchronized (allFlowPaths) {
+ processEvents();
+ }
+ }
+
+ /**
+ * Run the thread.
+ */
+ @Override
+ public void run() {
+ startup();
+
+ //
+ // The main loop
+ //
+ Collection<EventEntry<?>> collection = new LinkedList<EventEntry<?>>();
+ try {
+ while (true) {
+ EventEntry<?> eventEntry = networkEvents.take();
+ collection.add(eventEntry);
+ networkEvents.drainTo(collection);
+
+ //
+ // Demultiplex all events:
+ // - EventEntry<TopologyElement>
+ // - EventEntry<FlowPath>
+ // - EventEntry<FlowEntry>
+ //
+ for (EventEntry<?> event : collection) {
+ // Topology event
+ if (event.eventData() instanceof TopologyElement) {
+ EventEntry<TopologyElement> topologyEventEntry =
+ (EventEntry<TopologyElement>)event;
+ topologyEvents.add(topologyEventEntry);
+ continue;
+ }
+
+ // FlowPath event
+ if (event.eventData() instanceof FlowPath) {
+ EventEntry<FlowPath> flowPathEventEntry =
+ (EventEntry<FlowPath>)event;
+ flowPathEvents.add(flowPathEventEntry);
+ continue;
+ }
+
+ // FlowEntry event
+ if (event.eventData() instanceof FlowEntry) {
+ EventEntry<FlowEntry> flowEntryEventEntry =
+ (EventEntry<FlowEntry>)event;
+ flowEntryEvents.add(flowEntryEventEntry);
+ continue;
+ }
+ }
+ collection.clear();
+
+ // Process the events (if any)
+ synchronized (allFlowPaths) {
+ processEvents();
+ }
+ }
+ } catch (Exception exception) {
+ log.debug("Exception processing Network Events: ", exception);
+ }
+ }
+
+ /**
+ * Process the events (if any)
+ */
+ private void processEvents() {
+ Collection<FlowEntry> modifiedFlowEntries;
+
+ if (topologyEvents.isEmpty() && flowPathEvents.isEmpty() &&
+ flowEntryEvents.isEmpty()) {
+ return; // Nothing to do
+ }
+
+ processFlowPathEvents();
+ processTopologyEvents();
+ processFlowEntryEvents();
+
+ // Recompute all affected Flow Paths and keep only the modified
+ for (FlowPath flowPath : shouldRecomputeFlowPaths.values()) {
+ if (recomputeFlowPath(flowPath))
+ modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
+ }
+
+ // Extract the modified Flow Entries
+ modifiedFlowEntries = extractModifiedFlowEntries(modifiedFlowPaths.values());
+
+ // Assign missing Flow Entry IDs
+ assignFlowEntryId(modifiedFlowEntries);
+
+ //
+ // Push the modified state to the Flow Manager
+ //
+ flowManager.pushModifiedFlowState(modifiedFlowPaths.values(),
+ modifiedFlowEntries);
+
+ //
+ // Remove Flow Entries that were deleted
+ //
+ for (FlowPath flowPath : modifiedFlowPaths.values())
+ flowPath.dataPath().removeDeletedFlowEntries();
+
+ // Cleanup
+ topologyEvents.clear();
+ flowPathEvents.clear();
+ flowEntryEvents.clear();
+ //
+ shouldRecomputeFlowPaths.clear();
+ modifiedFlowPaths.clear();
+ }
+
+ /**
+ * Extract the modified Flow Entries.
+ *
+ * @param modifiedFlowPaths the Flow Paths to process.
+ * @return a collection with the modified Flow Entries.
+ */
+ private Collection<FlowEntry> extractModifiedFlowEntries(
+ Collection<FlowPath> modifiedFlowPaths) {
+ List<FlowEntry> modifiedFlowEntries = new LinkedList<FlowEntry>();
+
+ // Extract only the modified Flow Entries
+ for (FlowPath flowPath : modifiedFlowPaths) {
+ for (FlowEntry flowEntry : flowPath.flowEntries()) {
+ if (flowEntry.flowEntrySwitchState() ==
+ FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED) {
+ modifiedFlowEntries.add(flowEntry);
+ }
+ }
+ }
+ return modifiedFlowEntries;
+ }
+
+ /**
+ * Assign the Flow Entry ID as needed.
+ *
+ * @param modifiedFlowEnries the collection of Flow Entries that need
+ * Flow Entry ID assigned.
+ */
+ private void assignFlowEntryId(Collection<FlowEntry> modifiedFlowEntries) {
+ if (modifiedFlowEntries.isEmpty())
+ return;
+
+ Map<Long, IOFSwitch> mySwitches = flowManager.getMySwitches();
+
+ //
+ // Assign the Flow Entry ID only for Flow Entries for my switches
+ //
+ for (FlowEntry flowEntry : modifiedFlowEntries) {
+ IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value());
+ if (mySwitch == null)
+ continue;
+ if (! flowEntry.isValidFlowEntryId()) {
+ long id = flowManager.getNextFlowEntryId();
+ flowEntry.setFlowEntryId(new FlowEntryId(id));
+ }
+ }
+ }
+
+ /**
+ * Process the Flow Path events.
+ */
+ private void processFlowPathEvents() {
+ //
+ // Process all Flow Path events and update the appropriate state
+ //
+ for (EventEntry<FlowPath> eventEntry : flowPathEvents) {
+ FlowPath flowPath = eventEntry.eventData();
+
+ log.debug("Flow Event: {} {}", eventEntry.eventType(),
+ flowPath.toString());
+
+ switch (eventEntry.eventType()) {
+ case ENTRY_ADD: {
+ //
+ // Add a new Flow Path
+ //
+ if (allFlowPaths.get(flowPath.flowId().value()) != null) {
+ //
+ // TODO: What to do if the Flow Path already exists?
+ // Fow now, we just re-add it.
+ //
+ }
+
+ switch (flowPath.flowPathType()) {
+ case FP_TYPE_SHORTEST_PATH:
+ //
+ // Reset the Data Path, in case it was set already, because
+ // we are going to recompute it anyway.
+ //
+ flowPath.flowEntries().clear();
+ shouldRecomputeFlowPaths.put(flowPath.flowId().value(),
+ flowPath);
+ break;
+ case FP_TYPE_EXPLICIT_PATH:
+ //
+ // Mark all Flow Entries for installation in the switches.
+ //
+ for (FlowEntry flowEntry : flowPath.flowEntries()) {
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ }
+ modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
+ break;
+ }
+ allFlowPaths.put(flowPath.flowId().value(), flowPath);
+
+ break;
+ }
+
+ case ENTRY_REMOVE: {
+ //
+ // Remove an existing Flow Path.
+ //
+ // Find the Flow Path, and mark the Flow and its Flow Entries
+ // for deletion.
+ //
+ FlowPath existingFlowPath =
+ allFlowPaths.get(flowPath.flowId().value());
+ if (existingFlowPath == null)
+ continue; // Nothing to do
+
+ existingFlowPath.setFlowPathUserState(FlowPathUserState.FP_USER_DELETE);
+ for (FlowEntry flowEntry : existingFlowPath.flowEntries()) {
+ flowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ }
+
+ // Remove the Flow Path from the internal state
+ Long key = existingFlowPath.flowId().value();
+ allFlowPaths.remove(key);
+ shouldRecomputeFlowPaths.remove(key);
+ modifiedFlowPaths.put(key, existingFlowPath);
+
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Process the Topology events.
+ */
+ private void processTopologyEvents() {
+ //
+ // Process all Topology events and update the appropriate state
+ //
+ boolean isTopologyModified = false;
+ for (EventEntry<TopologyElement> eventEntry : topologyEvents) {
+ TopologyElement topologyElement = eventEntry.eventData();
+
+ log.debug("Topology Event: {} {}", eventEntry.eventType(),
+ topologyElement.toString());
+
+ switch (eventEntry.eventType()) {
+ case ENTRY_ADD:
+ isTopologyModified |= topology.addTopologyElement(topologyElement);
+ break;
+ case ENTRY_REMOVE:
+ isTopologyModified |= topology.removeTopologyElement(topologyElement);
+ break;
+ }
+ }
+ if (isTopologyModified) {
+ // TODO: For now, if the topology changes, we recompute all Flows
+ shouldRecomputeFlowPaths.putAll(allFlowPaths);
+ }
+ }
+
+ /**
+ * Process the Flow Entry events.
+ */
+ private void processFlowEntryEvents() {
+ FlowPath flowPath;
+ FlowEntry updatedFlowEntry;
+
+ //
+ // Update Flow Entries with previously unmatched Flow Entry updates
+ //
+ if (! unmatchedFlowEntryAdd.isEmpty()) {
+ Map<Long, FlowEntry> remainingUpdates = new HashMap<Long, FlowEntry>();
+ for (FlowEntry flowEntry : unmatchedFlowEntryAdd.values()) {
+ flowPath = allFlowPaths.get(flowEntry.flowId().value());
+ if (flowPath == null)
+ continue;
+ updatedFlowEntry = updateFlowEntryAdd(flowPath, flowEntry);
+ if (updatedFlowEntry == null) {
+ remainingUpdates.put(flowEntry.flowEntryId().value(),
+ flowEntry);
+ continue;
+ }
+ modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
+ }
+ unmatchedFlowEntryAdd = remainingUpdates;
+ }
+
+ //
+ // Process all Flow Entry events and update the appropriate state
+ //
+ for (EventEntry<FlowEntry> eventEntry : flowEntryEvents) {
+ FlowEntry flowEntry = eventEntry.eventData();
+
+ log.debug("Flow Entry Event: {} {}", eventEntry.eventType(),
+ flowEntry.toString());
+
+ if ((! flowEntry.isValidFlowId()) ||
+ (! flowEntry.isValidFlowEntryId())) {
+ continue;
+ }
+
+ switch (eventEntry.eventType()) {
+ case ENTRY_ADD:
+ flowPath = allFlowPaths.get(flowEntry.flowId().value());
+ if (flowPath == null) {
+ // Flow Path not found: keep the entry for later matching
+ unmatchedFlowEntryAdd.put(flowEntry.flowEntryId().value(),
+ flowEntry);
+ break;
+ }
+ updatedFlowEntry = updateFlowEntryAdd(flowPath, flowEntry);
+ if (updatedFlowEntry == null) {
+ // Flow Entry not found: keep the entry for later matching
+ unmatchedFlowEntryAdd.put(flowEntry.flowEntryId().value(),
+ flowEntry);
+ break;
+ }
+ // Add the updated entry to the list of updated Flow Entries
+ modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
+ break;
+
+ case ENTRY_REMOVE:
+ flowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
+ if (unmatchedFlowEntryAdd.remove(flowEntry.flowEntryId().value()) != null) {
+ continue; // Removed previously unmatched entry
+ }
+
+ flowPath = allFlowPaths.get(flowEntry.flowId().value());
+ if (flowPath == null) {
+ // Flow Path not found: ignore the update
+ break;
+ }
+ updatedFlowEntry = updateFlowEntryRemove(flowPath, flowEntry);
+ if (updatedFlowEntry == null) {
+ // Flow Entry not found: ignore it
+ break;
+ }
+ modifiedFlowPaths.put(flowPath.flowId().value(), flowPath);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Update a Flow Entry because of an external ENTRY_ADD event.
+ *
+ * @param flowPath the FlowPath for the Flow Entry to update.
+ * @param flowEntry the FlowEntry with the new state.
+ * @return the updated Flow Entry if found, otherwise null.
+ */
+ private FlowEntry updateFlowEntryAdd(FlowPath flowPath,
+ FlowEntry flowEntry) {
+ //
+ // Iterate over all Flow Entries and find a match.
+ //
+ for (FlowEntry localFlowEntry : flowPath.flowEntries()) {
+ if (! TopologyManager.isSameFlowEntryDataPath(localFlowEntry,
+ flowEntry)) {
+ continue;
+ }
+
+ //
+ // Local Flow Entry match found
+ //
+ if (localFlowEntry.isValidFlowEntryId()) {
+ if (localFlowEntry.flowEntryId().value() !=
+ flowEntry.flowEntryId().value()) {
+ //
+ // Find a local Flow Entry, but the Flow Entry ID doesn't
+ // match. Keep looking.
+ //
+ continue;
+ }
+ } else {
+ // Update the Flow Entry ID
+ FlowEntryId flowEntryId =
+ new FlowEntryId(flowEntry.flowEntryId().value());
+ localFlowEntry.setFlowEntryId(flowEntryId);
+ }
+
+ //
+ // Update the local Flow Entry.
+ //
+ localFlowEntry.setFlowEntryUserState(flowEntry.flowEntryUserState());
+ localFlowEntry.setFlowEntrySwitchState(flowEntry.flowEntrySwitchState());
+ return localFlowEntry;
+ }
+
+ return null; // Entry not found
+ }
+
+ /**
+ * Update a Flow Entry because of an external ENTRY_REMOVE event.
+ *
+ * @param flowPath the FlowPath for the Flow Entry to update.
+ * @param flowEntry the FlowEntry with the new state.
+ * @return the updated Flow Entry if found, otherwise null.
+ */
+ private FlowEntry updateFlowEntryRemove(FlowPath flowPath,
+ FlowEntry flowEntry) {
+ //
+ // Iterate over all Flow Entries and find a match based on
+ // the Flow Entry ID.
+ //
+ for (FlowEntry localFlowEntry : flowPath.flowEntries()) {
+ if (! localFlowEntry.isValidFlowEntryId())
+ continue;
+ if (localFlowEntry.flowEntryId().value() !=
+ flowEntry.flowEntryId().value()) {
+ continue;
+ }
+ //
+ // Update the local Flow Entry.
+ //
+ localFlowEntry.setFlowEntryUserState(flowEntry.flowEntryUserState());
+ localFlowEntry.setFlowEntrySwitchState(flowEntry.flowEntrySwitchState());
+ return localFlowEntry;
+ }
+
+ return null; // Entry not found
+ }
+
+ /**
+ * Recompute a Flow Path.
+ *
+ * @param flowPath the Flow Path to recompute.
+ * @return true if the recomputed Flow Path has changed, otherwise false.
+ */
+ private boolean recomputeFlowPath(FlowPath flowPath) {
+ boolean hasChanged = false;
+
+ //
+ // Test whether the Flow Path needs to be recomputed
+ //
+ switch (flowPath.flowPathType()) {
+ case FP_TYPE_UNKNOWN:
+ return false; // Can't recompute on Unknown FlowType
+ case FP_TYPE_SHORTEST_PATH:
+ break;
+ case FP_TYPE_EXPLICIT_PATH:
+ return false; // An explicit path never changes
+ }
+
+ DataPath oldDataPath = flowPath.dataPath();
+
+ // Compute the new path
+ DataPath newDataPath = TopologyManager.computeNetworkPath(topology,
+ flowPath);
+ if (newDataPath == null) {
+ // We need the DataPath to compare the paths
+ newDataPath = new DataPath();
+ }
+ newDataPath.applyFlowPathFlags(flowPath.flowPathFlags());
+
+ //
+ // Test whether the new path is same
+ //
+ if (oldDataPath.flowEntries().size() !=
+ newDataPath.flowEntries().size()) {
+ hasChanged = true;
+ } else {
+ Iterator<FlowEntry> oldIter = oldDataPath.flowEntries().iterator();
+ Iterator<FlowEntry> newIter = newDataPath.flowEntries().iterator();
+ while (oldIter.hasNext() && newIter.hasNext()) {
+ FlowEntry oldFlowEntry = oldIter.next();
+ FlowEntry newFlowEntry = newIter.next();
+ if (! TopologyManager.isSameFlowEntryDataPath(oldFlowEntry,
+ newFlowEntry)) {
+ hasChanged = true;
+ break;
+ }
+ }
+ }
+ if (! hasChanged)
+ return hasChanged;
+
+ //
+ // Merge the changes in the path:
+ // - If a Flow Entry for a switch is in the old data path, but not
+ // in the new data path, then mark it for deletion.
+ // - If a Flow Entry for a switch is in the new data path, but not
+ // in the old data path, then mark it for addition.
+ // - If a Flow Entry for a switch is in both the old and the new
+ // data path, but it has changed, e.g., the incoming and/or outgoing
+ // port(s), then mark the old Flow Entry for deletion, and mark
+ // the new Flow Entry for addition.
+ // - If a Flow Entry for a switch is in both the old and the new
+ // data path, and it hasn't changed, then just keep it.
+ //
+ // NOTE: We use the Switch DPID of each entry to match the entries
+ //
+ Map<Long, FlowEntry> oldFlowEntriesMap = new HashMap<Long, FlowEntry>();
+ Map<Long, FlowEntry> newFlowEntriesMap = new HashMap<Long, FlowEntry>();
+ ArrayList<FlowEntry> finalFlowEntries = new ArrayList<FlowEntry>();
+ List<FlowEntry> deletedFlowEntries = new LinkedList<FlowEntry>();
+
+ // Prepare maps with the Flow Entries, so they are fast to lookup
+ for (FlowEntry flowEntry : oldDataPath.flowEntries())
+ oldFlowEntriesMap.put(flowEntry.dpid().value(), flowEntry);
+ for (FlowEntry flowEntry : newDataPath.flowEntries())
+ newFlowEntriesMap.put(flowEntry.dpid().value(), flowEntry);
+
+ //
+ // Find the old Flow Entries that should be deleted
+ //
+ for (FlowEntry oldFlowEntry : oldDataPath.flowEntries()) {
+ FlowEntry newFlowEntry =
+ newFlowEntriesMap.get(oldFlowEntry.dpid().value());
+ if (newFlowEntry == null) {
+ // The old Flow Entry should be deleted: not on the path
+ oldFlowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
+ oldFlowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ deletedFlowEntries.add(oldFlowEntry);
+ }
+ }
+
+ //
+ // Find the new Flow Entries that should be added or updated
+ //
+ int idx = 0;
+ for (FlowEntry newFlowEntry : newDataPath.flowEntries()) {
+ FlowEntry oldFlowEntry =
+ oldFlowEntriesMap.get(newFlowEntry.dpid().value());
+
+ if ((oldFlowEntry != null) &&
+ TopologyManager.isSameFlowEntryDataPath(oldFlowEntry,
+ newFlowEntry)) {
+ //
+ // Both Flow Entries are same
+ //
+ finalFlowEntries.add(oldFlowEntry);
+ idx++;
+ continue;
+ }
+
+ if (oldFlowEntry != null) {
+ //
+ // The old Flow Entry should be deleted: path diverges
+ //
+ oldFlowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
+ oldFlowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ deletedFlowEntries.add(oldFlowEntry);
+ }
+
+ //
+ // Add the new Flow Entry
+ //
+ //
+ // NOTE: Assign only the Flow ID.
+ // The Flow Entry ID is assigned later only for the Flow Entries
+ // this instance is responsible for.
+ //
+ newFlowEntry.setFlowId(new FlowId(flowPath.flowId().value()));
+
+ //
+ // Allocate the FlowEntryMatch by copying the default one
+ // from the FlowPath (if set).
+ //
+ FlowEntryMatch flowEntryMatch = null;
+ if (flowPath.flowEntryMatch() != null)
+ flowEntryMatch = new FlowEntryMatch(flowPath.flowEntryMatch());
+ else
+ flowEntryMatch = new FlowEntryMatch();
+ newFlowEntry.setFlowEntryMatch(flowEntryMatch);
+
+ // Set the incoming port matching
+ flowEntryMatch.enableInPort(newFlowEntry.inPort());
+
+ //
+ // Set the actions:
+ // If the first Flow Entry, copy the Flow Path actions to it.
+ //
+ FlowEntryActions flowEntryActions = newFlowEntry.flowEntryActions();
+ if ((idx == 0) && (flowPath.flowEntryActions() != null)) {
+ FlowEntryActions flowActions =
+ new FlowEntryActions(flowPath.flowEntryActions());
+ for (FlowEntryAction action : flowActions.actions())
+ flowEntryActions.addAction(action);
+ }
+ idx++;
+
+ //
+ // Add the outgoing port output action
+ //
+ FlowEntryAction flowEntryAction = new FlowEntryAction();
+ flowEntryAction.setActionOutput(newFlowEntry.outPort());
+ flowEntryActions.addAction(flowEntryAction);
+
+ //
+ // Set the state of the new Flow Entry
+ //
+ newFlowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
+ newFlowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ finalFlowEntries.add(newFlowEntry);
+ }
+
+ //
+ // Replace the old Flow Entries with the new Flow Entries.
+ // Note that the Flow Entries that will be deleted are added at
+ // the end.
+ //
+ finalFlowEntries.addAll(deletedFlowEntries);
+ flowPath.dataPath().setFlowEntries(finalFlowEntries);
+
+ return hasChanged;
+ }
+
+ /**
+ * Receive a notification that a Flow is added.
+ *
+ * @param flowPath the Flow that is added.
+ */
+ @Override
+ public void notificationRecvFlowAdded(FlowPath flowPath) {
+ EventEntry<FlowPath> eventEntry =
+ new EventEntry<FlowPath>(EventEntry.Type.ENTRY_ADD, flowPath);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a Flow is removed.
+ *
+ * @param flowPath the Flow that is removed.
+ */
+ @Override
+ public void notificationRecvFlowRemoved(FlowPath flowPath) {
+ EventEntry<FlowPath> eventEntry =
+ new EventEntry<FlowPath>(EventEntry.Type.ENTRY_REMOVE, flowPath);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a Flow is updated.
+ *
+ * @param flowPath the Flow that is updated.
+ */
+ @Override
+ public void notificationRecvFlowUpdated(FlowPath flowPath) {
+ // NOTE: The ADD and UPDATE events are processed in same way
+ EventEntry<FlowPath> eventEntry =
+ new EventEntry<FlowPath>(EventEntry.Type.ENTRY_ADD, flowPath);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a FlowEntry is added.
+ *
+ * @param flowEntry the FlowEntry that is added.
+ */
+ @Override
+ public void notificationRecvFlowEntryAdded(FlowEntry flowEntry) {
+ EventEntry<FlowEntry> eventEntry =
+ new EventEntry<FlowEntry>(EventEntry.Type.ENTRY_ADD, flowEntry);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a FlowEntry is removed.
+ *
+ * @param flowEntry the FlowEntry that is removed.
+ */
+ @Override
+ public void notificationRecvFlowEntryRemoved(FlowEntry flowEntry) {
+ EventEntry<FlowEntry> eventEntry =
+ new EventEntry<FlowEntry>(EventEntry.Type.ENTRY_REMOVE, flowEntry);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a FlowEntry is updated.
+ *
+ * @param flowEntry the FlowEntry that is updated.
+ */
+ @Override
+ public void notificationRecvFlowEntryUpdated(FlowEntry flowEntry) {
+ // NOTE: The ADD and UPDATE events are processed in same way
+ EventEntry<FlowEntry> eventEntry =
+ new EventEntry<FlowEntry>(EventEntry.Type.ENTRY_ADD, flowEntry);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a Topology Element is added.
+ *
+ * @param topologyElement the Topology Element that is added.
+ */
+ @Override
+ public void notificationRecvTopologyElementAdded(TopologyElement topologyElement) {
+ EventEntry<TopologyElement> eventEntry =
+ new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_ADD, topologyElement);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a Topology Element is removed.
+ *
+ * @param topologyElement the Topology Element that is removed.
+ */
+ @Override
+ public void notificationRecvTopologyElementRemoved(TopologyElement topologyElement) {
+ EventEntry<TopologyElement> eventEntry =
+ new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_REMOVE, topologyElement);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Receive a notification that a Topology Element is updated.
+ *
+ * @param topologyElement the Topology Element that is updated.
+ */
+ @Override
+ public void notificationRecvTopologyElementUpdated(TopologyElement topologyElement) {
+ // NOTE: The ADD and UPDATE events are processed in same way
+ EventEntry<TopologyElement> eventEntry =
+ new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_ADD, topologyElement);
+ networkEvents.add(eventEntry);
+ }
+
+ /**
+ * Get a sorted copy of all Flow Paths.
+ *
+ * @return a sorted copy of all Flow Paths.
+ */
+ synchronized SortedMap<Long, FlowPath> getAllFlowPathsCopy() {
+ SortedMap<Long, FlowPath> sortedFlowPaths =
+ new TreeMap<Long, FlowPath>();
+
+ //
+ // TODO: For now we use serialization/deserialization to create
+ // a copy of each Flow Path. In the future, we should use proper
+ // copy constructors.
+ //
+ Kryo kryo = kryoFactory.newKryo();
+ synchronized (allFlowPaths) {
+ for (Map.Entry<Long, FlowPath> entry : allFlowPaths.entrySet()) {
+ FlowPath origFlowPath = entry.getValue();
+ FlowPath copyFlowPath = kryo.copy(origFlowPath);
+ sortedFlowPaths.put(entry.getKey(), copyFlowPath);
+ }
+ }
+ kryoFactory.deleteKryo(kryo);
+
+ return sortedFlowPaths;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
new file mode 100644
index 0000000..3fe47a0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -0,0 +1,648 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.SortedMap;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.floodlightlistener.INetworkGraphService;
+import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
+import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
+import net.onrc.onos.ofcontroller.topology.Topology;
+import net.onrc.onos.ofcontroller.util.*;
+
+import org.openflow.protocol.OFType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Flow Manager class for handling the network flows.
+ */
+public class FlowManager implements IFloodlightModule, IFlowService, INetMapStorage {
+ protected GraphDBOperation dbHandlerApi;
+ protected GraphDBOperation dbHandlerInner;
+
+ protected volatile IFloodlightProviderService floodlightProvider;
+ protected volatile IDatagridService datagridService;
+ protected IRestApiService restApi;
+ protected FloodlightModuleContext context;
+ protected FlowEventHandler flowEventHandler;
+
+ protected IFlowPusherService pusher;
+
+ // Flow Entry ID generation state
+ private static Random randomGenerator = new Random();
+ private static int nextFlowEntryIdPrefix = 0;
+ private static int nextFlowEntryIdSuffix = 0;
+
+ /** The logger. */
+ private final static Logger log = LoggerFactory.getLogger(FlowManager.class);
+
+ // The queue to write Flow Entries to the database
+ private BlockingQueue<FlowPath> flowPathsToDatabaseQueue =
+ new LinkedBlockingQueue<FlowPath>();
+ FlowDatabaseWriter flowDatabaseWriter;
+
+ /**
+ * Initialize the Flow Manager.
+ *
+ * @param conf the Graph Database configuration string.
+ */
+ @Override
+ public void init(String conf) {
+ dbHandlerApi = new GraphDBOperation(conf);
+ dbHandlerInner = new GraphDBOperation(conf);
+ }
+
+ /**
+ * Shutdown the Flow Manager operation.
+ */
+ public void finalize() {
+ close();
+ }
+
+ /**
+ * Shutdown the Flow Manager operation.
+ */
+ @Override
+ public void close() {
+ datagridService.deregisterFlowEventHandlerService(flowEventHandler);
+ dbHandlerApi.close();
+ dbHandlerInner.close();
+ }
+
+ /**
+ * Get the collection of offered module services.
+ *
+ * @return the collection of offered module services.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFlowService.class);
+ return l;
+ }
+
+ /**
+ * Get the collection of implemented services.
+ *
+ * @return the collection of implemented services.
+ */
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService>
+ getServiceImpls() {
+ Map<Class<? extends IFloodlightService>,
+ IFloodlightService> m =
+ new HashMap<Class<? extends IFloodlightService>,
+ IFloodlightService>();
+ m.put(IFlowService.class, this);
+ return m;
+ }
+
+ /**
+ * Get the collection of modules this module depends on.
+ *
+ * @return the collection of modules this module depends on.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>>
+ getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(INetworkGraphService.class);
+ l.add(IDatagridService.class);
+ l.add(IRestApiService.class);
+ return l;
+ }
+
+ /**
+ * Initialize the module.
+ *
+ * @param context the module context to use for the initialization.
+ */
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ this.context = context;
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+ datagridService = context.getServiceImpl(IDatagridService.class);
+ restApi = context.getServiceImpl(IRestApiService.class);
+ pusher = context.getServiceImpl(IFlowPusherService.class);
+
+ this.init("");
+ }
+
+ /**
+ * Get the next Flow Entry ID to use.
+ *
+ * @return the next Flow Entry ID to use.
+ */
+ @Override
+ public synchronized long getNextFlowEntryId() {
+ //
+ // Generate the next Flow Entry ID.
+ // NOTE: For now, the higher 32 bits are random, and
+ // the lower 32 bits are sequential.
+ // In the future, we need a better allocation mechanism.
+ //
+ if ((nextFlowEntryIdSuffix & 0xffffffffL) == 0xffffffffL) {
+ nextFlowEntryIdPrefix = randomGenerator.nextInt();
+ nextFlowEntryIdSuffix = 0;
+ } else {
+ nextFlowEntryIdSuffix++;
+ }
+ long result = (long)nextFlowEntryIdPrefix << 32;
+ result = result | (0xffffffffL & nextFlowEntryIdSuffix);
+ return result;
+ }
+
+ /**
+ * Startup module operation.
+ *
+ * @param context the module context to use for the startup.
+ */
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ restApi.addRestletRoutable(new FlowWebRoutable());
+
+ // Initialize the Flow Entry ID generator
+ nextFlowEntryIdPrefix = randomGenerator.nextInt();
+
+ //
+ // The thread to write to the database
+ //
+ flowDatabaseWriter = new FlowDatabaseWriter(this,
+ flowPathsToDatabaseQueue);
+ flowDatabaseWriter.start();
+
+ //
+ // The Flow Event Handler thread:
+ // - create
+ // - register with the Datagrid Service
+ // - startup
+ //
+ flowEventHandler = new FlowEventHandler(this, datagridService);
+ datagridService.registerFlowEventHandlerService(flowEventHandler);
+ flowEventHandler.start();
+ }
+
+ /**
+ * Add a flow.
+ *
+ * @param flowPath the Flow Path to install.
+ * @return the Flow ID on success, otherwise null.
+ */
+ @Override
+ public FlowId addFlow(FlowPath flowPath) {
+
+ // Allocate the Flow ID if necessary
+ if (! flowPath.isValidFlowId()) {
+ long id = getNextFlowEntryId();
+ flowPath.setFlowId(new FlowId(id));
+ }
+
+ //
+ // NOTE: We need to explicitly initialize some of the state,
+ // in case the application didn't do it.
+ //
+ for (FlowEntry flowEntry : flowPath.flowEntries()) {
+ if (flowEntry.flowEntrySwitchState() ==
+ FlowEntrySwitchState.FE_SWITCH_UNKNOWN) {
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
+ }
+ if (! flowEntry.isValidFlowId())
+ flowEntry.setFlowId(new FlowId(flowPath.flowId().value()));
+ }
+
+ if (FlowDatabaseOperation.addFlow(dbHandlerApi, flowPath)) {
+ datagridService.notificationSendFlowAdded(flowPath);
+ return flowPath.flowId();
+ }
+ return null;
+ }
+
+ /**
+ * Delete all previously added flows.
+ *
+ * @return true on success, otherwise false.
+ */
+ @Override
+ public boolean deleteAllFlows() {
+ if (FlowDatabaseOperation.deleteAllFlows(dbHandlerApi)) {
+ datagridService.notificationSendAllFlowsRemoved();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Delete a previously added flow.
+ *
+ * @param flowId the Flow ID of the flow to delete.
+ * @return true on success, otherwise false.
+ */
+ @Override
+ public boolean deleteFlow(FlowId flowId) {
+ if (FlowDatabaseOperation.deleteFlow(dbHandlerApi, flowId)) {
+ datagridService.notificationSendFlowRemoved(flowId);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get a previously added flow.
+ *
+ * @param flowId the Flow ID of the flow to get.
+ * @return the Flow Path if found, otherwise null.
+ */
+ @Override
+ public FlowPath getFlow(FlowId flowId) {
+ return FlowDatabaseOperation.getFlow(dbHandlerApi, flowId);
+ }
+
+ /**
+ * Get all installed flows by all installers.
+ *
+ * @return the Flow Paths if found, otherwise null.
+ */
+ @Override
+ public ArrayList<FlowPath> getAllFlows() {
+ return FlowDatabaseOperation.getAllFlows(dbHandlerApi);
+ }
+
+ /**
+ * Get summary of all installed flows by all installers in a given range.
+ *
+ * @param flowId the Flow ID of the first flow in the flow range to get.
+ * @param maxFlows the maximum number of flows to be returned.
+ * @return the Flow Paths if found, otherwise null.
+ */
+ @Override
+ public ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId,
+ int maxFlows) {
+ ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
+ SortedMap<Long, FlowPath> sortedFlowPaths =
+ flowEventHandler.getAllFlowPathsCopy();
+
+ //
+ // Truncate each Flow Path and Flow Entry
+ //
+ for (FlowPath flowPath : sortedFlowPaths.values()) {
+ //
+ // TODO: Add only the Flow Paths that have been successfully
+ // installed.
+ //
+ flowPath.setFlowEntryMatch(null);
+ flowPath.setFlowEntryActions(null);
+ for (FlowEntry flowEntry : flowPath.flowEntries()) {
+ flowEntry.setFlowEntryMatch(null);
+ flowEntry.setFlowEntryActions(null);
+ }
+ flowPaths.add(flowPath);
+ }
+
+ return flowPaths;
+ }
+
+ /**
+ * Get the collection of my switches.
+ *
+ * @return the collection of my switches.
+ */
+ public Map<Long, IOFSwitch> getMySwitches() {
+ return floodlightProvider.getSwitches();
+ }
+
+ /**
+ * Get the network topology.
+ *
+ * @return the network topology.
+ */
+ public Topology getTopology() {
+ return flowEventHandler.getTopology();
+ }
+
+ /**
+ * Inform the Flow Manager that a Flow Entry on switch expired.
+ *
+ * @param sw the switch the Flow Entry expired on.
+ * @param flowEntryId the Flow Entry ID of the expired Flow Entry.
+ */
+ public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId) {
+ // TODO: Not implemented yet
+ }
+
+ /**
+ * Inform the Flow Manager that a collection of Flow Entries have been
+ * pushed to a switch.
+ *
+ * @param entries the collection of <IOFSwitch, FlowEntry> pairs
+ * that have been pushed.
+ */
+ public void flowEntriesPushedToSwitch(
+ Collection<Pair<IOFSwitch, FlowEntry>> entries) {
+
+ //
+ // Process all entries
+ //
+ for (Pair<IOFSwitch, FlowEntry> entry : entries) {
+ IOFSwitch sw = entry.first;
+ FlowEntry flowEntry = entry.second;
+
+ //
+ // Mark the Flow Entry that it has been pushed to the switch
+ //
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_UPDATED);
+
+ //
+ // Write the Flow Entry to the Datagrid
+ //
+ switch (flowEntry.flowEntryUserState()) {
+ case FE_USER_ADD:
+ datagridService.notificationSendFlowEntryAdded(flowEntry);
+ break;
+ case FE_USER_MODIFY:
+ datagridService.notificationSendFlowEntryUpdated(flowEntry);
+ break;
+ case FE_USER_DELETE:
+ datagridService.notificationSendFlowEntryRemoved(flowEntry.flowEntryId());
+ break;
+ }
+ }
+ }
+
+ /**
+ * Push modified Flow-related state as appropriate.
+ *
+ * @param modifiedFlowPaths the collection of modified Flow Paths.
+ * @param modifiedFlowEntries the collection of modified Flow Entries.
+ */
+ void pushModifiedFlowState(Collection<FlowPath> modifiedFlowPaths,
+ Collection<FlowEntry> modifiedFlowEntries) {
+ //
+ // Push the modified Flow state:
+ // - Flow Entries to switches and the datagrid
+ // - Flow Paths to the database
+ //
+ pushModifiedFlowEntriesToSwitches(modifiedFlowEntries);
+ pushModifiedFlowPathsToDatabase(modifiedFlowPaths);
+ cleanupDeletedFlowEntriesFromDatagrid(modifiedFlowEntries);
+ }
+
+ /**
+ * Push modified Flow Entries to switches.
+ *
+ * NOTE: Only the Flow Entries to switches controlled by this instance
+ * are pushed.
+ *
+ * @param modifiedFlowEntries the collection of modified Flow Entries.
+ */
+ private void pushModifiedFlowEntriesToSwitches(
+ Collection<FlowEntry> modifiedFlowEntries) {
+ if (modifiedFlowEntries.isEmpty())
+ return;
+
+ List<Pair<IOFSwitch, FlowEntry>> entries =
+ new LinkedList<Pair<IOFSwitch, FlowEntry>>();
+
+ Map<Long, IOFSwitch> mySwitches = getMySwitches();
+
+ //
+ // Create a collection of my Flow Entries to push
+ //
+ for (FlowEntry flowEntry : modifiedFlowEntries) {
+ IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value());
+ if (mySwitch == null)
+ continue;
+
+ //
+ // Assign Flow Entry IDs if missing.
+ //
+ // NOTE: This is an additional safeguard, in case the
+ // mySwitches set has changed (after the Flow Entry IDs
+ // assignments by the caller).
+ //
+ if (! flowEntry.isValidFlowEntryId()) {
+ long id = getNextFlowEntryId();
+ flowEntry.setFlowEntryId(new FlowEntryId(id));
+ }
+
+ log.debug("Pushing Flow Entry To Switch: {}", flowEntry.toString());
+ entries.add(new Pair<IOFSwitch, FlowEntry>(mySwitch, flowEntry));
+ }
+
+ pusher.pushFlowEntries(entries);
+ }
+
+ /**
+ * Cleanup deleted Flow Entries from the datagrid.
+ *
+ * NOTE: We cleanup only the Flow Entries that are not for our switches.
+ * This is needed to handle the case a switch going down:
+ * It has no Master controller instance, hence no controller instance
+ * will cleanup its flow entries.
+ * This is sub-optimal: we need to elect a controller instance to handle
+ * the cleanup of such orphaned flow entries.
+ *
+ * @param modifiedFlowEntries the collection of modified Flow Entries.
+ */
+ private void cleanupDeletedFlowEntriesFromDatagrid(
+ Collection<FlowEntry> modifiedFlowEntries) {
+ if (modifiedFlowEntries.isEmpty())
+ return;
+
+ Map<Long, IOFSwitch> mySwitches = getMySwitches();
+
+ for (FlowEntry flowEntry : modifiedFlowEntries) {
+ //
+ // Process only Flow Entries that should be deleted and have
+ // a valid Flow Entry ID.
+ //
+ if (! flowEntry.isValidFlowEntryId())
+ continue;
+ if (flowEntry.flowEntryUserState() !=
+ FlowEntryUserState.FE_USER_DELETE) {
+ continue;
+ }
+
+ //
+ // NOTE: The deletion of Flow Entries for my switches is handled
+ // elsewhere.
+ //
+ IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value());
+ if (mySwitch != null)
+ continue;
+
+ log.debug("Pushing cleanup of Flow Entry To Datagrid: {}", flowEntry.toString());
+
+ //
+ // Write the Flow Entry to the Datagrid
+ //
+ datagridService.notificationSendFlowEntryRemoved(flowEntry.flowEntryId());
+ }
+ }
+
+ /**
+ * Class to implement writing to the database in a separate thread.
+ */
+ class FlowDatabaseWriter extends Thread {
+ private FlowManager flowManager;
+ private BlockingQueue<FlowPath> blockingQueue;
+
+ /**
+ * Constructor.
+ *
+ * @param flowManager the Flow Manager to use.
+ * @param blockingQueue the blocking queue to use.
+ */
+ FlowDatabaseWriter(FlowManager flowManager,
+ BlockingQueue<FlowPath> blockingQueue) {
+ this.flowManager = flowManager;
+ this.blockingQueue = blockingQueue;
+ }
+
+ /**
+ * Run the thread.
+ */
+ @Override
+ public void run() {
+ //
+ // The main loop
+ //
+ Collection<FlowPath> collection = new LinkedList<FlowPath>();
+ try {
+ while (true) {
+ FlowPath flowPath = blockingQueue.take();
+ collection.add(flowPath);
+ blockingQueue.drainTo(collection);
+ flowManager.writeModifiedFlowPathsToDatabase(collection);
+ collection.clear();
+ }
+ } catch (Exception exception) {
+ log.debug("Exception writing to the Database: ", exception);
+ }
+ }
+ }
+
+ /**
+ * Push Flow Paths to the Network MAP.
+ *
+ * NOTE: The complete Flow Paths are pushed only on the instance
+ * responsible for the first switch. This is to avoid database errors
+ * when multiple instances are writing Flow Entries for the same Flow Path.
+ *
+ * @param modifiedFlowPaths the collection of Flow Paths to push.
+ */
+ private void pushModifiedFlowPathsToDatabase(
+ Collection<FlowPath> modifiedFlowPaths) {
+ //
+ // We only add the Flow Paths to the Database Queue.
+ // The FlowDatabaseWriter thread is responsible for the actual writing.
+ //
+ flowPathsToDatabaseQueue.addAll(modifiedFlowPaths);
+ }
+
+ /**
+ * Write Flow Paths to the Network MAP.
+ *
+ * NOTE: The complete Flow Paths are pushed only on the instance
+ * responsible for the first switch. This is to avoid database errors
+ * when multiple instances are writing Flow Entries for the same Flow Path.
+ *
+ * @param modifiedFlowPaths the collection of Flow Paths to write.
+ */
+ private void writeModifiedFlowPathsToDatabase(
+ Collection<FlowPath> modifiedFlowPaths) {
+ if (modifiedFlowPaths.isEmpty())
+ return;
+
+ Map<Long, IOFSwitch> mySwitches = getMySwitches();
+
+ for (FlowPath flowPath : modifiedFlowPaths) {
+ //
+ // Push the changes only on the instance responsible for the
+ // first switch.
+ //
+ Dpid srcDpid = flowPath.dataPath().srcPort().dpid();
+ IOFSwitch mySrcSwitch = mySwitches.get(srcDpid.value());
+ if (mySrcSwitch == null)
+ continue;
+
+ //
+ // Delete the Flow Path from the Network Map
+ //
+ if (flowPath.flowPathUserState() ==
+ FlowPathUserState.FP_USER_DELETE) {
+ log.debug("Deleting Flow Path From Database: {}",
+ flowPath.toString());
+
+ try {
+ if (! FlowDatabaseOperation.deleteFlow(
+ dbHandlerInner,
+ flowPath.flowId())) {
+ log.error("Cannot delete Flow Path {} from Network Map",
+ flowPath.flowId());
+ }
+ } catch (Exception e) {
+ log.error("Exception deleting Flow Path from Network MAP: {}", e);
+ }
+ continue;
+ }
+
+ //
+ // Test whether all Flow Entries are valid
+ //
+ boolean allValid = true;
+ for (FlowEntry flowEntry : flowPath.flowEntries()) {
+ if (flowEntry.flowEntryUserState() ==
+ FlowEntryUserState.FE_USER_DELETE) {
+ continue;
+ }
+ if (! flowEntry.isValidFlowEntryId()) {
+ allValid = false;
+ break;
+ }
+ }
+ if (! allValid)
+ continue;
+
+ log.debug("Pushing Flow Path To Database: {}", flowPath.toString());
+
+ //
+ // Write the Flow Path to the Network Map
+ //
+ try {
+ if (! FlowDatabaseOperation.addFlow(dbHandlerInner, flowPath)) {
+ String logMsg = "Cannot write to Network Map Flow Path " +
+ flowPath.flowId();
+ log.error(logMsg);
+ }
+ } catch (Exception e) {
+ log.error("Exception writing Flow Path to Network MAP: ", e);
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowEventHandlerService.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowEventHandlerService.java
new file mode 100644
index 0000000..78562e1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowEventHandlerService.java
@@ -0,0 +1,73 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+/**
+ * Interface for providing Flow Event Handler Service to other modules.
+ */
+public interface IFlowEventHandlerService {
+ /**
+ * Receive a notification that a Flow is added.
+ *
+ * @param flowPath the Flow that is added.
+ */
+ void notificationRecvFlowAdded(FlowPath flowPath);
+
+ /**
+ * Receive a notification that a Flow is removed.
+ *
+ * @param flowPath the Flow that is removed.
+ */
+ void notificationRecvFlowRemoved(FlowPath flowPath);
+
+ /**
+ * Receive a notification that a Flow is updated.
+ *
+ * @param flowPath the Flow that is updated.
+ */
+ void notificationRecvFlowUpdated(FlowPath flowPath);
+
+ /**
+ * Receive a notification that a FlowEntry is added.
+ *
+ * @param flowEntry the FlowEntry that is added.
+ */
+ void notificationRecvFlowEntryAdded(FlowEntry flowEntry);
+
+ /**
+ * Receive a notification that a FlowEntry is removed.
+ *
+ * @param flowEntry the FlowEntry that is removed.
+ */
+ void notificationRecvFlowEntryRemoved(FlowEntry flowEntry);
+
+ /**
+ * Receive a notification that a FlowEntry is updated.
+ *
+ * @param flowEntry the FlowEntry that is updated.
+ */
+ void notificationRecvFlowEntryUpdated(FlowEntry flowEntry);
+
+ /**
+ * Receive a notification that a Topology Element is added.
+ *
+ * @param topologyElement the Topology Element that is added.
+ */
+ void notificationRecvTopologyElementAdded(TopologyElement topologyElement);
+
+ /**
+ * Receive a notification that a Topology Element is removed.
+ *
+ * @param topologyElement the Topology Element that is removed.
+ */
+ void notificationRecvTopologyElementRemoved(TopologyElement topologyElement);
+
+ /**
+ * Receive a notification that a Topology Element is updated.
+ *
+ * @param topologyElement the Topology Element that is updated.
+ */
+ void notificationRecvTopologyElementUpdated(TopologyElement topologyElement);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
new file mode 100644
index 0000000..a25602d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
@@ -0,0 +1,100 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.onrc.onos.ofcontroller.topology.Topology;
+import net.onrc.onos.ofcontroller.util.CallerId;
+import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.Pair;
+
+/**
+ * Interface for providing Flow Service to other modules.
+ */
+public interface IFlowService extends IFloodlightService {
+ /**
+ * Add a flow.
+ *
+ * @param flowPath the Flow Path to install.
+ * @return the Flow ID on success, otherwise null.
+ */
+ FlowId addFlow(FlowPath flowPath);
+
+ /**
+ * Delete all previously added flows.
+ *
+ * @return true on success, otherwise false.
+ */
+ boolean deleteAllFlows();
+
+ /**
+ * Delete a previously added flow.
+ *
+ * @param flowId the Flow ID of the flow to delete.
+ * @return true on success, otherwise false.
+ */
+ boolean deleteFlow(FlowId flowId);
+
+ /**
+ * Get a previously added flow.
+ *
+ * @param flowId the Flow ID of the flow to get.
+ * @return the Flow Path if found, otherwise null.
+ */
+ FlowPath getFlow(FlowId flowId);
+
+ /**
+ * Get all installed flows by all installers.
+ *
+ * @return the Flow Paths if found, otherwise null.
+ */
+ ArrayList<FlowPath> getAllFlows();
+
+ /**
+ * Get summary of all installed flows by all installers.
+ *
+ * @param flowId starting flow Id of the range
+ * @param maxFlows number of flows to return
+ * @return the Flow Paths if found, otherwise null.
+ */
+ ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
+
+ /**
+ * Get the network topology.
+ *
+ * @return the network topology.
+ */
+ Topology getTopology();
+
+ /**
+ * Get a globally unique flow ID from the flow service.
+ * NOTE: Not currently guaranteed to be globally unique.
+ *
+ * @return unique flow ID
+ */
+ public long getNextFlowEntryId();
+
+ /**
+ * Inform the Flow Manager that a Flow Entry on switch expired.
+ *
+ * @param sw the switch the Flow Entry expired on.
+ * @param flowEntryId the Flow Entry ID of the expired Flow Entry.
+ */
+ public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId);
+
+ /**
+ * Inform the Flow Manager that a collection of Flow Entries have been
+ * pushed to a switch.
+ *
+ * @param entries the collection of <IOFSwitch, FlowEntry> pairs
+ * that have been pushed.
+ */
+ public void flowEntriesPushedToSwitch(
+ Collection<Pair<IOFSwitch, FlowEntry>> entries);
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
similarity index 64%
rename from src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
index cdccae1..9afaaec 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
@@ -1,24 +1,36 @@
-package net.floodlightcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.io.IOException;
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.FlowId;
-import net.floodlightcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Flow Manager REST API implementation: Add a Flow with the Flow
+ * Entries:
+ *
+ * POST /wm/flow/add/json
+ */
public class AddFlowResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(AddFlowResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(AddFlowResource.class);
+ /**
+ * Implement the API.
+ *
+ * @param flowJson a string with the JSON representation of the Flow to
+ * add.
+ * @return the Flow ID of the added flow.
+ */
@Post("json")
public FlowId store(String flowJson) {
FlowId result = new FlowId();
@@ -52,9 +64,9 @@
// Process the request
if (flowPath != null) {
- if (flowService.addFlow(flowPath, result) != true) {
- result = new FlowId(); // Error: Return empty Flow Id
- }
+ FlowId addedFlowId = flowService.addFlow(flowPath);
+ if (addedFlowId != null)
+ result = addedFlowId;
}
return result;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
new file mode 100644
index 0000000..4d03623
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
@@ -0,0 +1,74 @@
+package net.onrc.onos.ofcontroller.flowmanager.web;
+
+import java.io.IOException;
+
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.restlet.resource.Post;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Flow Manager REST API implementation: Add a Flow by delegating
+ * the Shortest Path computation to ONOS:
+ *
+ * POST /wm/flow/add-shortest-path/json
+ */
+public class AddShortestPathFlowResource extends ServerResource {
+
+ protected final static Logger log = LoggerFactory.getLogger(AddShortestPathFlowResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @param flowJson a string with the JSON representation of the Flow to
+ * add.
+ * @return the Flow ID of the added flow.
+ */
+ @Post("json")
+ public FlowId store(String flowJson) {
+ FlowId result = new FlowId();
+
+ IFlowService flowService =
+ (IFlowService)getContext().getAttributes().
+ get(IFlowService.class.getCanonicalName());
+
+ if (flowService == null) {
+ log.debug("ONOS Flow Service not found");
+ return result;
+ }
+
+ //
+ // Extract the arguments
+ // NOTE: The "flow" is specified in JSON format.
+ //
+ ObjectMapper mapper = new ObjectMapper();
+ String flowPathStr = flowJson;
+ FlowPath flowPath = null;
+ log.debug("Add Shortest Path Flow Path: " + flowPathStr);
+ try {
+ flowPath = mapper.readValue(flowPathStr, FlowPath.class);
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Process the request
+ if (flowPath != null) {
+ FlowId addedFlowId = flowService.addFlow(flowPath);
+ if (addedFlowId != null)
+ result = addedFlowId;
+ }
+
+ return result;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java
new file mode 100644
index 0000000..5fa472f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java
@@ -0,0 +1,82 @@
+package net.onrc.onos.ofcontroller.flowmanager.web;
+
+import java.io.IOException;
+
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DatapathSummarySerializer extends JsonSerializer<String>{
+ protected final static Logger log = LoggerFactory.getLogger(DatapathSummarySerializer.class);
+
+ @Override
+ public void serialize(String datapathSummary, JsonGenerator jGen,
+ SerializerProvider serializer) throws IOException,
+ JsonProcessingException {
+
+ String[] flowEntries = datapathSummary.split(";");
+ if (flowEntries.length < 2){
+ log.debug("datapathSummary string to short to parse: {}",
+ datapathSummary);
+ jGen.writeStartObject();
+ jGen.writeEndObject();
+ return;
+ }
+
+ String[] srcFlowEntry = flowEntries[0].split("/");
+ String[] dstFlowEntry = flowEntries[flowEntries.length - 1].split("/");
+ if (srcFlowEntry.length != 3 || dstFlowEntry.length != 3){
+ log.debug("Malformed datapathSummary string: {}", datapathSummary);
+ jGen.writeStartObject();
+ jGen.writeEndObject();
+ return;
+ }
+
+ jGen.writeStartObject();
+
+ /*
+ jGen.writeObjectFieldStart("srcPort");
+ jGen.writeObjectFieldStart("dpid");
+ jGen.writeStringField("value", srcFlowEntry[1]);
+ jGen.writeEndObject();
+ jGen.writeObjectFieldStart("port");
+ jGen.writeStringField("value", srcFlowEntry[0]);
+ jGen.writeEndObject();
+ jGen.writeEndObject();
+
+ jGen.writeObjectFieldStart("dstPort");
+ jGen.writeObjectFieldStart("dpid");
+ jGen.writeStringField("value", srcFlowEntry[1]);
+ jGen.writeEndObject();
+ jGen.writeObjectFieldStart("port");
+ jGen.writeStringField("value", srcFlowEntry[2]);
+ jGen.writeEndObject();
+ jGen.writeEndObject();
+ */
+ jGen.writeArrayFieldStart("flowEntries");
+
+ for (String flowEntryString : flowEntries){
+ String[] flowEntry = flowEntryString.split("/");
+ if (flowEntry.length != 3){
+ log.debug("Malformed datapathSummary string: {}", datapathSummary);
+ jGen.writeStartObject();
+ jGen.writeEndObject();
+ continue;
+ }
+
+ jGen.writeStartObject();
+ jGen.writeObjectFieldStart("dpid");
+ jGen.writeStringField("value", flowEntry[1]);
+ jGen.writeEndObject();
+ jGen.writeEndObject();
+ }
+
+ jGen.writeEndArray();
+
+ jGen.writeEndObject();
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java
new file mode 100644
index 0000000..f4e23b8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java
@@ -0,0 +1,54 @@
+package net.onrc.onos.ofcontroller.flowmanager.web;
+
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Flow Manager REST API implementation: Delete Flow state.
+ *
+ * The "{flow-id}" request attribute value can be either a specific Flow ID,
+ * or the keyword "all" to delete all Flows:
+ *
+ * GET /wm/flow/delete/{flow-id}/json
+ */
+public class DeleteFlowResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(DeleteFlowResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @return true on success, otehrwise false.
+ */
+ @Get("json")
+ public Boolean retrieve() {
+ Boolean result = false;
+
+ IFlowService flowService =
+ (IFlowService)getContext().getAttributes().
+ get(IFlowService.class.getCanonicalName());
+
+ if (flowService == null) {
+ log.debug("ONOS Flow Service not found");
+ return result;
+ }
+
+ // Extract the arguments
+ String flowIdStr = (String) getRequestAttributes().get("flow-id");
+
+ // Process the request
+ if (flowIdStr.equals("all")) {
+ log.debug("Delete All Flows");
+ result = flowService.deleteAllFlows();
+ } else {
+ FlowId flowId = new FlowId(flowIdStr);
+ log.debug("Delete Flow Id: " + flowIdStr);
+ result = flowService.deleteFlow(flowId);
+ }
+ return result;
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
similarity index 71%
rename from src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
index cfd3505..c358263 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import net.floodlightcontroller.restserver.RestletRoutable;
@@ -6,6 +6,9 @@
import org.restlet.Restlet;
import org.restlet.routing.Router;
+/**
+ * REST API implementation for the Flow Manager.
+ */
public class FlowWebRoutable implements RestletRoutable {
/**
* Create the Restlet router and bind to the proper resources.
@@ -14,11 +17,11 @@
public Restlet getRestlet(Context context) {
Router router = new Router(context);
router.attach("/add/json", AddFlowResource.class);
+ router.attach("/add-shortest-path/json", AddShortestPathFlowResource.class);
router.attach("/delete/{flow-id}/json", DeleteFlowResource.class);
router.attach("/get/{flow-id}/json", GetFlowByIdResource.class);
- router.attach("/getall-by-installer-id/{installer-id}/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", GetAllFlowsByInstallerIdResource.class);
- router.attach("/getall-by-endpoints/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", GetAllFlowsByEndpointsResource.class);
router.attach("/getall/json", GetAllFlowsResource.class);
+ router.attach("/getsummary/{flow-id}/{max-flows}/json", GetSummaryFlowsResource.class);
return router;
}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
similarity index 60%
rename from src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
index 92317cf..a4ea960 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
@@ -1,18 +1,28 @@
-package net.floodlightcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.util.ArrayList;
-import net.floodlightcontroller.flowcache.IFlowService;
-import net.floodlightcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowPath;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Flow Manager REST API implementation: Get all Flow state.
+ *
+ * GET /wm/flow/getall/json"
+ */
public class GetAllFlowsResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class);
+ /**
+ * Implement the API.
+ *
+ * @return the collection of Flow states if any found, otherwise null.
+ */
@Get("json")
public ArrayList<FlowPath> retrieve() {
ArrayList<FlowPath> result = null;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java
new file mode 100644
index 0000000..9ceef6e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java
@@ -0,0 +1,50 @@
+package net.onrc.onos.ofcontroller.flowmanager.web;
+
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Flow Manager REST API implementation: Get a single Flow state.
+ *
+ * The "{flow-id}" request attribute value is the Flow ID of the flow to get:
+ *
+ * GET /wm/flow/get/{flow-id}/json
+ */
+public class GetFlowByIdResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(GetFlowByIdResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @return the Flow state if the flow is found, otherwise null.
+ */
+ @Get("json")
+ public FlowPath retrieve() {
+ FlowPath result = null;
+
+ IFlowService flowService =
+ (IFlowService)getContext().getAttributes().
+ get(IFlowService.class.getCanonicalName());
+
+ if (flowService == null) {
+ log.debug("ONOS Flow Service not found");
+ return result;
+ }
+
+ // Extract the arguments
+ String flowIdStr = (String) getRequestAttributes().get("flow-id");
+ FlowId flowId = new FlowId(flowIdStr);
+
+ log.debug("Get Flow Id: " + flowIdStr);
+
+ result = flowService.getFlow(flowId);
+
+ return result;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java
new file mode 100644
index 0000000..58f82a9
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java
@@ -0,0 +1,60 @@
+package net.onrc.onos.ofcontroller.flowmanager.web;
+
+import java.util.ArrayList;
+
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Flow Manager REST API implementation: Get summary of all installed
+ * flows by all installers in a given range.
+ *
+ * The "{flow-id}" request attribute value is the Flow ID of the flow in the
+ * flow range to get.
+ * The "{max-flows}" request attribute value is the maximum number of flows
+ * to be returned.
+ *
+ * GET /wm/flow/getsummary/{flow-id}/{max-flows}/json"
+ */
+public class GetSummaryFlowsResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(GetSummaryFlowsResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @return the collection of Flow states if any found, otherwise null.
+ */
+ @Get("json")
+ public ArrayList<FlowPath> retrieve() {
+ ArrayList<FlowPath> result = null;
+
+ FlowId flowId;
+ int maxFlows = 0;
+
+ IFlowService flowService = (IFlowService)getContext().getAttributes().get(IFlowService.class.getCanonicalName());
+
+ if (flowService == null) {
+ log.debug("ONOS Flow Service not found");
+ return result;
+ }
+
+ // Extract the arguments
+ String flowIdStr = (String) getRequestAttributes().get("flow-id");
+ String maxFlowStr = (String) getRequestAttributes().get("max-flows");
+ log.debug("Get Summary Flows starting flow-id: " + flowIdStr + " max-flows: " + maxFlowStr);
+
+ flowId = new FlowId(flowIdStr);
+ maxFlows = Integer.parseInt(maxFlowStr);
+ if (maxFlows < 0) maxFlows = 0;
+
+ result = flowService.getAllFlowsSummary(flowId, maxFlows);
+
+ return result;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java
new file mode 100644
index 0000000..461d231
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java
@@ -0,0 +1,177 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openflow.protocol.OFFlowRemoved;
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.IOFSwitchListener;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.onrc.onos.ofcontroller.flowprogrammer.web.FlowProgrammerWebRoutable;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.registry.controller.IControllerRegistryService;
+
+/**
+ * FlowProgrammer is a module responsible to maintain flows installed to switches.
+ * FlowProgrammer consists of FlowPusher and FlowSynchronizer.
+ * FlowPusher manages the rate of installation, and FlowSynchronizer synchronizes
+ * flows between GraphDB and switches.
+ * FlowProgrammer also watch the event of addition/deletion of switches to
+ * start/stop synchronization. When a switch is added to network, FlowProgrammer
+ * immediately kicks synchronization to keep switch's flow table latest state.
+ * Adversely, when a switch is removed from network, FlowProgrammer immediately
+ * stops synchronization.
+ * @author Brian
+ *
+ */
+public class FlowProgrammer implements IFloodlightModule,
+ IOFMessageListener,
+ IOFSwitchListener {
+ @SuppressWarnings("unused")
+ // flag to enable FlowSynchronizer
+ private static final boolean enableFlowSync = false;
+ protected static Logger log = LoggerFactory.getLogger(FlowProgrammer.class);
+ protected volatile IFloodlightProviderService floodlightProvider;
+ protected volatile IControllerRegistryService registryService;
+ protected volatile IRestApiService restApi;
+ protected volatile IFlowService flowManager;
+
+ protected FlowPusher pusher;
+ private static final int NUM_PUSHER_THREAD = 1;
+
+ protected FlowSynchronizer synchronizer;
+
+ public FlowProgrammer() {
+ pusher = new FlowPusher(NUM_PUSHER_THREAD);
+ if (enableFlowSync) {
+ synchronizer = new FlowSynchronizer();
+ }
+ }
+
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+ registryService = context.getServiceImpl(IControllerRegistryService.class);
+ restApi = context.getServiceImpl(IRestApiService.class);
+ flowManager = context.getServiceImpl(IFlowService.class);
+ pusher.init(null, context, floodlightProvider.getOFMessageFactory(), null);
+ if (enableFlowSync) {
+ synchronizer.init(pusher);
+ }
+ }
+
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+ restApi.addRestletRoutable(new FlowProgrammerWebRoutable());
+ pusher.start();
+ floodlightProvider.addOFMessageListener(OFType.FLOW_REMOVED, this);
+ floodlightProvider.addOFSwitchListener(this);
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFlowPusherService.class);
+ if (enableFlowSync) {
+ l.add(IFlowSyncService.class);
+ }
+ return l;
+ }
+
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
+ Map<Class<? extends IFloodlightService>,
+ IFloodlightService> m =
+ new HashMap<Class<? extends IFloodlightService>,
+ IFloodlightService>();
+ m.put(IFlowPusherService.class, pusher);
+ if (enableFlowSync) {
+ m.put(IFlowSyncService.class, synchronizer);
+ }
+ return m;
+ }
+
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(IRestApiService.class);
+ return l;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return "FlowProgrammer";
+ }
+
+ @Override
+ public boolean isCallbackOrderingPrereq(OFType type, String name) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isCallbackOrderingPostreq(OFType type, String name) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+ switch (msg.getType()) {
+ case FLOW_REMOVED:
+ OFFlowRemoved flowMsg = (OFFlowRemoved) msg;
+ log.debug("Got flow removed from "+ sw.getId() +": "+ flowMsg.getCookie());
+ FlowEntryId id = new FlowEntryId(flowMsg.getCookie());
+ flowManager.flowEntryOnSwitchExpired(sw, id);
+ break;
+ default:
+ break;
+ }
+
+ return Command.CONTINUE;
+ }
+
+ @Override
+ public void addedSwitch(IOFSwitch sw) {
+ log.debug("Switch added: {}", sw.getId());
+
+ if (enableFlowSync && registryService.hasControl(sw.getId())) {
+ synchronizer.synchronize(sw);
+ }
+ }
+
+ @Override
+ public void removedSwitch(IOFSwitch sw) {
+ log.debug("Switch removed: {}", sw.getId());
+
+ if (enableFlowSync) {
+ synchronizer.interrupt(sw);
+ }
+ }
+
+ @Override
+ public void switchPortChanged(Long switchId) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
new file mode 100644
index 0000000..c3c7107
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
@@ -0,0 +1,874 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Semaphore;
+
+import org.openflow.protocol.*;
+import org.openflow.protocol.action.*;
+import org.openflow.protocol.factory.BasicFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.internal.OFMessageFuture;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.floodlightcontroller.util.MACAddress;
+import net.floodlightcontroller.util.OFMessageDamper;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.*;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryActions;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
+import net.onrc.onos.ofcontroller.util.IPv4Net;
+import net.onrc.onos.ofcontroller.util.Pair;
+import net.onrc.onos.ofcontroller.util.Port;
+
+/**
+ * FlowPusher is a implementation of FlowPusherService.
+ * FlowPusher assigns one message queue instance for each one switch.
+ * Number of message processing threads is configurable by constructor, and
+ * one thread can handle multiple message queues. Each queue will be assigned to
+ * a thread according to hash function defined by getHash().
+ * Each processing thread reads messages from queues and sends it to switches
+ * in round-robin. Processing thread also calculates rate of sending to suppress
+ * excessive message sending.
+ * @author Naoki Shiota
+ *
+ */
+public class FlowPusher implements IFlowPusherService, IOFMessageListener {
+ private final static Logger log = LoggerFactory.getLogger(FlowPusher.class);
+ protected volatile IFlowService flowManager;
+
+ // NOTE: Below are moved from FlowManager.
+ // TODO: Values copied from elsewhere (class LearningSwitch).
+ // The local copy should go away!
+ //
+ protected static final int OFMESSAGE_DAMPER_CAPACITY = 50000; // TODO: find sweet spot
+ protected static final int OFMESSAGE_DAMPER_TIMEOUT = 250; // ms
+
+ // Number of messages sent to switch at once
+ protected static final int MAX_MESSAGE_SEND = 100;
+
+ public static final short PRIORITY_DEFAULT = 100;
+ public static final short FLOWMOD_DEFAULT_IDLE_TIMEOUT = 0; // infinity
+ public static final short FLOWMOD_DEFAULT_HARD_TIMEOUT = 0; // infinite
+
+ public enum QueueState {
+ READY,
+ SUSPENDED,
+ }
+
+ /**
+ * SwitchQueue represents message queue attached to a switch.
+ * This consists of queue itself and variables used for limiting sending rate.
+ * @author Naoki Shiota
+ *
+ */
+ @SuppressWarnings("serial")
+ private class SwitchQueue extends ArrayDeque<OFMessage> {
+ QueueState state;
+
+ // Max rate of sending message (bytes/ms). 0 implies no limitation.
+ long max_rate = 0; // 0 indicates no limitation
+ long last_sent_time = 0;
+ long last_sent_size = 0;
+
+ // "To be deleted" flag
+ boolean toBeDeleted = false;
+
+ /**
+ * Check if sending rate is within the rate
+ * @param current Current time
+ * @return true if within the rate
+ */
+ boolean isSendable(long current) {
+ if (max_rate == 0) {
+ // no limitation
+ return true;
+ }
+
+ if (current == last_sent_time) {
+ return false;
+ }
+
+ // Check if sufficient time (from aspect of rate) elapsed or not.
+ long rate = last_sent_size / (current - last_sent_time);
+ return (rate < max_rate);
+ }
+
+ /**
+ * Log time and size of last sent data.
+ * @param current Time to be sent.
+ * @param size Size of sent data (in bytes).
+ */
+ void logSentData(long current, long size) {
+ last_sent_time = current;
+ last_sent_size = size;
+ }
+
+ }
+
+ private OFMessageDamper messageDamper = null;
+ private IThreadPoolService threadPool = null;
+
+ private FloodlightContext context = null;
+ private BasicFactory factory = null;
+
+ // Map of threads versus dpid
+ private Map<Long, FlowPusherThread> threadMap = null;
+ // Map of Future objects versus dpid and transaction ID.
+ private Map<Long, Map<Integer, OFBarrierReplyFuture>>
+ barrierFutures = new HashMap<Long, Map<Integer, OFBarrierReplyFuture>>();
+
+ private int number_thread = 1;
+
+ /**
+ * Main thread that reads messages from queues and sends them to switches.
+ * @author Naoki Shiota
+ *
+ */
+ private class FlowPusherThread extends Thread {
+ private Map<IOFSwitch,SwitchQueue> queues
+ = new HashMap<IOFSwitch,SwitchQueue>();
+
+ // reusable latch used for waiting for arrival of message
+ private Semaphore mutex = new Semaphore(0);
+
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ // wait for message pushed to queue
+ mutex.acquire();
+ } catch (InterruptedException e) {
+ // not an error
+ log.debug("FlowPusherThread is interrupted");
+ return;
+ }
+
+ // for safety of concurrent access, copy all key objects
+ Set<IOFSwitch> keys = new HashSet<IOFSwitch>(queues.size());
+ synchronized (queues) {
+ for (IOFSwitch sw : queues.keySet()) {
+ keys.add(sw);
+ }
+ }
+
+ for (IOFSwitch sw : keys) {
+ SwitchQueue queue = queues.get(sw);
+
+ // Skip if queue is suspended
+ if (sw == null || queue == null ||
+ queue.state != QueueState.READY) {
+ continue;
+ }
+
+ synchronized (queue) {
+ processQueue(sw, queue, MAX_MESSAGE_SEND);
+ if (queue.isEmpty()) {
+ // remove queue if flagged to be.
+ if (queue.toBeDeleted) {
+ synchronized (queues) {
+ queues.remove(sw);
+ }
+ }
+ } else {
+ // if some messages remains in queue, latch down
+ if (mutex.availablePermits() == 0) {
+ mutex.release();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Read messages from queue and send them to the switch.
+ * If number of messages excess the limit, stop sending messages.
+ * @param sw Switch to which messages will be sent.
+ * @param queue Queue of messages.
+ * @param max_msg Limitation of number of messages to be sent. If set to 0,
+ * all messages in queue will be sent.
+ */
+ private void processQueue(IOFSwitch sw, SwitchQueue queue, long max_msg) {
+ // check sending rate and determine it to be sent or not
+ long current_time = System.currentTimeMillis();
+ long size = 0;
+
+ if (queue.isSendable(current_time)) {
+ int i = 0;
+ while (! queue.isEmpty()) {
+ // Number of messages excess the limit
+ if (0 < max_msg && max_msg <= i) {
+ break;
+ }
+ ++i;
+
+ OFMessage msg = queue.poll();
+ try {
+ messageDamper.write(sw, msg, context);
+// log.debug("Pusher sends message : {}", msg);
+ size += msg.getLength();
+ } catch (IOException e) {
+ e.printStackTrace();
+ log.error("Exception in sending message ({}) : {}", msg, e);
+ }
+ }
+ sw.flush();
+ queue.logSentData(current_time, size);
+ }
+ }
+ }
+
+ /**
+ * Initialize object with one thread.
+ */
+ public FlowPusher() {
+ }
+
+ /**
+ * Initialize object with threads of given number.
+ * @param number_thread Number of threads to handle messages.
+ */
+ public FlowPusher(int number_thread) {
+ this.number_thread = number_thread;
+ }
+
+ /**
+ * Set parameters needed for sending messages.
+ * @param context FloodlightContext used for sending messages.
+ * If null, FlowPusher uses default context.
+ * @param modContext FloodlightModuleContext used for acquiring
+ * ThreadPoolService and registering MessageListener.
+ * @param factory Factory object to create OFMessage objects.
+ * @param damper Message damper used for sending messages.
+ * If null, FlowPusher creates its own damper object.
+ */
+ public void init(FloodlightContext context,
+ FloodlightModuleContext modContext,
+ BasicFactory factory,
+ OFMessageDamper damper) {
+ this.context = context;
+ this.factory = factory;
+ this.threadPool = modContext.getServiceImpl(IThreadPoolService.class);
+ IFloodlightProviderService flservice = modContext.getServiceImpl(IFloodlightProviderService.class);
+ flservice.addOFMessageListener(OFType.BARRIER_REPLY, this);
+ flowManager = modContext.getServiceImpl(IFlowService.class);
+
+ if (damper != null) {
+ messageDamper = damper;
+ } else {
+ // use default values
+ messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY,
+ EnumSet.of(OFType.FLOW_MOD),
+ OFMESSAGE_DAMPER_TIMEOUT);
+ }
+ }
+
+ /**
+ * Begin processing queue.
+ */
+ public void start() {
+ if (factory == null) {
+ log.error("FlowPusher not yet initialized.");
+ return;
+ }
+
+ threadMap = new HashMap<Long,FlowPusherThread>();
+ for (long i = 0; i < number_thread; ++i) {
+ FlowPusherThread thread = new FlowPusherThread();
+
+ threadMap.put(i, thread);
+ thread.start();
+ }
+ }
+
+ @Override
+ public boolean suspend(IOFSwitch sw) {
+ SwitchQueue queue = getQueue(sw);
+
+ if (queue == null) {
+ return false;
+ }
+
+ synchronized (queue) {
+ if (queue.state == QueueState.READY) {
+ queue.state = QueueState.SUSPENDED;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public boolean resume(IOFSwitch sw) {
+ SwitchQueue queue = getQueue(sw);
+
+ if (queue == null) {
+ return false;
+ }
+
+ synchronized (queue) {
+ if (queue.state == QueueState.SUSPENDED) {
+ queue.state = QueueState.READY;
+
+ // Latch down if queue is not empty
+ FlowPusherThread thread = getProcess(sw);
+ if (! queue.isEmpty() &&
+ thread.mutex.availablePermits() == 0) {
+ thread.mutex.release();
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isSuspended(IOFSwitch sw) {
+ SwitchQueue queue = getQueue(sw);
+
+ if (queue == null) {
+ // TODO Is true suitable for this case?
+ return true;
+ }
+
+ return (queue.state == QueueState.SUSPENDED);
+ }
+
+ /**
+ * Stop processing queue and exit thread.
+ */
+ public void stop() {
+ if (threadMap == null) {
+ return;
+ }
+
+ for (FlowPusherThread t : threadMap.values()) {
+ t.interrupt();
+ }
+ }
+
+ @Override
+ public void setRate(IOFSwitch sw, long rate) {
+ SwitchQueue queue = getQueue(sw);
+ if (queue == null) {
+ return;
+ }
+
+ if (rate > 0) {
+ log.debug("rate for {} is set to {}", sw.getId(), rate);
+ queue.max_rate = rate;
+ }
+ }
+
+ @Override
+ public boolean createQueue(IOFSwitch sw) {
+ SwitchQueue queue = getQueue(sw);
+ if (queue != null) {
+ return false;
+ }
+
+ FlowPusherThread proc = getProcess(sw);
+ queue = new SwitchQueue();
+ queue.state = QueueState.READY;
+ synchronized (proc.queues) {
+ proc.queues.put(sw, queue);
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean deleteQueue(IOFSwitch sw) {
+ return deleteQueue(sw, false);
+ }
+
+ @Override
+ public boolean deleteQueue(IOFSwitch sw, boolean forceStop) {
+ FlowPusherThread proc = getProcess(sw);
+
+ if (forceStop) {
+ synchronized (proc.queues) {
+ SwitchQueue queue = proc.queues.remove(sw);
+ if (queue == null) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ SwitchQueue queue = getQueue(sw);
+ if (queue == null) {
+ return false;
+ }
+ synchronized (queue) {
+ queue.toBeDeleted = true;
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public boolean add(IOFSwitch sw, OFMessage msg) {
+ FlowPusherThread proc = getProcess(sw);
+ SwitchQueue queue = proc.queues.get(sw);
+
+ // create queue at first addition of message
+ if (queue == null) {
+ createQueue(sw);
+ queue = getQueue(sw);
+ }
+
+ synchronized (queue) {
+ queue.add(msg);
+// log.debug("Message is pushed : {}", msg);
+ }
+
+ if (proc.mutex.availablePermits() == 0) {
+ proc.mutex.release();
+ }
+
+ return true;
+ }
+
+ @Override
+ public void pushFlowEntries(
+ Collection<Pair<IOFSwitch, FlowEntry>> entries) {
+
+ List<Pair<IOFSwitch, FlowEntry>> pushedEntries =
+ new LinkedList<Pair<IOFSwitch, FlowEntry>>();
+
+ for (Pair<IOFSwitch, FlowEntry> entry : entries) {
+ if (add(entry.first, entry.second)) {
+ pushedEntries.add(entry);
+ }
+ }
+
+ //
+ // TODO: We should use the OpenFlow Barrier mechanism
+ // to check for errors, and update the SwitchState
+ // for a flow entry after the Barrier message is
+ // is received.
+ // Only after inform the Flow Manager that the entry is pushed.
+ //
+ flowManager.flowEntriesPushedToSwitch(pushedEntries);
+ }
+
+ @Override
+ public void pushFlowEntry(IOFSwitch sw, FlowEntry flowEntry) {
+ Collection<Pair<IOFSwitch, FlowEntry>> entries =
+ new LinkedList<Pair<IOFSwitch, FlowEntry>>();
+
+ entries.add(new Pair<IOFSwitch, FlowEntry>(sw, flowEntry));
+ pushFlowEntries(entries);
+ }
+
+ /**
+ * Create a message from FlowEntry and add it to the queue of the switch.
+ * @param sw Switch to which message is pushed.
+ * @param flowEntry FlowEntry object used for creating message.
+ * @return true if message is successfully added to a queue.
+ */
+ private boolean add(IOFSwitch sw, FlowEntry flowEntry) {
+ //
+ // Create the OpenFlow Flow Modification Entry to push
+ //
+ OFFlowMod fm = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD);
+ long cookie = flowEntry.flowEntryId().value();
+
+ short flowModCommand = OFFlowMod.OFPFC_ADD;
+ if (flowEntry.flowEntryUserState() == FlowEntryUserState.FE_USER_ADD) {
+ flowModCommand = OFFlowMod.OFPFC_ADD;
+ } else if (flowEntry.flowEntryUserState() == FlowEntryUserState.FE_USER_MODIFY) {
+ flowModCommand = OFFlowMod.OFPFC_MODIFY_STRICT;
+ } else if (flowEntry.flowEntryUserState() == FlowEntryUserState.FE_USER_DELETE) {
+ flowModCommand = OFFlowMod.OFPFC_DELETE_STRICT;
+ } else {
+ // Unknown user state. Ignore the entry
+ log.debug(
+ "Flow Entry ignored (FlowEntryId = {}): unknown user state {}",
+ flowEntry.flowEntryId().toString(),
+ flowEntry.flowEntryUserState());
+ return false;
+ }
+
+ //
+ // Fetch the match conditions.
+ //
+ // NOTE: The Flow matching conditions common for all Flow Entries are
+ // used ONLY if a Flow Entry does NOT have the corresponding matching
+ // condition set.
+ //
+ OFMatch match = new OFMatch();
+ match.setWildcards(OFMatch.OFPFW_ALL);
+ FlowEntryMatch flowEntryMatch = flowEntry.flowEntryMatch();
+
+ // Match the Incoming Port
+ Port matchInPort = flowEntryMatch.inPort();
+ if (matchInPort != null) {
+ match.setInputPort(matchInPort.value());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_IN_PORT);
+ }
+
+ // Match the Source MAC address
+ MACAddress matchSrcMac = flowEntryMatch.srcMac();
+ if (matchSrcMac != null) {
+ match.setDataLayerSource(matchSrcMac.toString());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+ }
+
+ // Match the Destination MAC address
+ MACAddress matchDstMac = flowEntryMatch.dstMac();
+ if (matchDstMac != null) {
+ match.setDataLayerDestination(matchDstMac.toString());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+ }
+
+ // Match the Ethernet Frame Type
+ Short matchEthernetFrameType = flowEntryMatch.ethernetFrameType();
+ if (matchEthernetFrameType != null) {
+ match.setDataLayerType(matchEthernetFrameType);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
+ }
+
+ // Match the VLAN ID
+ Short matchVlanId = flowEntryMatch.vlanId();
+ if (matchVlanId != null) {
+ match.setDataLayerVirtualLan(matchVlanId);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN);
+ }
+
+ // Match the VLAN priority
+ Byte matchVlanPriority = flowEntryMatch.vlanPriority();
+ if (matchVlanPriority != null) {
+ match.setDataLayerVirtualLanPriorityCodePoint(matchVlanPriority);
+ match.setWildcards(match.getWildcards()
+ & ~OFMatch.OFPFW_DL_VLAN_PCP);
+ }
+
+ // Match the Source IPv4 Network prefix
+ IPv4Net matchSrcIPv4Net = flowEntryMatch.srcIPv4Net();
+ if (matchSrcIPv4Net != null) {
+ match.setFromCIDR(matchSrcIPv4Net.toString(), OFMatch.STR_NW_SRC);
+ }
+
+ // Natch the Destination IPv4 Network prefix
+ IPv4Net matchDstIPv4Net = flowEntryMatch.dstIPv4Net();
+ if (matchDstIPv4Net != null) {
+ match.setFromCIDR(matchDstIPv4Net.toString(), OFMatch.STR_NW_DST);
+ }
+
+ // Match the IP protocol
+ Byte matchIpProto = flowEntryMatch.ipProto();
+ if (matchIpProto != null) {
+ match.setNetworkProtocol(matchIpProto);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_PROTO);
+ }
+
+ // Match the IP ToS (DSCP field, 6 bits)
+ Byte matchIpToS = flowEntryMatch.ipToS();
+ if (matchIpToS != null) {
+ match.setNetworkTypeOfService(matchIpToS);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_TOS);
+ }
+
+ // Match the Source TCP/UDP port
+ Short matchSrcTcpUdpPort = flowEntryMatch.srcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null) {
+ match.setTransportSource(matchSrcTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+ }
+
+ // Match the Destination TCP/UDP port
+ Short matchDstTcpUdpPort = flowEntryMatch.dstTcpUdpPort();
+ if (matchDstTcpUdpPort != null) {
+ match.setTransportDestination(matchDstTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_DST);
+ }
+
+ //
+ // Fetch the actions
+ //
+ Short actionOutputPort = null;
+ List<OFAction> openFlowActions = new ArrayList<OFAction>();
+ int actionsLen = 0;
+ FlowEntryActions flowEntryActions = flowEntry.flowEntryActions();
+ //
+ for (FlowEntryAction action : flowEntryActions.actions()) {
+ ActionOutput actionOutput = action.actionOutput();
+ ActionSetVlanId actionSetVlanId = action.actionSetVlanId();
+ ActionSetVlanPriority actionSetVlanPriority = action
+ .actionSetVlanPriority();
+ ActionStripVlan actionStripVlan = action.actionStripVlan();
+ ActionSetEthernetAddr actionSetEthernetSrcAddr = action
+ .actionSetEthernetSrcAddr();
+ ActionSetEthernetAddr actionSetEthernetDstAddr = action
+ .actionSetEthernetDstAddr();
+ ActionSetIPv4Addr actionSetIPv4SrcAddr = action
+ .actionSetIPv4SrcAddr();
+ ActionSetIPv4Addr actionSetIPv4DstAddr = action
+ .actionSetIPv4DstAddr();
+ ActionSetIpToS actionSetIpToS = action.actionSetIpToS();
+ ActionSetTcpUdpPort actionSetTcpUdpSrcPort = action
+ .actionSetTcpUdpSrcPort();
+ ActionSetTcpUdpPort actionSetTcpUdpDstPort = action
+ .actionSetTcpUdpDstPort();
+ ActionEnqueue actionEnqueue = action.actionEnqueue();
+
+ if (actionOutput != null) {
+ actionOutputPort = actionOutput.port().value();
+ // XXX: The max length is hard-coded for now
+ OFActionOutput ofa = new OFActionOutput(actionOutput.port()
+ .value(), (short) 0xffff);
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetVlanId != null) {
+ OFActionVirtualLanIdentifier ofa = new OFActionVirtualLanIdentifier(
+ actionSetVlanId.vlanId());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetVlanPriority != null) {
+ OFActionVirtualLanPriorityCodePoint ofa = new OFActionVirtualLanPriorityCodePoint(
+ actionSetVlanPriority.vlanPriority());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionStripVlan != null) {
+ if (actionStripVlan.stripVlan() == true) {
+ OFActionStripVirtualLan ofa = new OFActionStripVirtualLan();
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+ }
+
+ if (actionSetEthernetSrcAddr != null) {
+ OFActionDataLayerSource ofa = new OFActionDataLayerSource(
+ actionSetEthernetSrcAddr.addr().toBytes());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetEthernetDstAddr != null) {
+ OFActionDataLayerDestination ofa = new OFActionDataLayerDestination(
+ actionSetEthernetDstAddr.addr().toBytes());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetIPv4SrcAddr != null) {
+ OFActionNetworkLayerSource ofa = new OFActionNetworkLayerSource(
+ actionSetIPv4SrcAddr.addr().value());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetIPv4DstAddr != null) {
+ OFActionNetworkLayerDestination ofa = new OFActionNetworkLayerDestination(
+ actionSetIPv4DstAddr.addr().value());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetIpToS != null) {
+ OFActionNetworkTypeOfService ofa = new OFActionNetworkTypeOfService(
+ actionSetIpToS.ipToS());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetTcpUdpSrcPort != null) {
+ OFActionTransportLayerSource ofa = new OFActionTransportLayerSource(
+ actionSetTcpUdpSrcPort.port());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionSetTcpUdpDstPort != null) {
+ OFActionTransportLayerDestination ofa = new OFActionTransportLayerDestination(
+ actionSetTcpUdpDstPort.port());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+
+ if (actionEnqueue != null) {
+ OFActionEnqueue ofa = new OFActionEnqueue(actionEnqueue.port()
+ .value(), actionEnqueue.queueId());
+ openFlowActions.add(ofa);
+ actionsLen += ofa.getLength();
+ }
+ }
+
+ fm.setIdleTimeout(FLOWMOD_DEFAULT_IDLE_TIMEOUT)
+ .setHardTimeout(FLOWMOD_DEFAULT_HARD_TIMEOUT)
+ .setPriority(PRIORITY_DEFAULT)
+ .setBufferId(OFPacketOut.BUFFER_ID_NONE).setCookie(cookie)
+ .setCommand(flowModCommand).setMatch(match)
+ .setActions(openFlowActions)
+ .setLengthU(OFFlowMod.MINIMUM_LENGTH + actionsLen);
+ fm.setOutPort(OFPort.OFPP_NONE.getValue());
+ if ((flowModCommand == OFFlowMod.OFPFC_DELETE)
+ || (flowModCommand == OFFlowMod.OFPFC_DELETE_STRICT)) {
+ if (actionOutputPort != null)
+ fm.setOutPort(actionOutputPort);
+ }
+
+ //
+ // TODO: Set the following flag
+ // fm.setFlags(OFFlowMod.OFPFF_SEND_FLOW_REM);
+ // See method ForwardingBase::pushRoute()
+ //
+
+ //
+ // Write the message to the switch
+ //
+ log.debug("Installing flow entry "
+ + flowEntry.flowEntryUserState() + " into switch DPID: "
+ + sw.getStringId() + " flowEntryId: "
+ + flowEntry.flowEntryId().toString() + " srcMac: "
+ + matchSrcMac + " dstMac: " + matchDstMac + " inPort: "
+ + matchInPort + " outPort: " + actionOutputPort);
+
+ return add(sw, fm);
+ }
+
+ @Override
+ public OFBarrierReply barrier(IOFSwitch sw) {
+ OFMessageFuture<OFBarrierReply> future = barrierAsync(sw);
+ if (future == null) {
+ return null;
+ }
+
+ try {
+ return future.get();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ log.error("InterruptedException: {}", e);
+ return null;
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ log.error("ExecutionException: {}", e);
+ return null;
+ }
+ }
+
+ @Override
+ public OFBarrierReplyFuture barrierAsync(IOFSwitch sw) {
+ // TODO creation of message and future should be moved to OFSwitchImpl
+
+ if (sw == null) {
+ return null;
+ }
+
+ OFBarrierRequest msg = (OFBarrierRequest) factory.getMessage(OFType.BARRIER_REQUEST);
+ msg.setXid(sw.getNextTransactionId());
+
+ OFBarrierReplyFuture future = new OFBarrierReplyFuture(threadPool, sw, msg.getXid());
+ synchronized (barrierFutures) {
+ Map<Integer,OFBarrierReplyFuture> map = barrierFutures.get(sw.getId());
+ if (map == null) {
+ map = new HashMap<Integer,OFBarrierReplyFuture>();
+ barrierFutures.put(sw.getId(), map);
+ }
+ map.put(msg.getXid(), future);
+ }
+
+ add(sw, msg);
+
+ return future;
+ }
+
+ /**
+ * Get a queue attached to a switch.
+ * @param sw Switch object
+ * @return Queue object
+ */
+ protected SwitchQueue getQueue(IOFSwitch sw) {
+ if (sw == null) {
+ return null;
+ }
+
+ return getProcess(sw).queues.get(sw);
+ }
+
+ /**
+ * Get a hash value correspondent to a switch.
+ * @param sw Switch object
+ * @return Hash value
+ */
+ protected long getHash(IOFSwitch sw) {
+ // This code assumes DPID is sequentially assigned.
+ // TODO consider equalization algorithm
+ return sw.getId() % number_thread;
+ }
+
+ /**
+ * Get a Thread object which processes the queue attached to a switch.
+ * @param sw Switch object
+ * @return Thread object
+ */
+ protected FlowPusherThread getProcess(IOFSwitch sw) {
+ long hash = getHash(sw);
+
+ return threadMap.get(hash);
+ }
+
+ @Override
+ public String getName() {
+ return "flowpusher";
+ }
+
+ @Override
+ public boolean isCallbackOrderingPrereq(OFType type, String name) {
+ return false;
+ }
+
+ @Override
+ public boolean isCallbackOrderingPostreq(OFType type, String name) {
+ return false;
+ }
+
+ @Override
+ public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+ Map<Integer,OFBarrierReplyFuture> map = barrierFutures.get(sw.getId());
+ if (map == null) {
+ log.debug("null map for {} : {}", sw.getId(), barrierFutures);
+ return Command.CONTINUE;
+ }
+
+ OFBarrierReplyFuture future = map.get(msg.getXid());
+ if (future == null) {
+ log.debug("null future for {} : {}", msg.getXid(), map);
+ return Command.CONTINUE;
+ }
+
+ log.debug("Received BARRIER_REPLY : {}", msg);
+ future.deliverFuture(sw, msg);
+
+ return Command.CONTINUE;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java
new file mode 100644
index 0000000..7d5527b
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java
@@ -0,0 +1,305 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFStatisticsRequest;
+import org.openflow.protocol.statistics.OFFlowStatisticsReply;
+import org.openflow.protocol.statistics.OFFlowStatisticsRequest;
+import org.openflow.protocol.statistics.OFStatistics;
+import org.openflow.protocol.statistics.OFStatisticsType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.flowmanager.FlowDatabaseOperation;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+
+/**
+ * FlowSynchronizer is an implementation of FlowSyncService.
+ * In addition to IFlowSyncService, FlowSynchronizer periodically reads flow
+ * tables from switches and compare them with GraphDB to drop unnecessary
+ * flows and/or to install missing flows.
+ * @author Brian
+ *
+ */
+public class FlowSynchronizer implements IFlowSyncService {
+
+ private static Logger log = LoggerFactory.getLogger(FlowSynchronizer.class);
+
+ private GraphDBOperation dbHandler;
+ protected IFlowPusherService pusher;
+ private Map<IOFSwitch, Thread> switchThreads;
+
+ public FlowSynchronizer() {
+ dbHandler = new GraphDBOperation("");
+ switchThreads = new HashMap<IOFSwitch, Thread>();
+ }
+
+ @Override
+ public void synchronize(IOFSwitch sw) {
+ Synchronizer sync = new Synchronizer(sw);
+ Thread t = new Thread(sync);
+ switchThreads.put(sw, t);
+ t.start();
+ }
+
+ @Override
+ public void interrupt(IOFSwitch sw) {
+ Thread t = switchThreads.remove(sw);
+ if(t != null) {
+ t.interrupt();
+ }
+ }
+
+ /**
+ * Initialize Synchronizer.
+ * @param pusherService FlowPusherService used for sending messages.
+ */
+ public void init(IFlowPusherService pusherService) {
+ pusher = pusherService;
+ }
+
+ /**
+ * Synchronizer represents main thread of synchronization.
+ * @author Brian
+ *
+ */
+ protected class Synchronizer implements Runnable {
+ IOFSwitch sw;
+ ISwitchObject swObj;
+
+ public Synchronizer(IOFSwitch sw) {
+ this.sw = sw;
+ Dpid dpid = new Dpid(sw.getId());
+ this.swObj = dbHandler.searchSwitch(dpid.toString());
+ }
+
+ @Override
+ public void run() {
+ // TODO: stop adding other flow entries while synchronizing
+ //pusher.suspend(sw);
+ Set<FlowEntryWrapper> graphEntries = getFlowEntriesFromGraph();
+ Set<FlowEntryWrapper> switchEntries = getFlowEntriesFromSwitch();
+ compare(graphEntries, switchEntries);
+ //pusher.resume(sw);
+ }
+
+ /**
+ * Compare flows entries in GraphDB and switch to pick up necessary
+ * messages.
+ * After picking up, picked messages are added to FlowPusher.
+ * @param graphEntries Flow entries in GraphDB.
+ * @param switchEntries Flow entries in switch.
+ */
+ private void compare(Set<FlowEntryWrapper> graphEntries, Set<FlowEntryWrapper> switchEntries) {
+ int added = 0, removed = 0, skipped = 0;
+ for(FlowEntryWrapper entry : switchEntries) {
+ if(graphEntries.contains(entry)) {
+ graphEntries.remove(entry);
+ skipped++;
+ }
+ else {
+ // remove flow entry from the switch
+ entry.removeFromSwitch(sw);
+ removed++;
+ }
+ }
+ for(FlowEntryWrapper entry : graphEntries) {
+ // add flow entry to switch
+ entry.addToSwitch(sw);
+ added++;
+ }
+ log.debug("Flow entries added "+ added + ", " +
+ "Flow entries removed "+ removed + ", " +
+ "Flow entries skipped " + skipped);
+ }
+
+ /**
+ * Read GraphDB to get FlowEntries associated with a switch.
+ * @return set of FlowEntries
+ */
+ private Set<FlowEntryWrapper> getFlowEntriesFromGraph() {
+ Set<FlowEntryWrapper> entries = new HashSet<FlowEntryWrapper>();
+ for(IFlowEntry entry : swObj.getFlowEntries()) {
+ FlowEntryWrapper fe = new FlowEntryWrapper(entry);
+ entries.add(fe);
+ }
+ return entries;
+ }
+
+ /**
+ * Read flow table from switch and derive FlowEntries from table.
+ * @return set of FlowEntries
+ */
+ private Set<FlowEntryWrapper> getFlowEntriesFromSwitch() {
+
+ int lengthU = 0;
+ OFMatch match = new OFMatch();
+ match.setWildcards(OFMatch.OFPFW_ALL);
+
+ OFFlowStatisticsRequest stat = new OFFlowStatisticsRequest();
+ stat.setOutPort((short) 0xffff); //TODO: OFPort.OFPP_NONE
+ stat.setTableId((byte) 0xff); // TODO: fix this with enum (ALL TABLES)
+ stat.setMatch(match);
+ List<OFStatistics> stats = new ArrayList<OFStatistics>();
+ stats.add(stat);
+ lengthU += stat.getLength();
+
+ OFStatisticsRequest req = new OFStatisticsRequest();
+ req.setStatisticType(OFStatisticsType.FLOW);
+ req.setStatistics(stats);
+ lengthU += req.getLengthU();
+ req.setLengthU(lengthU);
+
+ List<OFStatistics> entries = null;
+ try {
+ Future<List<OFStatistics>> dfuture = sw.getStatistics(req);
+ entries = dfuture.get();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ Set<FlowEntryWrapper> results = new HashSet<FlowEntryWrapper>();
+ for(OFStatistics result : entries){
+ OFFlowStatisticsReply entry = (OFFlowStatisticsReply) result;
+ FlowEntryWrapper fe = new FlowEntryWrapper(entry);
+ results.add(fe);
+ }
+ return results;
+ }
+
+ }
+
+ /**
+ * FlowEntryWrapper represents abstract FlowEntry which is embodied
+ * by FlowEntryId (from GraphDB) or OFFlowStatisticsReply (from switch).
+ * @author Brian
+ *
+ */
+ class FlowEntryWrapper {
+ FlowEntryId flowEntryId;
+ OFFlowStatisticsReply statisticsReply;
+
+ public FlowEntryWrapper(IFlowEntry entry) {
+ flowEntryId = new FlowEntryId(entry.getFlowEntryId());
+ }
+
+ public FlowEntryWrapper(OFFlowStatisticsReply entry) {
+ flowEntryId = new FlowEntryId(entry.getCookie());
+ statisticsReply = entry;
+ }
+
+ /**
+ * Install this FlowEntry to a switch via FlowPusher.
+ * @param sw Switch to which flow will be installed.
+ */
+ public void addToSwitch(IOFSwitch sw) {
+ if (statisticsReply != null) {
+ log.error("Error adding existing flow entry {} to sw {}",
+ statisticsReply.getCookie(), sw.getId());
+ return;
+ }
+
+ // Get the Flow Entry state from the Network Graph
+ IFlowEntry iFlowEntry = null;
+ try {
+ iFlowEntry = dbHandler.searchFlowEntry(flowEntryId);
+ } catch (Exception e) {
+ log.error("Error finding flow entry {} in Network Graph",
+ flowEntryId);
+ return;
+ }
+ if (iFlowEntry == null) {
+ log.error("Cannot add flow entry {} to sw {} : flow entry not found",
+ flowEntryId, sw.getId());
+ return;
+ }
+
+ FlowEntry flowEntry =
+ FlowDatabaseOperation.extractFlowEntry(iFlowEntry);
+ if (flowEntry == null) {
+ log.error("Cannot add flow entry {} to sw {} : flow entry cannot be extracted",
+ flowEntryId, sw.getId());
+ return;
+ }
+
+ pusher.pushFlowEntry(sw, flowEntry);
+ }
+
+ /**
+ * Remove this FlowEntry from a switch via FlowPusher.
+ * @param sw Switch from which flow will be removed.
+ */
+ public void removeFromSwitch(IOFSwitch sw) {
+ if (statisticsReply == null) {
+ log.error("Error removing non-existent flow entry {} from sw {}",
+ flowEntryId, sw.getId());
+ return;
+ }
+
+ // Convert Statistics Reply to Flow Mod, then write it
+ OFFlowMod fm = new OFFlowMod();
+ fm.setCookie(statisticsReply.getCookie());
+ fm.setCommand(OFFlowMod.OFPFC_DELETE_STRICT);
+ fm.setLengthU(OFFlowMod.MINIMUM_LENGTH);
+ fm.setMatch(statisticsReply.getMatch());
+ fm.setPriority(statisticsReply.getPriority());
+ fm.setOutPort(OFPort.OFPP_NONE);
+
+ pusher.add(sw, fm);
+ }
+
+ /**
+ * Return the hash code of the Flow Entry ID
+ */
+ @Override
+ public int hashCode() {
+ return flowEntryId.hashCode();
+ }
+
+ /**
+ * Returns true of the object is another Flow Entry ID with
+ * the same value; otherwise, returns false.
+ *
+ * @param Object to compare
+ * @return true if the object has the same Flow Entry ID.
+ */
+ @Override
+ public boolean equals(Object obj){
+ if(obj.getClass() == this.getClass()) {
+ FlowEntryWrapper entry = (FlowEntryWrapper) obj;
+ // TODO: we need to actually compare the match + actions
+ return this.flowEntryId.equals(entry.flowEntryId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return flowEntryId.toString();
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowPusherService.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowPusherService.java
new file mode 100644
index 0000000..6bf20d9
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowPusherService.java
@@ -0,0 +1,127 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import java.util.Collection;
+
+import org.openflow.protocol.OFBarrierReply;
+import org.openflow.protocol.OFMessage;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.internal.OFMessageFuture;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.Pair;
+
+/**
+ * FlowPusherService is a service to send message to switches in proper rate.
+ * Conceptually a queue is attached to each switch, and FlowPusherService
+ * read a message from queue and send it to switch in order.
+ * To guarantee message has been installed, FlowPusherService can add barrier
+ * message to queue and can notify when barrier message is sent to switch.
+ * @author Naoki Shiota
+ *
+ */
+public interface IFlowPusherService extends IFloodlightService {
+ /**
+ * Create a queue correspondent to the switch.
+ * @param sw Switch to which new queue is attached.
+ * @return true if new queue is successfully created.
+ */
+ boolean createQueue(IOFSwitch sw);
+
+ /**
+ * Delete a queue correspondent to the switch.
+ * Messages remains in queue will be all sent before queue is deleted.
+ * @param sw Switch of which queue is deleted.
+ * @return true if queue is successfully deleted.
+ */
+ boolean deleteQueue(IOFSwitch sw);
+
+ /**
+ * Delete a queue correspondent to the switch.
+ * By setting force flag on, queue will be deleted immediately.
+ * @param sw Switch of which queue is deleted.
+ * @param forceStop If this flag is set to true, queue will be deleted
+ * immediately regardless of any messages in the queue.
+ * If false, all messages will be sent to switch and queue will
+ * be deleted after that.
+ * @return true if queue is successfully deleted or flagged to be deleted.
+ */
+ boolean deleteQueue(IOFSwitch sw, boolean forceStop);
+
+ /**
+ * Add a message to the queue of the switch.
+ *
+ * Note: Notification is NOT delivered for the pushed message.
+ *
+ * @param sw Switch to which message is pushed.
+ * @param msg Message object to be added.
+ * @return true if message is successfully added to a queue.
+ */
+ boolean add(IOFSwitch sw, OFMessage msg);
+
+ /**
+ * Push a collection of Flow Entries to the corresponding switches.
+ *
+ * Note: Notification is delivered for the Flow Entries that
+ * are pushed successfully.
+ *
+ * @param entries the collection of <IOFSwitch, FlowEntry> pairs
+ * to push.
+ */
+ void pushFlowEntries(Collection<Pair<IOFSwitch, FlowEntry>> entries);
+
+ /**
+ * Create a message from FlowEntry and add it to the queue of the
+ * switch.
+ *
+ * Note: Notification is delivered for the Flow Entries that
+ * are pushed successfully.
+ *
+ * @param sw Switch to which message is pushed.
+ * @param flowEntry FlowEntry object used for creating message.
+ * @return true if message is successfully added to a queue.
+ */
+ void pushFlowEntry(IOFSwitch sw, FlowEntry flowEntry);
+
+ /**
+ * Set sending rate to a switch.
+ * @param sw Switch.
+ * @param rate Rate in bytes/ms.
+ */
+ public void setRate(IOFSwitch sw, long rate);
+
+ /**
+ * Add BARRIER message to queue and wait for reply.
+ * @param sw Switch to which barrier message is pushed.
+ * @return BARRIER_REPLY message sent from switch.
+ */
+ OFBarrierReply barrier(IOFSwitch sw);
+
+ /**
+ * Add BARRIER message to queue asynchronously.
+ * @param sw Switch to which barrier message is pushed.
+ * @return Future object of BARRIER_REPLY message which will be sent from switch.
+ */
+ OFMessageFuture<OFBarrierReply> barrierAsync(IOFSwitch sw);
+
+ /**
+ * Suspend pushing message to a switch.
+ * @param sw Switch to be suspended pushing message.
+ * @return true if success
+ */
+ boolean suspend(IOFSwitch sw);
+
+ /**
+ * Resume pushing message to a switch.
+ * @param sw Switch to be resumed pushing message.
+ * @return true if success
+ */
+ boolean resume(IOFSwitch sw);
+
+ /**
+ * Get whether pushing of message is suspended or not.
+ * @param sw Switch to be checked.
+ * @return true if suspended.
+ */
+ boolean isSuspended(IOFSwitch sw);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowSyncService.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowSyncService.java
new file mode 100644
index 0000000..4e6efaf
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/IFlowSyncService.java
@@ -0,0 +1,17 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.IOFSwitchListener;
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+/**
+ * FlowSyncService is a service to synchronize GraphDB and switch's flow table.
+ * FlowSyncService offers APIs to trigger and interrupt synchronization explicitly.
+ * @author Brian
+ *
+ */
+public interface IFlowSyncService extends IFloodlightService {
+ public void synchronize(IOFSwitch sw);
+
+ public void interrupt(IOFSwitch sw);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/OFBarrierReplyFuture.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/OFBarrierReplyFuture.java
new file mode 100644
index 0000000..3013f5a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/OFBarrierReplyFuture.java
@@ -0,0 +1,49 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import java.util.concurrent.TimeUnit;
+
+import org.openflow.protocol.OFBarrierReply;
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFType;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.internal.OFMessageFuture;
+import net.floodlightcontroller.threadpool.IThreadPoolService;
+
+public class OFBarrierReplyFuture extends OFMessageFuture<OFBarrierReply> {
+
+ protected volatile boolean finished;
+
+ public OFBarrierReplyFuture(IThreadPoolService tp,
+ IOFSwitch sw, int transactionId) {
+ super(tp, sw, OFType.FEATURES_REPLY, transactionId);
+ init();
+ }
+
+ public OFBarrierReplyFuture(IThreadPoolService tp,
+ IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
+ super(tp, sw, OFType.FEATURES_REPLY, transactionId, timeout, unit);
+ init();
+ }
+
+ private void init() {
+ this.finished = false;
+ this.result = null;
+ }
+
+ @Override
+ protected void handleReply(IOFSwitch sw, OFMessage msg) {
+ this.result = (OFBarrierReply) msg;
+ this.finished = true;
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return finished;
+ }
+
+ @Override
+ protected void unRegister() {
+ super.unRegister();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoInterruptResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoInterruptResource.java
new file mode 100644
index 0000000..3c2920d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoInterruptResource.java
@@ -0,0 +1,44 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+
+/**
+ * FlowProgrammer REST API implementation: Interrupt synchronization to a switch.
+ *
+ * GET /wm/fprog/synchronizer/interrupt/{dpid}/json"
+ */
+public class DoInterruptResource extends SynchronizerResource {
+
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public boolean retrieve() {
+ if (! init()) {
+ return false;
+ }
+
+ long dpid;
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return false;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return false;
+ }
+
+ synchronizer.interrupt(sw);
+
+ return true;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoSynchronizeResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoSynchronizeResource.java
new file mode 100644
index 0000000..dc8d431
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/DoSynchronizeResource.java
@@ -0,0 +1,44 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+
+/**
+ * FlowProgrammer REST API implementation: Begin synchronization to a switch.
+ *
+ * GET /wm/fprog/synchronizer/sync/{dpid}/json"
+ */
+public class DoSynchronizeResource extends SynchronizerResource {
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public boolean retrieve() {
+ if (! init()) {
+ return false;
+ }
+
+ long dpid;
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return false;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return false;
+ }
+
+ synchronizer.synchronize(sw);
+
+ return true;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/FlowProgrammerWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/FlowProgrammerWebRoutable.java
new file mode 100644
index 0000000..22450f7
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/FlowProgrammerWebRoutable.java
@@ -0,0 +1,28 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.routing.Router;
+
+import net.floodlightcontroller.restserver.RestletRoutable;
+
+public class FlowProgrammerWebRoutable implements RestletRoutable {
+
+ @Override
+ public Restlet getRestlet(Context context) {
+ Router router = new Router(context);
+ router.attach("/pusher/setrate/{dpid}/{rate}/json", SetPushRateResource.class);
+ router.attach("/pusher/suspend/{dpid}/json", SuspendPusherResource.class);
+ router.attach("/pusher/resume/{dpid}/json", ResumePusherResource.class);
+ router.attach("/pusher/barrier/{dpid}/json", SendBarrierResource.class);
+ router.attach("/synchronizer/sync/{dpid}/json", DoSynchronizeResource.class);
+ router.attach("/synchronizer/interrupt/{dpid}/json", DoInterruptResource.class);
+ return router;
+ }
+
+ @Override
+ public String basePath() {
+ return "/wm/fprog";
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/PusherResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/PusherResource.java
new file mode 100644
index 0000000..4e1c0fc
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/PusherResource.java
@@ -0,0 +1,33 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
+
+public class PusherResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(PusherResource.class);
+
+ protected IFloodlightProviderService provider;
+ protected IFlowPusherService pusher;
+
+ protected boolean init() {
+ provider = (IFloodlightProviderService)
+ getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
+ if (provider == null) {
+ log.debug("ONOS FloodlightProvider not found");
+ return false;
+ }
+
+ pusher = (IFlowPusherService)getContext().getAttributes().
+ get(IFlowPusherService.class.getCanonicalName());
+ if (pusher == null) {
+ log.debug("ONOS FlowPusherService not found");
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/ResumePusherResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/ResumePusherResource.java
new file mode 100644
index 0000000..dcbe3e9
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/ResumePusherResource.java
@@ -0,0 +1,41 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+
+/**
+ * FlowProgrammer REST API implementation: Resume sending message to switch.
+ *
+ * GET /wm/fprog/pusher/resume/{dpid}/json"
+ */
+public class ResumePusherResource extends PusherResource {
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public boolean retrieve() {
+ if (! init()) {
+ return false;
+ }
+
+ long dpid;
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return false;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return false;
+ }
+
+ return pusher.resume(sw);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SendBarrierResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SendBarrierResource.java
new file mode 100644
index 0000000..33b666a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SendBarrierResource.java
@@ -0,0 +1,41 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.protocol.OFBarrierReply;
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+
+/**
+ * FlowProgrammer REST API implementation: Send barrier message to switch.
+ *
+ * GET /wm/fprog/pusher/barrier/{dpid}/json"
+ */
+public class SendBarrierResource extends PusherResource {
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public OFBarrierReply retrieve() {
+ if (! init()) {
+ return null;
+ }
+ long dpid;
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return null;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return null;
+ }
+
+ return pusher.barrier(sw);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SetPushRateResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SetPushRateResource.java
new file mode 100644
index 0000000..9431d65
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SetPushRateResource.java
@@ -0,0 +1,47 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+
+/**
+ * FlowProgrammer REST API implementation: Set sending rate to the switch.
+ *
+ * GET /wm/fprog/pusher/setrate/{dpid}/{rate}/json"
+ */
+public class SetPushRateResource extends PusherResource {
+
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public boolean retrieve() {
+ if (! init()) {
+ return false;
+ }
+
+ long dpid;
+ long rate;
+
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ rate = Long.valueOf((String)getRequestAttributes().get("rate"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return false;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return false;
+ }
+
+ pusher.setRate(sw, rate);
+
+ return true;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SuspendPusherResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SuspendPusherResource.java
new file mode 100644
index 0000000..1a5266b
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SuspendPusherResource.java
@@ -0,0 +1,46 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * FlowProgrammer REST API implementation: Suspend sending message to switch.
+ *
+ * GET /wm/fprog/pusher/suspend/{dpid}/json"
+ */
+public class SuspendPusherResource extends PusherResource {
+
+ protected final static Logger log = LoggerFactory.getLogger(SetPushRateResource.class);
+
+ /**
+ * Implement the API.
+ *
+ * @return true if succeeded, false if failed.
+ */
+ @Get("json")
+ public boolean retrieve() {
+ if (! init()) {
+ return false;
+ }
+
+ long dpid;
+ try {
+ dpid = HexString.toLong((String)getRequestAttributes().get("dpid"));
+ } catch (NumberFormatException e) {
+ log.error("Invalid number format");
+ return false;
+ }
+
+ IOFSwitch sw = provider.getSwitches().get(dpid);
+ if (sw == null) {
+ log.error("Invalid dpid");
+ return false;
+ }
+
+ return pusher.suspend(sw);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SynchronizerResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SynchronizerResource.java
new file mode 100644
index 0000000..12bf8f3
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/web/SynchronizerResource.java
@@ -0,0 +1,35 @@
+package net.onrc.onos.ofcontroller.flowprogrammer.web;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.onrc.onos.ofcontroller.flowprogrammer.IFlowSyncService;
+
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SynchronizerResource extends ServerResource {
+ protected final static Logger log = LoggerFactory.getLogger(SynchronizerResource.class);
+
+ protected IFloodlightProviderService provider;
+ protected IFlowSyncService synchronizer;
+
+ protected boolean init() {
+ provider = (IFloodlightProviderService)
+ getContext().getAttributes().
+ get(IFloodlightProviderService.class.getCanonicalName());
+ if (provider == null) {
+ log.debug("ONOS FloodlightProvider not found");
+ return false;
+ }
+
+ synchronizer = (IFlowSyncService)
+ getContext().getAttributes().
+ get(IFlowSyncService.class.getCanonicalName());
+ if (synchronizer == null) {
+ log.debug("ONOS FlowSyncService not found");
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
new file mode 100644
index 0000000..b6dffd8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -0,0 +1,289 @@
+package net.onrc.onos.ofcontroller.forwarding;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.CallerId;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathType;
+import net.onrc.onos.ofcontroller.util.FlowPathUserState;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFPacketIn;
+import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.protocol.action.OFActionOutput;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Forwarding implements IOFMessageListener {
+ private final static Logger log = LoggerFactory.getLogger(Forwarding.class);
+
+ private IFloodlightProviderService floodlightProvider;
+ private IFlowService flowService;
+ private IDatagridService datagridService;
+
+ private IDeviceStorage deviceStorage;
+ private TopologyManager topologyService;
+
+ public Forwarding() {
+
+ }
+
+ public void init(IFloodlightProviderService floodlightProvider,
+ IFlowService flowService, IDatagridService datagridService) {
+ this.floodlightProvider = floodlightProvider;
+ this.flowService = flowService;
+ this.datagridService = datagridService;
+
+ floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
+
+ deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+ topologyService = new TopologyManager();
+ topologyService.init("");
+ }
+
+ public void startUp() {
+ // no-op
+ }
+
+ @Override
+ public String getName() {
+ return "onosforwarding";
+ }
+
+ @Override
+ public boolean isCallbackOrderingPrereq(OFType type, String name) {
+ return (type == OFType.PACKET_IN) &&
+ (name.equals("devicemanager") || name.equals("proxyarpmanager"));
+ }
+
+ @Override
+ public boolean isCallbackOrderingPostreq(OFType type, String name) {
+ return false;
+ }
+
+ @Override
+ public Command receive(
+ IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+
+ if (msg.getType() != OFType.PACKET_IN) {
+ return Command.CONTINUE;
+ }
+
+ OFPacketIn pi = (OFPacketIn) msg;
+
+ Ethernet eth = IFloodlightProviderService.bcStore.
+ get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+
+ // We only want to handle unicast IPv4
+ if (eth.isBroadcast() || eth.isMulticast() ||
+ eth.getEtherType() != Ethernet.TYPE_IPv4) {
+ return Command.CONTINUE;
+ }
+
+ handlePacketIn(sw, pi, eth);
+
+ return Command.STOP;
+ }
+
+ private void handlePacketIn(IOFSwitch sw, OFPacketIn pi, Ethernet eth) {
+ String destinationMac = HexString.toHexString(eth.getDestinationMACAddress());
+
+ IDeviceObject deviceObject = deviceStorage.getDeviceByMac(
+ destinationMac);
+
+ if (deviceObject == null) {
+ log.debug("No device entry found for {}", destinationMac);
+ return;
+ }
+
+ Iterator<IPortObject> ports = deviceObject.getAttachedPorts().iterator();
+ if (!ports.hasNext()) {
+ log.debug("No attachment point found for device {}", destinationMac);
+ return;
+ }
+ IPortObject portObject = ports.next();
+ short destinationPort = portObject.getNumber();
+ ISwitchObject switchObject = portObject.getSwitch();
+ long destinationDpid = HexString.toLong(switchObject.getDPID());
+
+ // TODO SwitchPort, Dpid and Port should probably be immutable
+ // (also, are Dpid and Port are even necessary?)
+ SwitchPort srcSwitchPort = new SwitchPort(
+ new Dpid(sw.getId()), new Port(pi.getInPort()));
+ SwitchPort dstSwitchPort = new SwitchPort(
+ new Dpid(destinationDpid), new Port(destinationPort));
+
+ MACAddress srcMacAddress = MACAddress.valueOf(eth.getSourceMACAddress());
+ MACAddress dstMacAddress = MACAddress.valueOf(eth.getDestinationMACAddress());
+
+ if (flowExists(srcSwitchPort, srcMacAddress,
+ dstSwitchPort, dstMacAddress)) {
+ log.debug("Not adding flow because it already exists");
+
+ // TODO check reverse flow as well
+
+ DataPath shortestPath =
+ topologyService.getDatabaseShortestPath(srcSwitchPort, dstSwitchPort);
+
+ if (shortestPath == null || shortestPath.flowEntries().isEmpty()) {
+ log.warn("No path found between {} and {} - not handling packet",
+ srcSwitchPort, dstSwitchPort);
+ return;
+ }
+
+ Port outPort = shortestPath.flowEntries().get(0).outPort();
+ forwardPacket(pi, sw, outPort.value());
+ return;
+ }
+
+ // Calculate a shortest path before pushing flow mods.
+ // This will be used later by the packet-out processing, but it uses
+ // the database so will be slow, and we should do it before flow mods.
+ DataPath shortestPath =
+ topologyService.getDatabaseShortestPath(srcSwitchPort, dstSwitchPort);
+
+ if (shortestPath == null || shortestPath.flowEntries().isEmpty()) {
+ log.warn("No path found between {} and {} - not handling packet",
+ srcSwitchPort, dstSwitchPort);
+ return;
+ }
+
+ log.debug("Adding new flow between {} at {} and {} at {}",
+ new Object[]{srcMacAddress, srcSwitchPort, dstMacAddress, dstSwitchPort});
+
+
+ DataPath dataPath = new DataPath();
+ dataPath.setSrcPort(srcSwitchPort);
+ dataPath.setDstPort(dstSwitchPort);
+
+ CallerId callerId = new CallerId("Forwarding");
+
+ //FlowId flowId = new FlowId(flowService.getNextFlowEntryId());
+ FlowPath flowPath = new FlowPath();
+ //flowPath.setFlowId(flowId);
+ flowPath.setInstallerId(callerId);
+
+ flowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
+ flowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
+ flowPath.setFlowEntryMatch(new FlowEntryMatch());
+ flowPath.flowEntryMatch().enableSrcMac(srcMacAddress);
+ flowPath.flowEntryMatch().enableDstMac(dstMacAddress);
+ // For now just forward IPv4 packets. This prevents accidentally
+ // forwarding other stuff like ARP.
+ flowPath.flowEntryMatch().enableEthernetFrameType(Ethernet.TYPE_IPv4);
+ flowPath.setDataPath(dataPath);
+
+ FlowId flowId = flowService.addFlow(flowPath);
+ //flowService.addFlow(flowPath, flowId);
+
+
+ DataPath reverseDataPath = new DataPath();
+ // Reverse the ports for the reverse path
+ reverseDataPath.setSrcPort(dstSwitchPort);
+ reverseDataPath.setDstPort(srcSwitchPort);
+
+ //FlowId reverseFlowId = new FlowId(flowService.getNextFlowEntryId());
+ // TODO implement copy constructor for FlowPath
+ FlowPath reverseFlowPath = new FlowPath();
+ //reverseFlowPath.setFlowId(reverseFlowId);
+ reverseFlowPath.setInstallerId(callerId);
+ reverseFlowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
+ reverseFlowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
+ reverseFlowPath.setFlowEntryMatch(new FlowEntryMatch());
+ // Reverse the MAC addresses for the reverse path
+ reverseFlowPath.flowEntryMatch().enableSrcMac(dstMacAddress);
+ reverseFlowPath.flowEntryMatch().enableDstMac(srcMacAddress);
+ reverseFlowPath.flowEntryMatch().enableEthernetFrameType(Ethernet.TYPE_IPv4);
+ reverseFlowPath.setDataPath(reverseDataPath);
+ reverseFlowPath.dataPath().srcPort().dpid().toString();
+
+ // TODO what happens if no path exists?
+ //flowService.addFlow(reverseFlowPath, reverseFlowId);
+ FlowId reverseFlowId = flowService.addFlow(reverseFlowPath);
+
+ Port outPort = shortestPath.flowEntries().get(0).outPort();
+ forwardPacket(pi, sw, outPort.value());
+ }
+
+ private boolean flowExists(SwitchPort srcPort, MACAddress srcMac,
+ SwitchPort dstPort, MACAddress dstMac) {
+ for (FlowPath flow : datagridService.getAllFlows()) {
+ FlowEntryMatch match = flow.flowEntryMatch();
+ // TODO implement FlowEntryMatch.equals();
+ // This is painful to do properly without support in the FlowEntryMatch
+ boolean same = true;
+ if (!match.srcMac().equals(srcMac) ||
+ !match.dstMac().equals(dstMac)) {
+ same = false;
+ }
+ if (!flow.dataPath().srcPort().equals(srcPort) ||
+ !flow.dataPath().dstPort().equals(dstPort)) {
+ same = false;
+ }
+
+ if (same) {
+ log.debug("found flow entry that's the same {}-{}:::{}-{}",
+ new Object[] {srcPort, srcMac, dstPort, dstMac});
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void forwardPacket(OFPacketIn pi, IOFSwitch sw, short port) {
+ List<OFAction> actions = new ArrayList<OFAction>(1);
+ actions.add(new OFActionOutput(port));
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setInPort(pi.getInPort())
+ .setActions(actions)
+ .setActionsLength((short)OFActionOutput.MINIMUM_LENGTH)
+ .setLengthU(OFPacketOut.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH);
+
+ if (sw.getBuffers() == 0) {
+ po.setBufferId(OFPacketOut.BUFFER_ID_NONE)
+ .setPacketData(pi.getPacketData())
+ .setLengthU(po.getLengthU() + po.getPacketData().length);
+ }
+ else {
+ po.setBufferId(pi.getBufferId());
+ }
+
+ try {
+ sw.write(po, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Error writing packet out to switch: {}", e);
+ }
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
similarity index 93%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
index 1efe015..cdb71be 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
@@ -1,4 +1,6 @@
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
+
+import net.floodlightcontroller.core.IUpdate;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.ser.std.ToStringSerializer;
@@ -8,6 +10,7 @@
@JsonSerialize(using=ToStringSerializer.class)
public enum UpdateOperation {
+ LINK_ADDED("Link Added"), // Operation Added by ONOS
LINK_UPDATED("Link Updated"),
LINK_REMOVED("Link Removed"),
SWITCH_UPDATED("Switch Updated"),
@@ -26,7 +29,7 @@
}
}
- public class LDUpdate {
+ public class LDUpdate implements IUpdate{
protected long src;
protected short srcPort;
protected long dst;
@@ -106,6 +109,7 @@
@Override
public String toString() {
switch (operation) {
+ case LINK_ADDED:
case LINK_REMOVED:
case LINK_UPDATED:
return "LDUpdate [operation=" + operation +
@@ -127,6 +131,12 @@
return "LDUpdate: Unknown update.";
}
}
+
+ @Override
+ public void dispatch() {
+ // TODO Auto-generated method stub
+
+ }
}
public enum SwitchType {
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
index 35779a2..9ca114f 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
public interface ILinkDiscoveryListener extends ILinkDiscovery{
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
index 4145592..99438ab 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
import java.util.Map;
import java.util.Set;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
index 9c0dd1a..825b0a2 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
@@ -13,9 +13,9 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
import org.openflow.protocol.OFPhysicalPort.OFPortState;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README
new file mode 100644
index 0000000..3cec58d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README
@@ -0,0 +1,8 @@
+Note about this directory
+=========================
+
+This directory contains link discovery manager and it's related module derived from Flood Light v0.9.0.
+Many of the code is unmodified from it's original state, but they had to be moved due to package visibility etc.
+
+Compare with floodlight's linkdiscovery directory to see what was modified from it's original code.
+
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
similarity index 95%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
index d57e987..696c63e 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
similarity index 96%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
index 98796ed..5d2e955 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
index 001942b..d6afd7a 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.IPv4Serializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
similarity index 93%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index b08fd8c..c03b266 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -15,9 +15,10 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import java.io.IOException;
+
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
@@ -33,7 +34,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -42,31 +42,20 @@
import net.floodlightcontroller.core.FloodlightContext;
import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.IFloodlightProviderService.Role;
-import net.floodlightcontroller.core.INetMapStorage.DM_OPERATION;
import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IInfoProvider;
import net.floodlightcontroller.core.IOFMessageListener;
import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.internal.OFSwitchImpl;
import net.floodlightcontroller.core.IOFSwitchListener;
import net.floodlightcontroller.core.annotations.LogMessageCategory;
import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs;
-//import net.floodlightcontroller.core.internal.SwitchStorageImpl;
+import net.floodlightcontroller.core.internal.OFSwitchImpl;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.SwitchType;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.UpdateOperation;
-import net.floodlightcontroller.linkdiscovery.web.LinkDiscoveryWebRoutable;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
import net.floodlightcontroller.packet.BSN;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPv4;
@@ -75,14 +64,25 @@
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.routing.Link;
import net.floodlightcontroller.storage.IResultSet;
-import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.storage.IStorageSourceListener;
+import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.storage.OperatorPredicate;
import net.floodlightcontroller.storage.StorageException;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.util.EventHistory;
import net.floodlightcontroller.util.EventHistory.EvAction;
+import net.onrc.onos.ofcontroller.core.IOnosRemoteSwitch;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.SwitchType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.UpdateOperation;
+import net.onrc.onos.ofcontroller.linkdiscovery.web.LinkDiscoveryWebRoutable;
+import net.onrc.onos.registry.controller.IControllerRegistryService;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -126,7 +126,8 @@
implements IOFMessageListener, IOFSwitchListener,
IStorageSourceListener, ILinkDiscoveryService,
IFloodlightModule, IInfoProvider, IHAListener {
- protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
+ protected IFloodlightProviderService controller;
+ protected final static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
// Names of table/fields for links in the storage API
private static final String LINK_TABLE_NAME = "controller_link";
@@ -146,6 +147,8 @@
protected IStorageSourceService storageSource;
protected IThreadPoolService threadPool;
protected IRestApiService restApi;
+ // Registry Service for ONOS
+ protected IControllerRegistryService registryService;
// LLDP and BDDP fields
@@ -155,8 +158,8 @@
private static final long LINK_LOCAL_VALUE = 0x0180c2000000L;
// BigSwitch OUI is 5C:16:C7, so 5D:16:C7 is the multicast version
- private static final String LLDP_BSN_DST_MAC_STRING = "5d:16:c7:00:00:01";
- //private static final String LLDP_BSN_DST_MAC_STRING = "ff:ff:ff:ff:ff:ff";
+ // private static final String LLDP_BSN_DST_MAC_STRING = "5d:16:c7:00:00:01";
+ private static final String LLDP_BSN_DST_MAC_STRING = "ff:ff:ff:ff:ff:ff";
// Direction TLVs are used to indicate if the LLDPs were sent
@@ -180,32 +183,18 @@
// Link discovery task details.
protected SingletonTask discoveryTask;
protected final int DISCOVERY_TASK_INTERVAL = 1;
- protected final int LINK_TIMEOUT = 5; // decreased timeout as part of LLDP process from 35 secs
- protected final int LLDP_TO_ALL_INTERVAL = 2 ; //decreased from 15 seconds.
+ protected final int LINK_TIMEOUT = 35; // original 35 secs, aggressive 5 secs
+ protected final int LLDP_TO_ALL_INTERVAL = 15 ; //original 15 seconds, aggressive 2 secs.
protected long lldpClock = 0;
// This value is intentionally kept higher than LLDP_TO_ALL_INTERVAL.
// If we want to identify link failures faster, we could decrease this
// value to a small number, say 1 or 2 sec.
- protected final int LLDP_TO_KNOWN_INTERVAL= 2; // LLDP frequency for known links from 20 secs
+ protected final int LLDP_TO_KNOWN_INTERVAL= 20; // LLDP frequency for known links
protected LLDPTLV controllerTLV;
protected ReentrantReadWriteLock lock;
int lldpTimeCount = 0;
- // Storage
-
- ThreadLocal<LinkStorageImpl> store = new ThreadLocal<LinkStorageImpl>() {
- @Override
- protected LinkStorageImpl initialValue() {
- LinkStorageImpl swStore = new LinkStorageImpl();
- //TODO: Get the file path from global properties
- swStore.init("/tmp/cassandra.titan");
- return swStore;
- }
- };
- protected LinkStorageImpl linkStore = store.get();
- // protected SwitchStorageImpl swStore;
-
/**
* Flag to indicate if automatic port fast is enabled or not.
* Default is set to false -- Initialized in the init method as well.
@@ -214,10 +203,10 @@
/**
* Map of remote switches that are not connected to this controller. This
- * is used to learn remote switches in a distributed controller.
+ * is used to learn remote switches in a distributed controller ONOS.
*/
- protected Map<Long, IOFSwitch> remoteSwitches;
-
+ protected Map<Long, IOnosRemoteSwitch> remoteSwitches;
+
/**
* Map from link to the most recent time it was verified functioning
*/
@@ -244,8 +233,40 @@
/* topology aware components are called in the order they were added to the
* the array */
protected ArrayList<ILinkDiscoveryListener> linkDiscoveryAware;
- protected BlockingQueue<LDUpdate> updates;
- protected Thread updatesThread;
+
+ protected class LinkUpdate extends LDUpdate {
+
+ public LinkUpdate(LDUpdate old) {
+ super(old);
+ }
+ @LogMessageDoc(level="ERROR",
+ message="Error in link discovery updates loop",
+ explanation="An unknown error occured while dispatching " +
+ "link update notifications",
+ recommendation=LogMessageDoc.GENERIC_ACTION)
+ @Override
+ public void dispatch() {
+ if (linkDiscoveryAware != null) {
+ if (log.isTraceEnabled()) {
+ log.trace("Dispatching link discovery update {} {} {} {} {} for {}",
+ new Object[]{this.getOperation(),
+ HexString.toHexString(this.getSrc()), this.getSrcPort(),
+ HexString.toHexString(this.getDst()), this.getDstPort(),
+ linkDiscoveryAware});
+ }
+ try {
+ for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order maintained
+ lda.linkDiscoveryUpdate(this);
+ }
+ }
+ catch (Exception e) {
+ log.error("Error in link discovery updates loop", e);
+ }
+ }
+
+ }
+
+ }
/**
* List of ports through which LLDP/BDDPs are not sent.
@@ -334,34 +355,7 @@
return ILinkDiscovery.LinkType.INVALID_LINK;
}
- @LogMessageDoc(level="ERROR",
- message="Error in link discovery updates loop",
- explanation="An unknown error occured while dispatching " +
- "link update notifications",
- recommendation=LogMessageDoc.GENERIC_ACTION)
- private void doUpdatesThread() throws InterruptedException {
- do {
- LDUpdate update = updates.take();
-
- if (linkDiscoveryAware != null) {
- if (log.isTraceEnabled()) {
- log.trace("Dispatching link discovery update {} {} {} {} {} for {}",
- new Object[]{update.getOperation(),
- HexString.toHexString(update.getSrc()), update.getSrcPort(),
- HexString.toHexString(update.getDst()), update.getDstPort(),
- linkDiscoveryAware});
- }
- try {
- for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order maintained
- lda.linkDiscoveryUpdate(update);
- }
- }
- catch (Exception e) {
- log.error("Error in link discovery updates loop", e);
- }
- }
- } while (updates.peek() != null);
- }
+
private boolean isLinkDiscoverySuppressed(long sw, short portNumber) {
return this.suppressLinkDiscovery.contains(new NodePortTuple(sw, portNumber));
}
@@ -502,7 +496,10 @@
if (portUp) operation = UpdateOperation.PORT_UP;
else operation = UpdateOperation.PORT_DOWN;
- updates.add(new LDUpdate(sw, port, operation));
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw, port, operation));
+
+
+ controller.publishUpdate(update);
}
/**
@@ -528,10 +525,10 @@
}
/**
- * Learn remote switches when running as a distributed controller
+ * Learn remote switches when running as a distributed controller ONOS
*/
protected IOFSwitch addRemoteSwitch(long sw, short port) {
- IOFSwitch remotesw = null;
+ IOnosRemoteSwitch remotesw = null;
// add a switch if we have not seen it before
remotesw = remoteSwitches.get(sw);
@@ -819,6 +816,7 @@
ByteBuffer dpidBB = ByteBuffer.wrap(lldptlv.getValue());
remoteSwitch = floodlightProvider.getSwitches().get(dpidBB.getLong(4));
if (remoteSwitch == null) {
+ // Added by ONOS
// floodlight LLDP coming from a remote switch connected to a different controller
// add it to our cache of unconnected remote switches
remoteSwitch = addRemoteSwitch(dpidBB.getLong(4), remotePort);
@@ -851,7 +849,7 @@
log.trace("Getting BDDP packets from a different controller" +
"and letting it go through normal processing chain.");
}
- //XXX Fix the BDDP broadcast issue
+ //XXX ONOS: Fix the BDDP broadcast issue
//return Command.CONTINUE;
return Command.STOP;
}
@@ -972,7 +970,6 @@
if (bsn.getPayload() instanceof LLDP == false)
return Command.CONTINUE;
return handleLldp((LLDP) bsn.getPayload(), sw, pi, false, cntx);
- //return Command.STOP;
} else if (eth.getEtherType() == Ethernet.TYPE_LLDP) {
return handleLldp((LLDP) eth.getPayload(), sw, pi, true, cntx);
} else if (eth.getEtherType() < 1500) {
@@ -1069,10 +1066,8 @@
writeLinkToStorage(lt, newInfo);
- // Write link to network map
- linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
-
- updateOperation = UpdateOperation.LINK_UPDATED;
+ // ONOS: Distinguish added event separately from updated event
+ updateOperation = UpdateOperation.LINK_ADDED;
linkChanged = true;
// Add to event history
@@ -1128,9 +1123,6 @@
// they weren't set to null in the previous block of code.
writeLinkToStorage(lt, newInfo);
- // Write link to network map
- linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
-
if (linkChanged) {
updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
newInfo.getDstPortState());
@@ -1151,10 +1143,11 @@
if (linkChanged) {
// find out if the link was added or removed here.
- updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
+ LinkUpdate update = new LinkUpdate(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
lt.getDst(), lt.getDstPort(),
getLinkType(lt, newInfo),
updateOperation));
+ controller.publishUpdate(update);
}
} finally {
lock.writeLock().unlock();
@@ -1201,10 +1194,11 @@
}
LinkInfo info = this.links.remove(lt);
- updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
+ LinkUpdate update = new LinkUpdate(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
lt.getDst(), lt.getDstPort(),
getLinkType(lt, info),
UpdateOperation.LINK_REMOVED));
+ controller.publishUpdate(update);
// Update Event History
evHistTopoLink(lt.getSrc(),
@@ -1218,9 +1212,6 @@
// remove link from storage.
removeLinkFromStorage(lt);
- // remote link from network map
- linkStore.update(lt, DM_OPERATION.DELETE);
-
// TODO Whenever link is removed, it has to checked if
// the switchports must be added to quarantine.
@@ -1245,6 +1236,9 @@
IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
if (iofSwitch == null) return Command.CONTINUE;
+ // ONOS: If we do not control this switch, then we should not process its port status messages
+ if (!registryService.hasControl(iofSwitch.getId())) return Command.CONTINUE;
+
if (log.isTraceEnabled()) {
log.trace("handlePortStatus: Switch {} port #{} reason {}; " +
"config is {} state is {}",
@@ -1268,9 +1262,8 @@
((byte)OFPortReason.OFPPR_MODIFY.ordinal() ==
ps.getReason() && !portEnabled(ps.getDesc()))) {
deleteLinksOnPort(npt, "Port Status Changed");
- //swStore.deletePort(HexString.toHexString(npt.getNodeId()), npt.getPortId());
- LDUpdate update = new LDUpdate(sw, port, UpdateOperation.PORT_DOWN);
- updates.add(update);
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw, port, UpdateOperation.PORT_DOWN));
+ controller.publishUpdate(update);
linkDeleted = true;
}
else if (ps.getReason() ==
@@ -1302,19 +1295,16 @@
(updatedDstPortState != null)) {
// The link is already known to link discovery
// manager and the status has changed, therefore
- // send an LDUpdate.
+ // send an LinkUpdate.
UpdateOperation operation =
getUpdateOperation(linkInfo.getSrcPortState(),
linkInfo.getDstPortState());
- updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
+ LinkUpdate update = new LinkUpdate(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
lt.getDst(), lt.getDstPort(),
getLinkType(lt, linkInfo),
operation));
+ controller.publishUpdate(update);
writeLinkToStorage(lt, linkInfo);
-
- // Write the changed link to the network map
- linkStore.update(lt, linkInfo, DM_OPERATION.UPDATE);
-
linkInfoChanged = true;
}
}
@@ -1322,7 +1312,8 @@
UpdateOperation operation =
getUpdateOperation(ps.getDesc().getState());
- updates.add(new LDUpdate(sw, port, operation));
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw, port, operation));
+ controller.publishUpdate(update);
}
if (!linkDeleted && !linkInfoChanged){
@@ -1394,14 +1385,13 @@
}
// Update event history
evHistTopoSwitch(sw, EvAction.SWITCH_CONNECTED, "None");
- LDUpdate update = new LDUpdate(sw.getId(), null,
- UpdateOperation.SWITCH_UPDATED);
- updates.add(update);
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw.getId(), null,
+ UpdateOperation.SWITCH_UPDATED));
+ controller.publishUpdate(update);
}
/**
* When a switch disconnects we remove any links from our map and notify.
- * @param The id of the switch
*/
@Override
public void removedSwitch(IOFSwitch iofSwitch) {
@@ -1421,8 +1411,8 @@
deleteLinks(eraseList, "Switch Removed");
// Send a switch removed update
- LDUpdate update = new LDUpdate(sw, null, UpdateOperation.SWITCH_REMOVED);
- updates.add(update);
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw, null, UpdateOperation.SWITCH_REMOVED));
+ controller.publishUpdate(update);
}
} finally {
lock.writeLock().unlock();
@@ -1508,10 +1498,11 @@
UpdateOperation operation;
operation = getUpdateOperation(info.getSrcPortState(),
info.getDstPortState());
- updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
+ LinkUpdate update = new LinkUpdate(new LDUpdate(lt.getSrc(), lt.getSrcPort(),
lt.getDst(), lt.getDstPort(),
getLinkType(lt, info),
operation));
+ controller.publishUpdate(update);
}
}
@@ -1798,16 +1789,18 @@
if (log.isTraceEnabled()) {
log.trace("SWITCH_IS_CORE_SWITCH set to False for {}", sw);
}
- updates.add(new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH,
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH,
UpdateOperation.SWITCH_UPDATED));
+ controller.publishUpdate(update);
}
else {
sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH, new Boolean(true));
if (log.isTraceEnabled()) {
log.trace("SWITCH_IS_CORE_SWITCH set to True for {}", sw);
}
- updates.add(new LDUpdate(sw.getId(), SwitchType.CORE_SWITCH,
+ LinkUpdate update = new LinkUpdate(new LDUpdate(sw.getId(), SwitchType.CORE_SWITCH,
UpdateOperation.SWITCH_UPDATED));
+ controller.publishUpdate(update);
}
}
}
@@ -1848,6 +1841,8 @@
l.add(IStorageSourceService.class);
l.add(IThreadPoolService.class);
l.add(IRestApiService.class);
+ // Added by ONOS
+ l.add(IControllerRegistryService.class);
return l;
}
@@ -1858,6 +1853,8 @@
storageSource = context.getServiceImpl(IStorageSourceService.class);
threadPool = context.getServiceImpl(IThreadPoolService.class);
restApi = context.getServiceImpl(IRestApiService.class);
+ // Added by ONOS
+ registryService = context.getServiceImpl(IControllerRegistryService.class);
// Set the autoportfast feature to false.
this.autoPortFastFeature = false;
@@ -1865,7 +1862,6 @@
// We create this here because there is no ordering guarantee
this.linkDiscoveryAware = new ArrayList<ILinkDiscoveryListener>();
this.lock = new ReentrantReadWriteLock();
- this.updates = new LinkedBlockingQueue<LDUpdate>();
this.links = new HashMap<Link, LinkInfo>();
this.portLinks = new HashMap<NodePortTuple, Set<Link>>();
this.suppressLinkDiscovery =
@@ -1874,7 +1870,8 @@
this.switchLinks = new HashMap<Long, Set<Link>>();
this.quarantineQueue = new LinkedBlockingQueue<NodePortTuple>();
this.maintenanceQueue = new LinkedBlockingQueue<NodePortTuple>();
- this.remoteSwitches = new HashMap<Long, IOFSwitch>();
+ // Added by ONOS
+ this.remoteSwitches = new HashMap<Long, IOnosRemoteSwitch>();
this.evHistTopologySwitch =
new EventHistory<EventHistoryTopologySwitch>("Topology: Switch");
@@ -1925,8 +1922,10 @@
log.error("Error in installing listener for " +
"switch table {}", SWITCH_CONFIG_TABLE_NAME);
}
-
+
ScheduledExecutorService ses = threadPool.getScheduledExecutor();
+ controller =
+ context.getServiceImpl(IFloodlightProviderService.class);
// To be started by the first switch connection
discoveryTask = new SingletonTask(ses, new Runnable() {
@@ -1970,20 +1969,6 @@
bddpTask = new SingletonTask(ses, new QuarantineWorker());
bddpTask.reschedule(BDDP_TASK_INTERVAL, TimeUnit.MILLISECONDS);
- updatesThread = new Thread(new Runnable () {
- @Override
- public void run() {
- while (true) {
- try {
- doUpdatesThread();
- } catch (InterruptedException e) {
- return;
- }
- }
- }}, "Topology Updates");
- updatesThread.start();
-
-
// Register for the OpenFlow messages we want to receive
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
similarity index 82%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
index 8f4f4ad..ce1be94 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
@@ -1,6 +1,6 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import org.restlet.data.Status;
import org.restlet.resource.Get;
@@ -9,7 +9,7 @@
import org.slf4j.LoggerFactory;
public class AutoPortFast extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(AutoPortFast.class);
+ protected final static Logger log = LoggerFactory.getLogger(AutoPortFast.class);
@Get("json")
public String retrieve() {
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
similarity index 92%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
index 3990fba..8eae558 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import net.floodlightcontroller.restserver.RestletRoutable;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
index 893e4ad..3e5a5e7 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import java.io.IOException;
@@ -9,8 +9,8 @@
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.openflow.util.HexString;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
/**
* This class is both the datastructure and the serializer
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
similarity index 75%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
index 4cad18e..3c97e6a 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
@@ -1,13 +1,14 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
@@ -23,8 +24,9 @@
if (ld != null) {
links.putAll(ld.getLinks());
- for (Link link: links.keySet()) {
- LinkInfo info = links.get(link);
+ for(Entry<Link, LinkInfo> e : links.entrySet()) {
+ Link link = e.getKey();
+ LinkInfo info = e.getValue();
LinkWithType lwt = new LinkWithType(link,
info.getSrcPortState(),
info.getDstPortState(),
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCache.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCache.java
new file mode 100644
index 0000000..83a3b55
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCache.java
@@ -0,0 +1,99 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implements a basic ARP cache which maps IPv4 addresses to MAC addresses.
+ * Mappings time out after a short period of time (currently 1 min). We don't
+ * try and refresh the mapping before the entry times out because as a controller
+ * we don't know if the mapping is still needed.
+ */
+
+/* TODO clean out old ARP entries out of the cache periodically. We currently
+ * don't do this which means the cache memory size will never decrease. We already
+ * have a periodic thread that can be used to do this in ProxyArpManager.
+ */
+class ArpCache {
+ private final static Logger log = LoggerFactory.getLogger(ArpCache.class);
+
+ private final static long ARP_ENTRY_TIMEOUT = 60000; //ms (1 min)
+
+ //Protected by locking on the ArpCache object
+ private final Map<InetAddress, ArpCacheEntry> arpCache;
+
+ private static class ArpCacheEntry {
+ private final MACAddress macAddress;
+ private long timeLastSeen;
+
+ public ArpCacheEntry(MACAddress macAddress) {
+ this.macAddress = macAddress;
+ this.timeLastSeen = System.currentTimeMillis();
+ }
+
+ public MACAddress getMacAddress() {
+ return macAddress;
+ }
+
+ public void setTimeLastSeen(long time){
+ timeLastSeen = time;
+ }
+
+ public boolean isExpired() {
+ return System.currentTimeMillis() - timeLastSeen > ARP_ENTRY_TIMEOUT;
+ }
+ }
+
+ ArpCache() {
+ arpCache = new HashMap<InetAddress, ArpCacheEntry>();
+ }
+
+ synchronized MACAddress lookup(InetAddress ipAddress){
+ ArpCacheEntry arpEntry = arpCache.get(ipAddress);
+
+ if (arpEntry == null){
+ return null;
+ }
+
+ if (arpEntry.isExpired()) {
+ //Entry has timed out so we'll remove it and return null
+ log.trace("Removing expired ARP entry for {}", ipAddress.getHostAddress());
+
+ arpCache.remove(ipAddress);
+ return null;
+ }
+
+ return arpEntry.getMacAddress();
+ }
+
+ synchronized void update(InetAddress ipAddress, MACAddress macAddress){
+ ArpCacheEntry arpEntry = arpCache.get(ipAddress);
+
+ if (arpEntry != null && arpEntry.getMacAddress().equals(macAddress)){
+ arpEntry.setTimeLastSeen(System.currentTimeMillis());
+ }
+ else {
+ arpCache.put(ipAddress, new ArpCacheEntry(macAddress));
+ }
+ }
+
+ synchronized List<String> getMappings() {
+ List<String> result = new ArrayList<String>(arpCache.size());
+
+ for (Map.Entry<InetAddress, ArpCacheEntry> entry : arpCache.entrySet()) {
+ result.add(entry.getKey().getHostAddress() + " => " +
+ entry.getValue().getMacAddress().toString() +
+ (entry.getValue().isExpired()?" : EXPIRED":" : VALID"));
+ }
+
+ return result;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCacheResource.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCacheResource.java
new file mode 100644
index 0000000..252e66e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpCacheResource.java
@@ -0,0 +1,18 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.util.List;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+
+public class ArpCacheResource extends ServerResource {
+
+ @Get("json")
+ public List<String> getArpCache() {
+ IProxyArpService arp = (IProxyArpService) getContext().getAttributes().
+ get(IProxyArpService.class.getCanonicalName());
+
+ return arp.getMappings();
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java
new file mode 100644
index 0000000..53891ef
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java
@@ -0,0 +1,60 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+public class ArpMessage implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final Type type;
+ private final InetAddress forAddress;
+ private final byte[] packetData;
+
+ private final List<SwitchPort> switchPorts = new ArrayList<SwitchPort>();
+
+ public enum Type {
+ REQUEST,
+ REPLY
+ }
+
+ private ArpMessage(Type type, InetAddress address, byte[] eth) {
+ // TODO Auto-generated constructor stub
+ this.type = type;
+ this.forAddress = address;
+ this.packetData = eth;
+ }
+
+ private ArpMessage(Type type, InetAddress address) {
+ this.type = type;
+ this.forAddress = address;
+ this.packetData = null;
+ }
+
+ public static ArpMessage newRequest(InetAddress forAddress, byte[] arpRequest) {
+ return new ArpMessage(Type.REQUEST, forAddress, arpRequest);
+ }
+
+ public static ArpMessage newReply(InetAddress forAddress) {
+ return new ArpMessage(Type.REPLY, forAddress);
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public InetAddress getAddress() {
+ return forAddress;
+ }
+
+ public byte[] getPacket() {
+ return packetData;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpWebRoutable.java
new file mode 100644
index 0000000..eefa2db
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpWebRoutable.java
@@ -0,0 +1,22 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import net.floodlightcontroller.restserver.RestletRoutable;
+
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.routing.Router;
+
+public class ArpWebRoutable implements RestletRoutable {
+
+ @Override
+ public Restlet getRestlet(Context context) {
+ Router router = new Router(context);
+ router.attach("/cache/json", ArpCacheResource.class);
+ return router;
+ }
+
+ @Override
+ public String basePath() {
+ return "/wm/arp";
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java
new file mode 100644
index 0000000..801e414
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java
@@ -0,0 +1,637 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.packet.ARP;
+import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.packet.IPv4;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.topology.ITopologyService;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.bgproute.Interface;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFPacketIn;
+import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.protocol.action.OFActionOutput;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
+public class BgpProxyArpManager implements IProxyArpService, IOFMessageListener {
+ private final static Logger log = LoggerFactory.getLogger(BgpProxyArpManager.class);
+
+ private final long ARP_TIMER_PERIOD = 60000; //ms (== 1 min)
+
+ private static final int ARP_REQUEST_TIMEOUT = 2000; //ms
+
+ private IFloodlightProviderService floodlightProvider;
+ private ITopologyService topology;
+ //private IDeviceService deviceService;
+ private IConfigInfoService configService;
+ private IRestApiService restApi;
+
+ private IDeviceStorage deviceStorage;
+
+ private short vlan;
+ private static final short NO_VLAN = 0;
+
+ private ArpCache arpCache;
+
+ private SetMultimap<InetAddress, ArpRequest> arpRequests;
+
+ private static class ArpRequest {
+ private final IArpRequester requester;
+ private final boolean retry;
+ private long requestTime;
+
+ public ArpRequest(IArpRequester requester, boolean retry){
+ this.requester = requester;
+ this.retry = retry;
+ this.requestTime = System.currentTimeMillis();
+ }
+
+ public ArpRequest(ArpRequest old) {
+ this.requester = old.requester;
+ this.retry = old.retry;
+ this.requestTime = System.currentTimeMillis();
+ }
+
+ public boolean isExpired() {
+ return (System.currentTimeMillis() - requestTime) > ARP_REQUEST_TIMEOUT;
+ }
+
+ public boolean shouldRetry() {
+ return retry;
+ }
+
+ public void dispatchReply(InetAddress ipAddress, MACAddress replyMacAddress) {
+ requester.arpResponse(ipAddress, replyMacAddress);
+ }
+ }
+
+ private class HostArpRequester implements IArpRequester {
+ private final ARP arpRequest;
+ private final long dpid;
+ private final short port;
+
+ public HostArpRequester(ARP arpRequest, long dpid, short port) {
+ this.arpRequest = arpRequest;
+ this.dpid = dpid;
+ this.port = port;
+ }
+
+ @Override
+ public void arpResponse(InetAddress ipAddress, MACAddress macAddress) {
+ BgpProxyArpManager.this.sendArpReply(arpRequest, dpid, port, macAddress);
+ }
+ }
+
+ /*
+ public ProxyArpManager(IFloodlightProviderService floodlightProvider,
+ ITopologyService topology, IConfigInfoService configService,
+ IRestApiService restApi){
+
+ }
+ */
+
+ public void init(IFloodlightProviderService floodlightProvider,
+ ITopologyService topology,
+ IConfigInfoService config, IRestApiService restApi){
+ this.floodlightProvider = floodlightProvider;
+ this.topology = topology;
+ //this.deviceService = deviceService;
+ this.configService = config;
+ this.restApi = restApi;
+
+ arpCache = new ArpCache();
+
+ arpRequests = Multimaps.synchronizedSetMultimap(
+ HashMultimap.<InetAddress, ArpRequest>create());
+ }
+
+ public void startUp() {
+ this.vlan = configService.getVlan();
+ log.info("vlan set to {}", this.vlan);
+
+ restApi.addRestletRoutable(new ArpWebRoutable());
+ floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
+
+ deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+
+ Timer arpTimer = new Timer("arp-processing");
+ arpTimer.scheduleAtFixedRate(new TimerTask() {
+ @Override
+ public void run() {
+ doPeriodicArpProcessing();
+ }
+ }, 0, ARP_TIMER_PERIOD);
+ }
+
+ /*
+ * Function that runs periodically to manage the asynchronous request mechanism.
+ * It basically cleans up old ARP requests if we don't get a response for them.
+ * The caller can designate that a request should be retried indefinitely, and
+ * this task will handle that as well.
+ */
+ private void doPeriodicArpProcessing() {
+ SetMultimap<InetAddress, ArpRequest> retryList
+ = HashMultimap.<InetAddress, ArpRequest>create();
+
+ //Have to synchronize externally on the Multimap while using an iterator,
+ //even though it's a synchronizedMultimap
+ synchronized (arpRequests) {
+ log.debug("Current have {} outstanding requests",
+ arpRequests.size());
+
+ Iterator<Map.Entry<InetAddress, ArpRequest>> it
+ = arpRequests.entries().iterator();
+
+ while (it.hasNext()) {
+ Map.Entry<InetAddress, ArpRequest> entry
+ = it.next();
+ ArpRequest request = entry.getValue();
+ if (request.isExpired()) {
+ log.debug("Cleaning expired ARP request for {}",
+ entry.getKey().getHostAddress());
+
+ it.remove();
+
+ if (request.shouldRetry()) {
+ retryList.put(entry.getKey(), request);
+ }
+ }
+ }
+ }
+
+ for (Map.Entry<InetAddress, Collection<ArpRequest>> entry
+ : retryList.asMap().entrySet()) {
+
+ InetAddress address = entry.getKey();
+
+ log.debug("Resending ARP request for {}", address.getHostAddress());
+
+ sendArpRequestForAddress(address);
+
+ for (ArpRequest request : entry.getValue()) {
+ arpRequests.put(address, new ArpRequest(request));
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "proxyarpmanager";
+ }
+
+ @Override
+ public boolean isCallbackOrderingPrereq(OFType type, String name) {
+ if (type == OFType.PACKET_IN) {
+ return "devicemanager".equals(name);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isCallbackOrderingPostreq(OFType type, String name) {
+ return false;
+ }
+
+ @Override
+ public Command receive(
+ IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+
+ if (msg.getType() != OFType.PACKET_IN){
+ return Command.CONTINUE;
+ }
+
+ OFPacketIn pi = (OFPacketIn) msg;
+
+ Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
+ IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+
+ if (eth.getEtherType() == Ethernet.TYPE_ARP){
+ ARP arp = (ARP) eth.getPayload();
+
+ if (arp.getOpCode() == ARP.OP_REQUEST) {
+ //TODO check what the DeviceManager does about propagating
+ //or swallowing ARPs. We want to go after DeviceManager in the
+ //chain but we really need it to CONTINUE ARP packets so we can
+ //get them.
+ handleArpRequest(sw, pi, arp);
+ }
+ else if (arp.getOpCode() == ARP.OP_REPLY) {
+ handleArpReply(sw, pi, arp);
+ }
+ }
+
+ //TODO should we propagate ARP or swallow it?
+ //Always propagate for now so DeviceManager can learn the host location
+ return Command.CONTINUE;
+ }
+
+ private void handleArpRequest(IOFSwitch sw, OFPacketIn pi, ARP arp) {
+ if (log.isTraceEnabled()) {
+ log.trace("ARP request received for {}",
+ inetAddressToString(arp.getTargetProtocolAddress()));
+ }
+
+ InetAddress target;
+ try {
+ target = InetAddress.getByAddress(arp.getTargetProtocolAddress());
+ } catch (UnknownHostException e) {
+ log.debug("Invalid address in ARP request", e);
+ return;
+ }
+
+ if (configService.fromExternalNetwork(sw.getId(), pi.getInPort())) {
+ //If the request came from outside our network, we only care if
+ //it was a request for one of our interfaces.
+ if (configService.isInterfaceAddress(target)) {
+ log.trace("ARP request for our interface. Sending reply {} => {}",
+ target.getHostAddress(), configService.getRouterMacAddress());
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(),
+ configService.getRouterMacAddress());
+ }
+
+ return;
+ }
+
+ MACAddress macAddress = arpCache.lookup(target);
+
+ //IDevice dstDevice = deviceService.fcStore.get(cntx, IDeviceService.CONTEXT_DST_DEVICE);
+ //Iterator<? extends IDevice> it = deviceService.queryDevices(
+ //null, null, InetAddresses.coerceToInteger(target), null, null);
+
+ //IDevice targetDevice = null;
+ //if (it.hasNext()) {
+ //targetDevice = it.next();
+ //}
+ /*IDeviceObject targetDevice =
+ deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(target));
+
+ if (targetDevice != null) {
+ //We have the device in our database, so send a reply
+ MACAddress macAddress = MACAddress.valueOf(targetDevice.getMACAddress());
+
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
+ inetAddressToString(arp.getTargetProtocolAddress()),
+ macAddress.toString(),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(), macAddress);
+ }*/
+
+ if (macAddress == null){
+ //MAC address is not in our ARP cache.
+
+ //Record where the request came from so we know where to send the reply
+ arpRequests.put(target, new ArpRequest(
+ new HostArpRequester(arp, sw.getId(), pi.getInPort()), false));
+
+ //Flood the request out edge ports
+ sendArpRequestToSwitches(target, pi.getPacketData(), sw.getId(), pi.getInPort());
+ }
+ else {
+ //We know the address, so send a reply
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
+ inetAddressToString(arp.getTargetProtocolAddress()),
+ macAddress.toString(),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(), macAddress);
+ }
+ }
+
+ private void handleArpReply(IOFSwitch sw, OFPacketIn pi, ARP arp){
+ if (log.isTraceEnabled()) {
+ log.trace("ARP reply recieved: {} => {}, on {}/{}", new Object[] {
+ inetAddressToString(arp.getSenderProtocolAddress()),
+ HexString.toHexString(arp.getSenderHardwareAddress()),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ InetAddress senderIpAddress;
+ try {
+ senderIpAddress = InetAddress.getByAddress(arp.getSenderProtocolAddress());
+ } catch (UnknownHostException e) {
+ log.debug("Invalid address in ARP reply", e);
+ return;
+ }
+
+ MACAddress senderMacAddress = MACAddress.valueOf(arp.getSenderHardwareAddress());
+
+ arpCache.update(senderIpAddress, senderMacAddress);
+
+ //See if anyone's waiting for this ARP reply
+ Set<ArpRequest> requests = arpRequests.get(senderIpAddress);
+
+ //Synchronize on the Multimap while using an iterator for one of the sets
+ List<ArpRequest> requestsToSend = new ArrayList<ArpRequest>(requests.size());
+ synchronized (arpRequests) {
+ Iterator<ArpRequest> it = requests.iterator();
+ while (it.hasNext()) {
+ ArpRequest request = it.next();
+ it.remove();
+ requestsToSend.add(request);
+ }
+ }
+
+ //Don't hold an ARP lock while dispatching requests
+ for (ArpRequest request : requestsToSend) {
+ request.dispatchReply(senderIpAddress, senderMacAddress);
+ }
+ }
+
+ private void sendArpRequestForAddress(InetAddress ipAddress) {
+ //TODO what should the sender IP address and MAC address be if no
+ //IP addresses are configured? Will there ever be a need to send
+ //ARP requests from the controller in that case?
+ //All-zero MAC address doesn't seem to work - hosts don't respond to it
+
+ byte[] zeroIpv4 = {0x0, 0x0, 0x0, 0x0};
+ byte[] zeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
+ byte[] genericNonZeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x01};
+ byte[] broadcastMac = {(byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0xff};
+
+ ARP arpRequest = new ARP();
+
+ arpRequest.setHardwareType(ARP.HW_TYPE_ETHERNET)
+ .setProtocolType(ARP.PROTO_TYPE_IP)
+ .setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
+ .setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
+ .setOpCode(ARP.OP_REQUEST)
+ .setTargetHardwareAddress(zeroMac)
+ .setTargetProtocolAddress(ipAddress.getAddress());
+
+ MACAddress routerMacAddress = configService.getRouterMacAddress();
+ //TODO hack for now as it's unclear what the MAC address should be
+ byte[] senderMacAddress = genericNonZeroMac;
+ if (routerMacAddress != null) {
+ senderMacAddress = routerMacAddress.toBytes();
+ }
+ arpRequest.setSenderHardwareAddress(senderMacAddress);
+
+ byte[] senderIPAddress = zeroIpv4;
+ Interface intf = configService.getOutgoingInterface(ipAddress);
+ if (intf != null) {
+ senderIPAddress = intf.getIpAddress().getAddress();
+ }
+
+ arpRequest.setSenderProtocolAddress(senderIPAddress);
+
+ Ethernet eth = new Ethernet();
+ eth.setSourceMACAddress(senderMacAddress)
+ .setDestinationMACAddress(broadcastMac)
+ .setEtherType(Ethernet.TYPE_ARP)
+ .setPayload(arpRequest);
+
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
+ sendArpRequestToSwitches(ipAddress, eth.serialize());
+ }
+
+ private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest) {
+ sendArpRequestToSwitches(dstAddress, arpRequest,
+ 0, OFPort.OFPP_NONE.getValue());
+ }
+
+ private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest,
+ long inSwitch, short inPort) {
+
+ if (configService.hasLayer3Configuration()) {
+ Interface intf = configService.getOutgoingInterface(dstAddress);
+ if (intf != null) {
+ sendArpRequestOutPort(arpRequest, intf.getDpid(), intf.getPort());
+ }
+ else {
+ //TODO here it should be broadcast out all non-interface edge ports.
+ //I think we can assume that if it's not a request for an external
+ //network, it's an ARP for a host in our own network. So we want to
+ //send it out all edge ports that don't have an interface configured
+ //to ensure it reaches all hosts in our network.
+ log.debug("No interface found to send ARP request for {}",
+ dstAddress.getHostAddress());
+ }
+ }
+ else {
+ broadcastArpRequestOutEdge(arpRequest, inSwitch, inPort);
+ }
+ }
+
+ private void broadcastArpRequestOutEdge(byte[] arpRequest, long inSwitch, short inPort) {
+ for (IOFSwitch sw : floodlightProvider.getSwitches().values()){
+ Collection<Short> enabledPorts = sw.getEnabledPortNumbers();
+ Set<Short> linkPorts = topology.getPortsWithLinks(sw.getId());
+
+ if (linkPorts == null){
+ //I think this means the switch doesn't have any links.
+ //continue;
+ linkPorts = new HashSet<Short>();
+ }
+
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(arpRequest);
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+
+ for (short portNum : enabledPorts){
+ if (linkPorts.contains(portNum) ||
+ (sw.getId() == inSwitch && portNum == inPort)){
+ //If this port isn't an edge port or is the ingress port
+ //for the ARP, don't broadcast out it
+ continue;
+ }
+
+ actions.add(new OFActionOutput(portNum));
+ }
+
+ po.setActions(actions);
+ short actionsLength = (short) (actions.size() * OFActionOutput.MINIMUM_LENGTH);
+ po.setActionsLength(actionsLength);
+ po.setLengthU(OFPacketOut.MINIMUM_LENGTH + actionsLength
+ + arpRequest.length);
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>();
+ msgList.add(po);
+
+ try {
+ sw.write(msgList, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+ }
+
+ private void sendArpRequestOutPort(byte[] arpRequest, long dpid, short port) {
+ if (log.isTraceEnabled()) {
+ log.trace("Sending ARP request out {}/{}",
+ HexString.toHexString(dpid), port);
+ }
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(arpRequest);
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(new OFActionOutput(port));
+ po.setActions(actions);
+ short actionsLength = (short) (actions.size() * OFActionOutput.MINIMUM_LENGTH);
+ po.setActionsLength(actionsLength);
+ po.setLengthU(OFPacketOut.MINIMUM_LENGTH + actionsLength
+ + arpRequest.length);
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+
+ if (sw == null) {
+ log.warn("Switch not found when sending ARP request");
+ return;
+ }
+
+ try {
+ sw.write(po, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+
+ private void sendArpReply(ARP arpRequest, long dpid, short port, MACAddress targetMac) {
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply {} => {} to {}", new Object[] {
+ inetAddressToString(arpRequest.getTargetProtocolAddress()),
+ targetMac,
+ inetAddressToString(arpRequest.getSenderProtocolAddress())});
+ }
+
+ ARP arpReply = new ARP();
+ arpReply.setHardwareType(ARP.HW_TYPE_ETHERNET)
+ .setProtocolType(ARP.PROTO_TYPE_IP)
+ .setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
+ .setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
+ .setOpCode(ARP.OP_REPLY)
+ .setSenderHardwareAddress(targetMac.toBytes())
+ .setSenderProtocolAddress(arpRequest.getTargetProtocolAddress())
+ .setTargetHardwareAddress(arpRequest.getSenderHardwareAddress())
+ .setTargetProtocolAddress(arpRequest.getSenderProtocolAddress());
+
+
+
+ Ethernet eth = new Ethernet();
+ eth.setDestinationMACAddress(arpRequest.getSenderHardwareAddress())
+ .setSourceMACAddress(targetMac.toBytes())
+ .setEtherType(Ethernet.TYPE_ARP)
+ .setPayload(arpReply);
+
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(new OFActionOutput(port));
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(eth.serialize())
+ .setActions(actions)
+ .setActionsLength((short)OFActionOutput.MINIMUM_LENGTH)
+ .setLengthU(OFPacketOut.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH
+ + po.getPacketData().length);
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>();
+ msgList.add(po);
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+
+ if (sw == null) {
+ log.warn("Switch {} not found when sending ARP reply",
+ HexString.toHexString(dpid));
+ return;
+ }
+
+ try {
+ sw.write(msgList, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+
+ private String inetAddressToString(byte[] bytes) {
+ try {
+ return InetAddress.getByAddress(bytes).getHostAddress();
+ } catch (UnknownHostException e) {
+ log.debug("Invalid IP address", e);
+ return "";
+ }
+ }
+
+ /*
+ * IProxyArpService methods
+ */
+
+ @Override
+ public MACAddress getMacAddress(InetAddress ipAddress) {
+ return arpCache.lookup(ipAddress);
+ }
+
+ @Override
+ public void sendArpRequest(InetAddress ipAddress, IArpRequester requester,
+ boolean retry) {
+ arpRequests.put(ipAddress, new ArpRequest(requester, retry));
+
+ //Sanity check to make sure we don't send a request for our own address
+ if (!configService.isInterfaceAddress(ipAddress)) {
+ sendArpRequestForAddress(ipAddress);
+ }
+ }
+
+ @Override
+ public List<String> getMappings() {
+ return arpCache.getMappings();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpEventHandler.java
new file mode 100644
index 0000000..4ec32ec
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpEventHandler.java
@@ -0,0 +1,11 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+public interface IArpEventHandler {
+
+ /**
+ * Notify the ARP event handler that an ARP request has been received.
+ * @param id The string ID of the ARP request
+ * @param arpRequest The ARP request packet
+ */
+ public void arpRequestNotification(ArpMessage arpMessage);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpRequester.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpRequester.java
new file mode 100644
index 0000000..66a17a2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IArpRequester.java
@@ -0,0 +1,21 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.net.InetAddress;
+
+import net.floodlightcontroller.util.MACAddress;
+
+/**
+ * Callback interface for modules using the {@link IProxyArpService} to
+ * send ARP requests.
+ *
+ */
+public interface IArpRequester {
+ /**
+ * Callback method that will be called by the {@link IProxyArpService}
+ * when it receives a reply for a request previously submitted by this
+ * {@code IArpRequester}.
+ * @param ipAddress The IP address than an ARP request was sent for
+ * @param macAddress The MAC address mapped to the requested IP address
+ */
+ public void arpResponse(InetAddress ipAddress, MACAddress macAddress);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IProxyArpService.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IProxyArpService.java
new file mode 100644
index 0000000..71546a1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/IProxyArpService.java
@@ -0,0 +1,34 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.net.InetAddress;
+import java.util.List;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.core.module.IOnosService;
+
+//Extends IFloodlightService so we can access it from REST API resources
+public interface IProxyArpService extends IOnosService{
+ /**
+ * Returns the MAC address if there is a valid entry in the cache.
+ * Otherwise returns null.
+ * @param ipAddress
+ * @return
+ */
+ public MACAddress getMacAddress(InetAddress ipAddress);
+
+ /**
+ * Tell the IProxyArpService to send an ARP request for the IP address.
+ * The request will be broadcast out all edge ports in the network.
+ * @param ipAddress
+ * @param requester
+ * @param retry Whether to keep sending requests until the MAC is learnt
+ */
+ public void sendArpRequest(InetAddress ipAddress, IArpRequester requester,
+ boolean retry);
+
+ /**
+ * Returns a snapshot of the entire ARP cache.
+ * @return
+ */
+ public List<String> getMappings();
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
new file mode 100644
index 0000000..3bf6c4e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -0,0 +1,772 @@
+package net.onrc.onos.ofcontroller.proxyarp;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.packet.ARP;
+import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.packet.IPv4;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.topology.ITopologyService;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.ofcontroller.bgproute.Interface;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoSwitchService;
+import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
+import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFPacketIn;
+import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.protocol.action.OFActionOutput;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+import com.google.common.net.InetAddresses;
+
+public class ProxyArpManager implements IProxyArpService, IOFMessageListener,
+ IArpEventHandler {
+ private final static Logger log = LoggerFactory.getLogger(ProxyArpManager.class);
+
+ private final long ARP_TIMER_PERIOD = 60000; //ms (== 1 min)
+
+ private static final int ARP_REQUEST_TIMEOUT = 2000; //ms
+
+ private IFloodlightProviderService floodlightProvider;
+ private ITopologyService topology;
+ private IDatagridService datagrid;
+ private IConfigInfoService configService;
+ private IRestApiService restApi;
+
+ private IDeviceStorage deviceStorage;
+ private volatile ITopoSwitchService topoSwitchService;
+ private ITopoLinkService topoLinkService;
+
+ private short vlan;
+ private static final short NO_VLAN = 0;
+
+ private ArpCache arpCache;
+
+ private SetMultimap<InetAddress, ArpRequest> arpRequests;
+
+ private static class ArpRequest {
+ private final IArpRequester requester;
+ private final boolean retry;
+ private long requestTime;
+
+ public ArpRequest(IArpRequester requester, boolean retry){
+ this.requester = requester;
+ this.retry = retry;
+ this.requestTime = System.currentTimeMillis();
+ }
+
+ public ArpRequest(ArpRequest old) {
+ this.requester = old.requester;
+ this.retry = old.retry;
+ this.requestTime = System.currentTimeMillis();
+ }
+
+ public boolean isExpired() {
+ return (System.currentTimeMillis() - requestTime) > ARP_REQUEST_TIMEOUT;
+ }
+
+ public boolean shouldRetry() {
+ return retry;
+ }
+
+ public void dispatchReply(InetAddress ipAddress, MACAddress replyMacAddress) {
+ requester.arpResponse(ipAddress, replyMacAddress);
+ }
+ }
+
+ private class HostArpRequester implements IArpRequester {
+ private final ARP arpRequest;
+ private final long dpid;
+ private final short port;
+
+ public HostArpRequester(ARP arpRequest, long dpid, short port) {
+ this.arpRequest = arpRequest;
+ this.dpid = dpid;
+ this.port = port;
+ }
+
+ @Override
+ public void arpResponse(InetAddress ipAddress, MACAddress macAddress) {
+ ProxyArpManager.this.sendArpReply(arpRequest, dpid, port, macAddress);
+ }
+ }
+
+ /*
+ public ProxyArpManager(IFloodlightProviderService floodlightProvider,
+ ITopologyService topology, IConfigInfoService configService,
+ IRestApiService restApi){
+
+ }
+ */
+
+ public void init(IFloodlightProviderService floodlightProvider,
+ ITopologyService topology, IDatagridService datagrid,
+ IConfigInfoService config, IRestApiService restApi){
+ this.floodlightProvider = floodlightProvider;
+ this.topology = topology;
+ this.datagrid = datagrid;
+ this.configService = config;
+ this.restApi = restApi;
+
+ arpCache = new ArpCache();
+
+ arpRequests = Multimaps.synchronizedSetMultimap(
+ HashMultimap.<InetAddress, ArpRequest>create());
+
+ topoSwitchService = new TopoSwitchServiceImpl();
+ topoLinkService = new TopoLinkServiceImpl();
+ }
+
+ public void startUp() {
+ this.vlan = configService.getVlan();
+ log.info("vlan set to {}", this.vlan);
+
+ restApi.addRestletRoutable(new ArpWebRoutable());
+ floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
+
+ datagrid.registerArpEventHandler(this);
+
+ deviceStorage = new DeviceStorageImpl();
+ deviceStorage.init("");
+
+ Timer arpTimer = new Timer("arp-processing");
+ arpTimer.scheduleAtFixedRate(new TimerTask() {
+ @Override
+ public void run() {
+ doPeriodicArpProcessing();
+ }
+ }, 0, ARP_TIMER_PERIOD);
+ }
+
+ /*
+ * Function that runs periodically to manage the asynchronous request mechanism.
+ * It basically cleans up old ARP requests if we don't get a response for them.
+ * The caller can designate that a request should be retried indefinitely, and
+ * this task will handle that as well.
+ */
+ private void doPeriodicArpProcessing() {
+ SetMultimap<InetAddress, ArpRequest> retryList
+ = HashMultimap.<InetAddress, ArpRequest>create();
+
+ //Have to synchronize externally on the Multimap while using an iterator,
+ //even though it's a synchronizedMultimap
+ synchronized (arpRequests) {
+ log.debug("Current have {} outstanding requests",
+ arpRequests.size());
+
+ Iterator<Map.Entry<InetAddress, ArpRequest>> it
+ = arpRequests.entries().iterator();
+
+ while (it.hasNext()) {
+ Map.Entry<InetAddress, ArpRequest> entry
+ = it.next();
+ ArpRequest request = entry.getValue();
+ if (request.isExpired()) {
+ log.debug("Cleaning expired ARP request for {}",
+ entry.getKey().getHostAddress());
+
+ it.remove();
+
+ if (request.shouldRetry()) {
+ retryList.put(entry.getKey(), request);
+ }
+ }
+ }
+ }
+
+ for (Map.Entry<InetAddress, Collection<ArpRequest>> entry
+ : retryList.asMap().entrySet()) {
+
+ InetAddress address = entry.getKey();
+
+ log.debug("Resending ARP request for {}", address.getHostAddress());
+
+ sendArpRequestForAddress(address);
+
+ for (ArpRequest request : entry.getValue()) {
+ arpRequests.put(address, new ArpRequest(request));
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "proxyarpmanager";
+ }
+
+ @Override
+ public boolean isCallbackOrderingPrereq(OFType type, String name) {
+ if (type == OFType.PACKET_IN) {
+ return "devicemanager".equals(name);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isCallbackOrderingPostreq(OFType type, String name) {
+ return false;
+ }
+
+ @Override
+ public Command receive(
+ IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+
+ OFPacketIn pi = (OFPacketIn) msg;
+
+ Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
+ IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+
+ if (eth.getEtherType() == Ethernet.TYPE_ARP){
+ ARP arp = (ARP) eth.getPayload();
+ if (arp.getOpCode() == ARP.OP_REQUEST) {
+ //TODO check what the DeviceManager does about propagating
+ //or swallowing ARPs. We want to go after DeviceManager in the
+ //chain but we really need it to CONTINUE ARP packets so we can
+ //get them.
+ handleArpRequest(sw, pi, arp, eth);
+ }
+ else if (arp.getOpCode() == ARP.OP_REPLY) {
+ //handleArpReply(sw, pi, arp);
+ }
+ }
+
+ //TODO should we propagate ARP or swallow it?
+ //Always propagate for now so DeviceManager can learn the host location
+ return Command.CONTINUE;
+ }
+
+ private void handleArpRequest(IOFSwitch sw, OFPacketIn pi, ARP arp, Ethernet eth) {
+ if (log.isTraceEnabled()) {
+ log.trace("ARP request received for {}",
+ inetAddressToString(arp.getTargetProtocolAddress()));
+ }
+
+ InetAddress target;
+ try {
+ target = InetAddress.getByAddress(arp.getTargetProtocolAddress());
+ } catch (UnknownHostException e) {
+ log.debug("Invalid address in ARP request", e);
+ return;
+ }
+
+ if (configService.fromExternalNetwork(sw.getId(), pi.getInPort())) {
+ //If the request came from outside our network, we only care if
+ //it was a request for one of our interfaces.
+ if (configService.isInterfaceAddress(target)) {
+ log.trace("ARP request for our interface. Sending reply {} => {}",
+ target.getHostAddress(), configService.getRouterMacAddress());
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(),
+ configService.getRouterMacAddress());
+ }
+
+ return;
+ }
+
+ //MACAddress macAddress = arpCache.lookup(target);
+
+ IDeviceObject targetDevice =
+ deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(target));
+
+ log.debug("targetDevice: {}", targetDevice);
+
+ if (targetDevice != null) {
+ // We have the device in our database, so send a reply
+ MACAddress macAddress = MACAddress.valueOf(targetDevice.getMACAddress());
+
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
+ inetAddressToString(arp.getTargetProtocolAddress()),
+ macAddress.toString(),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(), macAddress);
+ }
+ else {
+ // We don't know the device so broadcast the request out
+ // the edge of the network
+
+ //Record where the request came from so we know where to send the reply
+ arpRequests.put(target, new ArpRequest(
+ new HostArpRequester(arp, sw.getId(), pi.getInPort()), false));
+
+ sendToOtherNodes(eth, pi);
+ }
+
+ /*if (macAddress == null){
+ //MAC address is not in our ARP cache.
+
+ //Record where the request came from so we know where to send the reply
+ //arpRequests.put(target, new ArpRequest(
+ //new HostArpRequester(arp, sw.getId(), pi.getInPort()), false));
+
+ //Flood the request out edge ports
+ //sendArpRequestToSwitches(target, pi.getPacketData(), sw.getId(), pi.getInPort());
+ }
+ else {
+ //We know the address, so send a reply
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
+ inetAddressToString(arp.getTargetProtocolAddress()),
+ macAddress.toString(),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ sendArpReply(arp, sw.getId(), pi.getInPort(), macAddress);
+ }*/
+ }
+
+ private void handleArpReply(IOFSwitch sw, OFPacketIn pi, ARP arp){
+ if (log.isTraceEnabled()) {
+ log.trace("ARP reply recieved: {} => {}, on {}/{}", new Object[] {
+ inetAddressToString(arp.getSenderProtocolAddress()),
+ HexString.toHexString(arp.getSenderHardwareAddress()),
+ HexString.toHexString(sw.getId()), pi.getInPort()});
+ }
+
+ InetAddress senderIpAddress;
+ try {
+ senderIpAddress = InetAddress.getByAddress(arp.getSenderProtocolAddress());
+ } catch (UnknownHostException e) {
+ log.debug("Invalid address in ARP reply", e);
+ return;
+ }
+
+ MACAddress senderMacAddress = MACAddress.valueOf(arp.getSenderHardwareAddress());
+
+ arpCache.update(senderIpAddress, senderMacAddress);
+
+ //See if anyone's waiting for this ARP reply
+ Set<ArpRequest> requests = arpRequests.get(senderIpAddress);
+
+ //Synchronize on the Multimap while using an iterator for one of the sets
+ List<ArpRequest> requestsToSend = new ArrayList<ArpRequest>(requests.size());
+ synchronized (arpRequests) {
+ Iterator<ArpRequest> it = requests.iterator();
+ while (it.hasNext()) {
+ ArpRequest request = it.next();
+ it.remove();
+ requestsToSend.add(request);
+ }
+ }
+
+ //Don't hold an ARP lock while dispatching requests
+ for (ArpRequest request : requestsToSend) {
+ request.dispatchReply(senderIpAddress, senderMacAddress);
+ }
+ }
+
+ private void sendArpRequestForAddress(InetAddress ipAddress) {
+ //TODO what should the sender IP address and MAC address be if no
+ //IP addresses are configured? Will there ever be a need to send
+ //ARP requests from the controller in that case?
+ //All-zero MAC address doesn't seem to work - hosts don't respond to it
+
+ byte[] zeroIpv4 = {0x0, 0x0, 0x0, 0x0};
+ byte[] zeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
+ byte[] genericNonZeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x01};
+ byte[] broadcastMac = {(byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0xff};
+
+ ARP arpRequest = new ARP();
+
+ arpRequest.setHardwareType(ARP.HW_TYPE_ETHERNET)
+ .setProtocolType(ARP.PROTO_TYPE_IP)
+ .setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
+ .setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
+ .setOpCode(ARP.OP_REQUEST)
+ .setTargetHardwareAddress(zeroMac)
+ .setTargetProtocolAddress(ipAddress.getAddress());
+
+ MACAddress routerMacAddress = configService.getRouterMacAddress();
+ //TODO hack for now as it's unclear what the MAC address should be
+ byte[] senderMacAddress = genericNonZeroMac;
+ if (routerMacAddress != null) {
+ senderMacAddress = routerMacAddress.toBytes();
+ }
+ arpRequest.setSenderHardwareAddress(senderMacAddress);
+
+ byte[] senderIPAddress = zeroIpv4;
+ Interface intf = configService.getOutgoingInterface(ipAddress);
+ if (intf != null) {
+ senderIPAddress = intf.getIpAddress().getAddress();
+ }
+
+ arpRequest.setSenderProtocolAddress(senderIPAddress);
+
+ Ethernet eth = new Ethernet();
+ eth.setSourceMACAddress(senderMacAddress)
+ .setDestinationMACAddress(broadcastMac)
+ .setEtherType(Ethernet.TYPE_ARP)
+ .setPayload(arpRequest);
+
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
+ sendArpRequestToSwitches(ipAddress, eth.serialize());
+ }
+
+ private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest) {
+ sendArpRequestToSwitches(dstAddress, arpRequest,
+ 0, OFPort.OFPP_NONE.getValue());
+ }
+
+ private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest,
+ long inSwitch, short inPort) {
+
+ if (configService.hasLayer3Configuration()) {
+ Interface intf = configService.getOutgoingInterface(dstAddress);
+ if (intf != null) {
+ sendArpRequestOutPort(arpRequest, intf.getDpid(), intf.getPort());
+ }
+ else {
+ //TODO here it should be broadcast out all non-interface edge ports.
+ //I think we can assume that if it's not a request for an external
+ //network, it's an ARP for a host in our own network. So we want to
+ //send it out all edge ports that don't have an interface configured
+ //to ensure it reaches all hosts in our network.
+ log.debug("No interface found to send ARP request for {}",
+ dstAddress.getHostAddress());
+ }
+ }
+ else {
+ broadcastArpRequestOutEdge(arpRequest, inSwitch, inPort);
+ }
+ }
+
+ private void sendToOtherNodes(Ethernet eth, OFPacketIn pi) {
+ ARP arp = (ARP) eth.getPayload();
+
+ if (log.isTraceEnabled()) {
+ log.trace("Sending ARP request for {} to other ONOS instances",
+ inetAddressToString(arp.getTargetProtocolAddress()));
+ }
+
+ InetAddress targetAddress;
+ try {
+ targetAddress = InetAddress.getByAddress(arp.getTargetProtocolAddress());
+ } catch (UnknownHostException e) {
+ log.error("Unknown host", e);
+ return;
+ }
+
+ datagrid.sendArpRequest(ArpMessage.newRequest(targetAddress, eth.serialize()));
+ }
+
+ private void broadcastArpRequestOutEdge(byte[] arpRequest, long inSwitch, short inPort) {
+ for (IOFSwitch sw : floodlightProvider.getSwitches().values()){
+ Collection<Short> enabledPorts = sw.getEnabledPortNumbers();
+ Set<Short> linkPorts = topology.getPortsWithLinks(sw.getId());
+
+ if (linkPorts == null){
+ //I think this means the switch doesn't have any links.
+ //continue;
+ linkPorts = new HashSet<Short>();
+ }
+
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(arpRequest);
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+
+ for (short portNum : enabledPorts){
+ if (linkPorts.contains(portNum) ||
+ (sw.getId() == inSwitch && portNum == inPort)){
+ //If this port isn't an edge port or is the ingress port
+ //for the ARP, don't broadcast out it
+ continue;
+ }
+
+ actions.add(new OFActionOutput(portNum));
+ }
+
+ po.setActions(actions);
+ short actionsLength = (short) (actions.size() * OFActionOutput.MINIMUM_LENGTH);
+ po.setActionsLength(actionsLength);
+ po.setLengthU(OFPacketOut.MINIMUM_LENGTH + actionsLength
+ + arpRequest.length);
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>();
+ msgList.add(po);
+
+ try {
+ sw.write(msgList, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+ }
+
+ private void broadcastArpRequestOutMyEdge(byte[] arpRequest) {
+ List<SwitchPort> switchPorts = new ArrayList<SwitchPort>();
+
+ for (IOFSwitch sw : floodlightProvider.getSwitches().values()) {
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(arpRequest);
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+
+ Iterable<IPortObject> ports
+ = topoSwitchService.getPortsOnSwitch(sw.getStringId());
+ if (ports == null) {
+ continue;
+ }
+
+ for (IPortObject portObject : ports) {
+ if (!portObject.getLinkedPorts().iterator().hasNext()) {
+ switchPorts.add(new SwitchPort(new Dpid(sw.getId()),
+ new Port(portObject.getNumber())));
+ actions.add(new OFActionOutput(portObject.getNumber()));
+ }
+ }
+
+ po.setActions(actions);
+ short actionsLength = (short)
+ (actions.size() * OFActionOutput.MINIMUM_LENGTH);
+ po.setActionsLength(actionsLength);
+ po.setLengthU(OFPacketOut.MINIMUM_LENGTH + actionsLength
+ + arpRequest.length);
+
+ try {
+ sw.write(po, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+
+ log.debug("Broadcast ARP request for to: {}", switchPorts);
+ }
+
+ private void sendArpRequestOutPort(byte[] arpRequest, long dpid, short port) {
+ if (log.isTraceEnabled()) {
+ log.trace("Sending ARP request out {}/{}",
+ HexString.toHexString(dpid), port);
+ }
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(arpRequest);
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(new OFActionOutput(port));
+ po.setActions(actions);
+ short actionsLength = (short) (actions.size() * OFActionOutput.MINIMUM_LENGTH);
+ po.setActionsLength(actionsLength);
+ po.setLengthU(OFPacketOut.MINIMUM_LENGTH + actionsLength
+ + arpRequest.length);
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+
+ if (sw == null) {
+ log.warn("Switch not found when sending ARP request");
+ return;
+ }
+
+ try {
+ sw.write(po, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+
+ private void sendArpReply(ARP arpRequest, long dpid, short port, MACAddress targetMac) {
+ if (log.isTraceEnabled()) {
+ log.trace("Sending reply {} => {} to {}", new Object[] {
+ inetAddressToString(arpRequest.getTargetProtocolAddress()),
+ targetMac,
+ inetAddressToString(arpRequest.getSenderProtocolAddress())});
+ }
+
+ ARP arpReply = new ARP();
+ arpReply.setHardwareType(ARP.HW_TYPE_ETHERNET)
+ .setProtocolType(ARP.PROTO_TYPE_IP)
+ .setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
+ .setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
+ .setOpCode(ARP.OP_REPLY)
+ .setSenderHardwareAddress(targetMac.toBytes())
+ .setSenderProtocolAddress(arpRequest.getTargetProtocolAddress())
+ .setTargetHardwareAddress(arpRequest.getSenderHardwareAddress())
+ .setTargetProtocolAddress(arpRequest.getSenderProtocolAddress());
+
+
+
+ Ethernet eth = new Ethernet();
+ eth.setDestinationMACAddress(arpRequest.getSenderHardwareAddress())
+ .setSourceMACAddress(targetMac.toBytes())
+ .setEtherType(Ethernet.TYPE_ARP)
+ .setPayload(arpReply);
+
+ if (vlan != NO_VLAN) {
+ eth.setVlanID(vlan)
+ .setPriorityCode((byte)0);
+ }
+
+ List<OFAction> actions = new ArrayList<OFAction>();
+ actions.add(new OFActionOutput(port));
+
+ OFPacketOut po = new OFPacketOut();
+ po.setInPort(OFPort.OFPP_NONE)
+ .setBufferId(-1)
+ .setPacketData(eth.serialize())
+ .setActions(actions)
+ .setActionsLength((short)OFActionOutput.MINIMUM_LENGTH)
+ .setLengthU(OFPacketOut.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH
+ + po.getPacketData().length);
+
+ List<OFMessage> msgList = new ArrayList<OFMessage>();
+ msgList.add(po);
+
+ IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+
+ if (sw == null) {
+ log.warn("Switch {} not found when sending ARP reply",
+ HexString.toHexString(dpid));
+ return;
+ }
+
+ try {
+ sw.write(msgList, null);
+ sw.flush();
+ } catch (IOException e) {
+ log.error("Failure writing packet out to switch", e);
+ }
+ }
+
+ private String inetAddressToString(byte[] bytes) {
+ try {
+ return InetAddress.getByAddress(bytes).getHostAddress();
+ } catch (UnknownHostException e) {
+ log.debug("Invalid IP address", e);
+ return "";
+ }
+ }
+
+ /*
+ * IProxyArpService methods
+ */
+
+ @Override
+ public MACAddress getMacAddress(InetAddress ipAddress) {
+ return arpCache.lookup(ipAddress);
+ }
+
+ @Override
+ public void sendArpRequest(InetAddress ipAddress, IArpRequester requester,
+ boolean retry) {
+ arpRequests.put(ipAddress, new ArpRequest(requester, retry));
+
+ //Sanity check to make sure we don't send a request for our own address
+ if (!configService.isInterfaceAddress(ipAddress)) {
+ sendArpRequestForAddress(ipAddress);
+ }
+ }
+
+ @Override
+ public List<String> getMappings() {
+ return arpCache.getMappings();
+ }
+
+ /*
+ * IArpEventHandler methods
+ */
+
+ @Override
+ public void arpRequestNotification(ArpMessage arpMessage) {
+ //log.debug("Received ARP notification from other instances");
+
+ switch (arpMessage.getType()){
+ case REQUEST:
+ log.debug("Received ARP request notification for {}",
+ arpMessage.getAddress());
+ broadcastArpRequestOutMyEdge(arpMessage.getPacket());
+ break;
+ case REPLY:
+ log.debug("Received ARP reply notification for {}",
+ arpMessage.getAddress());
+ sendArpReplyToWaitingRequesters(arpMessage.getAddress());
+ break;
+ }
+ }
+
+ private void sendArpReplyToWaitingRequesters(InetAddress address) {
+ log.debug("Sending ARP reply for {} to requesters",
+ address.getHostAddress());
+
+ //See if anyone's waiting for this ARP reply
+ Set<ArpRequest> requests = arpRequests.get(address);
+
+ //Synchronize on the Multimap while using an iterator for one of the sets
+ List<ArpRequest> requestsToSend = new ArrayList<ArpRequest>(requests.size());
+ synchronized (arpRequests) {
+ Iterator<ArpRequest> it = requests.iterator();
+ while (it.hasNext()) {
+ ArpRequest request = it.next();
+ it.remove();
+ requestsToSend.add(request);
+ }
+ }
+
+ IDeviceObject deviceObject = deviceStorage.getDeviceByIP(
+ InetAddresses.coerceToInteger(address));
+
+ MACAddress mac = MACAddress.valueOf(deviceObject.getMACAddress());
+
+ log.debug("Found {} at {} in network map",
+ address.getHostAddress(), mac);
+
+ //Don't hold an ARP lock while dispatching requests
+ for (ArpRequest request : requestsToSend) {
+ request.dispatchReply(address, mac);
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java b/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java
new file mode 100644
index 0000000..9585366
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java
@@ -0,0 +1,89 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.Map;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+/**
+ * Interface for providing Topology Network Service to other modules.
+ */
+public interface ITopologyNetService extends IFloodlightService {
+ /**
+ * Fetch the Switch and Ports info from the Titan Graph
+ * and return it for fast access during the shortest path
+ * computation.
+ *
+ * After fetching the state, method @ref getTopologyShortestPath()
+ * can be used for fast shortest path computation.
+ *
+ * Note: There is certain cost to fetch the state, hence it should
+ * be used only when there is a large number of shortest path
+ * computations that need to be done on the same topology.
+ * Typically, a single call to @ref newDatabaseTopology()
+ * should be followed by a large number of calls to
+ * method @ref getTopologyShortestPath().
+ * After the last @ref getTopologyShortestPath() call,
+ * method @ref dropTopology() should be used to release
+ * the internal state that is not needed anymore:
+ *
+ * Topology topology = topologyManager.newDatabaseTopology();
+ * for (int i = 0; i < 10000; i++) {
+ * dataPath = topologyManager.getTopologyShortestPath(topology, ...);
+ * ...
+ * }
+ * topologyManager.dropTopology(shortestPathTopo);
+ *
+ * @return the allocated topology handler.
+ */
+ Topology newDatabaseTopology();
+
+ /**
+ * Release the topology that was populated by
+ * method @ref newDatabaseTopology().
+ *
+ * See the documentation for method @ref newDatabaseTopology()
+ * for additional information and usage.
+ *
+ * @param topology the topology to release.
+ */
+ void dropTopology(Topology topology);
+
+ /**
+ * Get the shortest path from a source to a destination by
+ * using the pre-populated local topology state prepared
+ * by method @ref newDatabaseTopology().
+ *
+ * See the documentation for method @ref newDatabaseTopology()
+ * for additional information and usage.
+ *
+ * @param topology the topology handler to use.
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ DataPath getTopologyShortestPath(Topology topology,
+ SwitchPort src, SwitchPort dest);
+
+ /**
+ * Get the shortest path from a source to a destination by using
+ * the underlying database.
+ *
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ DataPath getDatabaseShortestPath(SwitchPort src, SwitchPort dest);
+
+ /**
+ * Test whether a route exists from a source to a destination.
+ *
+ * @param src the source node for the test.
+ * @param dest the destination node for the test.
+ * @return true if a route exists, otherwise false.
+ */
+ Boolean routeExists(SwitchPort src, SwitchPort dest);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
new file mode 100644
index 0000000..f187c27
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
@@ -0,0 +1,326 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.openflow.util.HexString;
+
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.blueprints.Vertex;
+
+/**
+ * Class to calculate a shortest DataPath between 2 SwitchPorts
+ * based on hops in Network Topology.
+ */
+public class ShortestPath {
+ /**
+ * Get the shortest path from a source to a destination by
+ * using the pre-populated local topology state prepared
+ * by method @ref TopologyManager.newDatabaseTopology().
+ *
+ * For additional documentation and usage, see method
+ * @ref TopologyManager.newDatabaseTopology()
+ *
+ * @param topology the topology handler to use.
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ public static DataPath getTopologyShortestPath(
+ Topology topology,
+ SwitchPort src, SwitchPort dest) {
+ DataPath result_data_path = new DataPath();
+
+ // Initialize the source and destination in the data path to return
+ result_data_path.setSrcPort(src);
+ result_data_path.setDstPort(dest);
+
+ String dpid_src = src.dpid().toString();
+ String dpid_dest = dest.dpid().toString();
+
+ // Get the source vertex
+ Node v_src = topology.getNode(src.dpid().value());
+ if (v_src == null) {
+ return null; // Source vertex not found
+ }
+
+ // Get the destination vertex
+ Node v_dest = topology.getNode(dest.dpid().value());
+ if (v_dest == null) {
+ return null; // Destination vertex not found
+ }
+
+ //
+ // Test whether we are computing a path from/to the same DPID.
+ // If "yes", then just add a single flow entry in the return result.
+ //
+ if (dpid_src.equals(dpid_dest)) {
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(src.dpid());
+ flowEntry.setInPort(src.port());
+ flowEntry.setOutPort(dest.port());
+ result_data_path.flowEntries().add(flowEntry);
+ return result_data_path;
+ }
+
+ //
+ // Implement the Shortest Path computation by using Breath First Search
+ //
+ Set<Node> visitedSet = new HashSet<Node>();
+ Queue<Node> processingList = new LinkedList<Node>();
+ Map<Node, Node.Link> previousVertexMap = new HashMap<Node, Node.Link>();
+ processingList.add(v_src);
+ visitedSet.add(v_src);
+ Boolean path_found = false;
+ while (! processingList.isEmpty()) {
+ Node nextVertex = processingList.poll();
+ if (v_dest == nextVertex) {
+ path_found = true;
+ break;
+ }
+ for (Node.Link link : nextVertex.links.values()) {
+ Node child = link.neighbor;
+ if (! visitedSet.contains(child)) {
+ previousVertexMap.put(child, link);
+ visitedSet.add(child);
+ processingList.add(child);
+ }
+ }
+ }
+ if (! path_found)
+ return null; // No path found
+
+ // Collect the path as a list of links
+ List<Node.Link> resultPath = new LinkedList<Node.Link>();
+ Node previousVertex = v_dest;
+ while (! v_src.equals(previousVertex)) {
+ Node.Link currentLink = previousVertexMap.get(previousVertex);
+ resultPath.add(currentLink);
+ previousVertex = currentLink.me;
+ }
+ Collections.reverse(resultPath);
+
+ //
+ // Loop through the result and prepare the return result
+ // as a list of Flow Entries.
+ //
+ Port inPort = new Port(src.port().value());
+ Port outPort;
+ for (Node.Link link: resultPath) {
+ // Setup the outgoing port, and add the Flow Entry
+ outPort = new Port((short)link.myPort);
+
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(new Dpid(link.me.nodeId));
+ flowEntry.setInPort(inPort);
+ flowEntry.setOutPort(outPort);
+ result_data_path.flowEntries().add(flowEntry);
+
+ // Setup the next incoming port
+ inPort = new Port((short)link.neighborPort);
+ }
+ if (resultPath.size() > 0) {
+ // Add the last Flow Entry
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(new Dpid(dest.dpid().value()));
+ flowEntry.setInPort(inPort);
+ flowEntry.setOutPort(dest.port());
+ result_data_path.flowEntries().add(flowEntry);
+ }
+
+ if (result_data_path.flowEntries().size() > 0)
+ return result_data_path;
+
+ return null;
+ }
+
+ /**
+ * Get the shortest path from a source to a destination by using
+ * the underlying Graph Database.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ public static DataPath getDatabaseShortestPath(GraphDBOperation dbHandler,
+ SwitchPort src, SwitchPort dest) {
+ DataPath result_data_path = new DataPath();
+
+ // Initialize the source and destination in the data path to return
+ result_data_path.setSrcPort(src);
+ result_data_path.setDstPort(dest);
+
+ String dpid_src = src.dpid().toString();
+ String dpid_dest = dest.dpid().toString();
+
+ // Get the source and destination switches
+ ISwitchObject srcSwitch =
+ dbHandler.searchActiveSwitch(dpid_src);
+ ISwitchObject destSwitch =
+ dbHandler.searchActiveSwitch(dpid_dest);
+ if (srcSwitch == null || destSwitch == null) {
+ return null;
+ }
+
+ //
+ // Test whether we are computing a path from/to the same DPID.
+ // If "yes", then just add a single flow entry in the return result.
+ //
+ if (dpid_src.equals(dpid_dest)) {
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(src.dpid());
+ flowEntry.setInPort(src.port());
+ flowEntry.setOutPort(dest.port());
+ result_data_path.flowEntries().add(flowEntry);
+ dbHandler.commit();
+ return result_data_path;
+ }
+
+ Vertex v_src = srcSwitch.asVertex();
+ Vertex v_dest = destSwitch.asVertex();
+
+ //
+ // Implement the Shortest Path computation by using Breath First Search
+ //
+ Set<Vertex> visitedSet = new HashSet<Vertex>();
+ Queue<Vertex> processingList = new LinkedList<Vertex>();
+ Map<Vertex, Vertex> previousVertexMap = new HashMap<Vertex, Vertex>();
+
+ processingList.add(v_src);
+ visitedSet.add(v_src);
+ Boolean path_found = false;
+ while (! processingList.isEmpty()) {
+ Vertex nextVertex = processingList.poll();
+ if (v_dest.equals(nextVertex)) {
+ path_found = true;
+ break;
+ }
+ for (Vertex parentPort : nextVertex.getVertices(Direction.OUT, "on")) {
+ // Ignore inactive ports
+ if (! parentPort.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
+ for (Vertex childPort : parentPort.getVertices(Direction.OUT, "link")) {
+ // Ignore inactive ports
+ if (! childPort.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
+ for (Vertex child : childPort.getVertices(Direction.IN, "on")) {
+ // Ignore inactive switches
+ String state = child.getProperty("state").toString();
+ if (! state.equals(SwitchState.ACTIVE.toString()))
+ continue;
+
+ if (! visitedSet.contains(child)) {
+ previousVertexMap.put(parentPort, nextVertex);
+ previousVertexMap.put(childPort, parentPort);
+ previousVertexMap.put(child, childPort);
+ visitedSet.add(child);
+ processingList.add(child);
+ }
+ }
+ }
+ }
+ }
+ if (! path_found)
+ return null; // No path found
+
+ List<Vertex> resultPath = new LinkedList<Vertex>();
+ Vertex previousVertex = v_dest;
+ resultPath.add(v_dest);
+ while (! v_src.equals(previousVertex)) {
+ Vertex currentVertex = previousVertexMap.get(previousVertex);
+ resultPath.add(currentVertex);
+ previousVertex = currentVertex;
+ }
+ Collections.reverse(resultPath);
+
+
+ //
+ // Loop through the result and prepare the return result
+ // as a list of Flow Entries.
+ //
+ long nodeId = 0;
+ short portId = 0;
+ Port inPort = new Port(src.port().value());
+ Port outPort = new Port();
+ int idx = 0;
+ for (Vertex v: resultPath) {
+ String type = v.getProperty("type").toString();
+ // System.out.println("type: " + type);
+ if (type.equals("port")) {
+ //String number = v.getProperty("number").toString();
+ // System.out.println("number: " + number);
+
+ Object obj = v.getProperty("number");
+ // String class_str = obj.getClass().toString();
+ if (obj instanceof Short) {
+ portId = (Short)obj;
+ } else if (obj instanceof Integer) {
+ Integer int_nodeId = (Integer)obj;
+ portId = int_nodeId.shortValue();
+ // int int_nodeId = (Integer)obj;
+ // portId = (short)int_nodeId.;
+ }
+ } else if (type.equals("switch")) {
+ String dpid = v.getProperty("dpid").toString();
+ nodeId = HexString.toLong(dpid);
+
+ // System.out.println("dpid: " + dpid);
+ }
+ idx++;
+ if (idx == 1) {
+ continue;
+ }
+ int mod = idx % 3;
+ if (mod == 0) {
+ // Setup the incoming port
+ inPort = new Port(portId);
+ continue;
+ }
+ if (mod == 2) {
+ // Setup the outgoing port, and add the Flow Entry
+ outPort = new Port(portId);
+
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(new Dpid(nodeId));
+ flowEntry.setInPort(inPort);
+ flowEntry.setOutPort(outPort);
+ result_data_path.flowEntries().add(flowEntry);
+ continue;
+ }
+ }
+ if (idx > 0) {
+ // Add the last Flow Entry
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setDpid(new Dpid(nodeId));
+ flowEntry.setInPort(inPort);
+ flowEntry.setOutPort(dest.port());
+ result_data_path.flowEntries().add(flowEntry);
+ }
+
+ dbHandler.commit();
+ if (result_data_path.flowEntries().size() > 0)
+ return result_data_path;
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java b/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java
new file mode 100644
index 0000000..dbf9ada
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java
@@ -0,0 +1,448 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.TreeMap;
+
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+
+import org.openflow.util.HexString;
+
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.blueprints.Vertex;
+
+/**
+ * A class for storing Node and Link information for fast computation
+ * of shortest paths.
+ */
+class Node {
+ /**
+ * A class for storing Link information for fast computation of shortest
+ * paths.
+ */
+ class Link {
+ public Node me; // The node this link originates from
+ public Node neighbor; // The neighbor node on the other side
+ public int myPort; // Local port ID for the link
+ public int neighborPort; // Neighbor port ID for the link
+
+ /**
+ * Link constructor.
+ *
+ * @param me the node this link originates from.
+ * @param the neighbor node on the other side of the link.
+ * @param myPort local port ID for the link.
+ * @param neighborPort neighbor port ID for the link.
+ */
+ public Link(Node me, Node neighbor, int myPort, int neighborPort) {
+ this.me = me;
+ this.neighbor = neighbor;
+ this.myPort = myPort;
+ this.neighborPort = neighborPort;
+ }
+ };
+
+ public long nodeId; // The node ID
+ public TreeMap<Integer, Link> links; // The links from this node:
+ // (src PortID -> Link)
+ private TreeMap<Integer, Link> reverseLinksMap; // The links to this node:
+ // (dst PortID -> Link)
+ private TreeMap<Integer, Integer> portsMap; // The ports on this node:
+ // (PortID -> PortID)
+ // TODO: In the future will be:
+ // (PortID -> Port)
+
+ /**
+ * Node constructor.
+ *
+ * @param nodeId the node ID.
+ */
+ public Node(long nodeId) {
+ this.nodeId = nodeId;
+ links = new TreeMap<Integer, Link>();
+ reverseLinksMap = new TreeMap<Integer, Link>();
+ portsMap = new TreeMap<Integer, Integer>();
+ }
+
+ /**
+ * Get all ports.
+ *
+ * @return all ports.
+ */
+ public Map<Integer, Integer> ports() {
+ return portsMap;
+ }
+
+ /**
+ * Get the port for a given Port ID.
+ *
+ * Note: For now the port itself is just the Port ID. In the future
+ * it might contain more information.
+ *
+ * @return the port if found, otherwise null.
+ */
+ public Integer getPort(int portId) {
+ return portsMap.get(portId);
+ }
+
+ /**
+ * Add a port for a given Port ID.
+ *
+ * Note: For now the port itself is just the Port ID. In the future
+ * it might contain more information.
+ *
+ * @param portId the Port ID of the port to add.
+ * @return the added Port.
+ */
+ Integer addPort(int portId) {
+ Integer port = new Integer(portId);
+ portsMap.put(portId, port);
+ return port;
+ }
+
+ /**
+ * Remove a port for a given Port ID.
+ *
+ * NOTE: The outgoing and incoming links using this port are removed as
+ * well.
+ */
+ void removePort(int portId) {
+ // Remove the outgoing link
+ Link link = getLink(portId);
+ if (link != null) {
+ link.neighbor.removeReverseLink(link);
+ removeLink(portId);
+ }
+
+ // Remove the incoming link
+ Link reverseLink = reverseLinksMap.get(portId);
+ if (reverseLink != null) {
+ // NOTE: reverseLink.myPort is the neighbor's outgoing port
+ reverseLink.me.removeLink(reverseLink.myPort);
+ removeReverseLink(reverseLink);
+ }
+
+ portsMap.remove(portId);
+ }
+
+ /**
+ * Get a link on a port to a neighbor.
+ *
+ * @param myPortId the local port ID for the link to the neighbor.
+ * @return the link if found, otherwise null.
+ */
+ public Link getLink(int myPortId) {
+ return links.get(myPortId);
+ }
+
+ /**
+ * Add a link to a neighbor.
+ *
+ * @param myPortId the local port ID for the link to the neighbor.
+ * @param neighbor the neighbor for the link.
+ * @param neighborPortId the neighbor port ID for the link.
+ * @return the added Link.
+ */
+ public Link addLink(int myPortId, Node neighbor, int neighborPortId) {
+ Link link = new Link(this, neighbor, myPortId, neighborPortId);
+ links.put(myPortId, link);
+ neighbor.addReverseLink(link);
+ return link;
+ }
+
+ /**
+ * Add a reverse link from a neighbor.
+ *
+ * @param link the reverse link from a neighbor to add.
+ */
+ private void addReverseLink(Link link) {
+ // NOTE: link.neghborPort is my port
+ reverseLinksMap.put(link.neighborPort, link);
+ }
+
+ /**
+ * Remove a link to a neighbor.
+ *
+ * @param myPortId the local port ID for the link to the neighbor.
+ */
+ public void removeLink(int myPortId) {
+ links.remove(myPortId);
+ }
+
+ /**
+ * Remove a reverse link from a neighbor.
+ *
+ * @param link the reverse link from a neighbor to remove.
+ */
+ private void removeReverseLink(Link link) {
+ // NOTE: link.neghborPort is my port
+ reverseLinksMap.remove(link.neighborPort);
+ }
+};
+
+/**
+ * A class for storing topology information.
+ */
+public class Topology {
+ private Map<Long, Node> nodesMap; // The dpid->Node mapping
+
+ /**
+ * Default constructor.
+ */
+ public Topology() {
+ nodesMap = new TreeMap<Long, Node>();
+ }
+
+ /**
+ * Add a topology element to the topology.
+ *
+ * @param topologyElement the topology element to add.
+ * @return true if the topology was modified, otherwise false.
+ */
+ public boolean addTopologyElement(TopologyElement topologyElement) {
+ boolean isModified = false;
+
+ switch (topologyElement.getType()) {
+ case ELEMENT_SWITCH: {
+ // Add the switch
+ Node node = getNode(topologyElement.getSwitch());
+ if (node == null) {
+ node = addNode(topologyElement.getSwitch());
+ isModified = true;
+ }
+ break;
+ }
+ case ELEMENT_PORT: {
+ // Add the switch
+ Node node = getNode(topologyElement.getSwitch());
+ if (node == null) {
+ node = addNode(topologyElement.getSwitch());
+ isModified = true;
+ }
+ // Add the port for the switch
+ Integer port = node.getPort(topologyElement.getSwitchPort());
+ if (port == null) {
+ node.addPort(topologyElement.getSwitchPort());
+ isModified = true;
+ }
+ break;
+ }
+ case ELEMENT_LINK: {
+ // Add the "from" switch
+ Node fromNode = getNode(topologyElement.getFromSwitch());
+ if (fromNode == null) {
+ fromNode = addNode(topologyElement.getFromSwitch());
+ isModified = true;
+ }
+ // Add the "to" switch
+ Node toNode = getNode(topologyElement.getToSwitch());
+ if (toNode == null) {
+ toNode = addNode(topologyElement.getToSwitch());
+ isModified = true;
+ }
+ // Add the "from" port
+ Integer fromPort = fromNode.getPort(topologyElement.getFromPort());
+ if (fromPort == null) {
+ fromNode.addPort(topologyElement.getFromPort());
+ isModified = true;
+ }
+ // Add the "to" port
+ Integer toPort = fromNode.getPort(topologyElement.getToPort());
+ if (toPort == null) {
+ toNode.addPort(topologyElement.getToPort());
+ isModified = true;
+ }
+ Node.Link link = fromNode.getLink(topologyElement.getFromPort());
+ if (link == null) {
+ fromNode.addLink(topologyElement.getFromPort(),
+ toNode,
+ topologyElement.getToPort());
+ isModified = true;
+ }
+
+ break;
+ }
+ }
+
+ return isModified;
+ }
+
+ /**
+ * Remove a topology element from the topology.
+ *
+ * @param topologyElement the topology element to remove.
+ * @return true if the topology was modified, otherwise false.
+ */
+ public boolean removeTopologyElement(TopologyElement topologyElement) {
+ boolean isModified = false;
+
+ switch (topologyElement.getType()) {
+ case ELEMENT_SWITCH: {
+ // Remove the switch
+ Node node = getNode(topologyElement.getSwitch());
+ if (node != null) {
+ removeNode(node);
+ isModified = true;
+ }
+ break;
+ }
+ case ELEMENT_PORT: {
+ // Find the switch
+ Node node = getNode(topologyElement.getSwitch());
+ if (node == null)
+ break;
+ // Remove the port for the switch
+ Integer port = node.getPort(topologyElement.getSwitchPort());
+ if (port != null) {
+ node.removePort(topologyElement.getSwitchPort());
+ isModified = true;
+ }
+ break;
+ }
+ case ELEMENT_LINK: {
+ // Find the "from" switch
+ Node fromNode = getNode(topologyElement.getFromSwitch());
+ if (fromNode == null)
+ break;
+ // Remove the link originating from the "from" port
+ Node.Link link = fromNode.getLink(topologyElement.getFromPort());
+ if (link != null) {
+ fromNode.removeLink(topologyElement.getFromPort());
+ isModified = true;
+ }
+ break;
+ }
+ }
+
+ return isModified;
+ }
+
+ /**
+ * Get a node for a given Node ID.
+ *
+ * @param nodeId the Node ID to use.
+ * @return the corresponding Node if found, otherwise null.
+ */
+ Node getNode(long nodeId) {
+ return nodesMap.get(nodeId);
+ }
+
+ /**
+ * Add a node for a given Node ID.
+ *
+ * @param nodeId the Node ID to use.
+ * @return the added Node.
+ */
+ Node addNode(long nodeId) {
+ Node node = new Node(nodeId);
+ nodesMap.put(nodeId, node);
+ return node;
+ }
+
+ /**
+ * Remove an existing node.
+ *
+ * @param node the Node to remove.
+ */
+ void removeNode(Node node) {
+ //
+ // Remove all ports one-by-one. This operation will also remove the
+ // incoming links originating from the neighbors.
+ //
+ // NOTE: We have to extract all Port IDs in advance, otherwise we
+ // cannot loop over the Ports collection and remove entries at the
+ // same time.
+ // TODO: If there is a large number of ports, the implementation
+ // below can be sub-optimal. It should be refactored as follows:
+ // 1. Modify removePort() to perform all the cleanup, except
+ // removing the Port entry from the portsMap
+ // 2. Call portsMap.clear() at the end of this method
+ // 3. In all other methods: if removePort() is called somewhere else,
+ // add an explicit removal of the Port entry from the portsMap.
+ //
+ List<Integer> allPortIdKeys = new LinkedList<Integer>();
+ allPortIdKeys.addAll(node.ports().keySet());
+ for (Integer portId : allPortIdKeys)
+ node.removePort(portId);
+
+ nodesMap.remove(node.nodeId);
+ }
+
+ /**
+ * Read topology state from the database.
+ *
+ * @param dbHandler the Graph Database handler to use.
+ */
+ public void readFromDatabase(GraphDBOperation dbHandler) {
+ //
+ // Fetch the relevant info from the Switch and Port vertices
+ // from the Titan Graph.
+ //
+ Iterable<ISwitchObject> activeSwitches = dbHandler.getActiveSwitches();
+ for (ISwitchObject switchObj : activeSwitches) {
+ Vertex nodeVertex = switchObj.asVertex();
+ //
+ // The Switch info
+ //
+ String nodeDpid = nodeVertex.getProperty("dpid").toString();
+ long nodeId = HexString.toLong(nodeDpid);
+ Node me = nodesMap.get(nodeId);
+ if (me == null)
+ me = addNode(nodeId);
+
+ //
+ // The local Port info
+ //
+ for (Vertex myPortVertex : nodeVertex.getVertices(Direction.OUT, "on")) {
+ // Ignore inactive ports
+ if (! myPortVertex.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
+ int myPort = 0;
+ Object obj = myPortVertex.getProperty("number");
+ if (obj instanceof Short) {
+ myPort = (Short)obj;
+ } else if (obj instanceof Integer) {
+ myPort = (Integer)obj;
+ }
+
+ //
+ // The neighbor Port info
+ //
+ for (Vertex neighborPortVertex : myPortVertex.getVertices(Direction.OUT, "link")) {
+ // Ignore inactive ports
+ if (! neighborPortVertex.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
+ int neighborPort = 0;
+ obj = neighborPortVertex.getProperty("number");
+ if (obj instanceof Short) {
+ neighborPort = (Short)obj;
+ } else if (obj instanceof Integer) {
+ neighborPort = (Integer)obj;
+ }
+ //
+ // The neighbor Switch info
+ //
+ for (Vertex neighborVertex : neighborPortVertex.getVertices(Direction.IN, "on")) {
+ // Ignore inactive switches
+ String state = neighborVertex.getProperty("state").toString();
+ if (! state.equals(SwitchState.ACTIVE.toString()))
+ continue;
+
+ String neighborDpid = neighborVertex.getProperty("dpid").toString();
+ long neighborId = HexString.toLong(neighborDpid);
+ Node neighbor = nodesMap.get(neighborId);
+ if (neighbor == null)
+ neighbor = addNode(neighborId);
+ me.addLink(myPort, neighbor, neighborPort);
+ }
+ }
+ }
+ }
+ dbHandler.commit();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyElement.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyElement.java
new file mode 100644
index 0000000..b01c7d3
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyElement.java
@@ -0,0 +1,184 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Class for storing information about a Topology Element: Switch, Port or
+ * Link.
+ */
+public class TopologyElement {
+ /**
+ * The Element Type.
+ */
+ public enum Type {
+ ELEMENT_UNKNOWN, // Unknown element
+ ELEMENT_SWITCH, // Network Switch
+ ELEMENT_PORT, // Switch Port
+ ELEMENT_LINK // Unidirectional Link between Switch Ports
+ }
+
+ private Type elementType; // The element type
+ private long fromSwitchDpid = 0; // The Switch DPID
+ private int fromSwitchPort = 0; // The Switch Port
+ private long toSwitchDpid = 0; // The Neighbor Switch DPID
+ private int toSwitchPort = 0; // The Neighbor Switch Port
+
+ /**
+ * Default constructor.
+ */
+ public TopologyElement() {
+ elementType = Type.ELEMENT_UNKNOWN;
+ }
+
+ /**
+ * Constructor to create a Topology Element for a Switch.
+ *
+ * @param switchDpid the Switch DPID.
+ */
+ public TopologyElement(long switchDpid) {
+ this.elementType = Type.ELEMENT_SWITCH;
+ this.fromSwitchDpid = switchDpid;
+ }
+
+ /**
+ * Constructor to create a Topology Element for a Switch Port.
+ *
+ * @param switchDpid the Switch DPID.
+ * @param switchPort the Switch Port.
+ */
+ public TopologyElement(long switchDpid, int switchPort) {
+ this.elementType = Type.ELEMENT_PORT;
+ this.fromSwitchDpid = switchDpid;
+ this.fromSwitchPort = switchPort;
+ }
+
+ /**
+ * Constructor to create a Topology Element for an unidirectional Link
+ * between Switch Ports.
+ *
+ * @param fromSwitchDpid the Switch DPID the Link begins from.
+ * @param fromSwitchPort the Switch Port the Link begins from.
+ * @param toSwitchDpid the Switch DPID the Link ends to.
+ * @param toSwitchPort the Switch Port the Link ends to.
+ */
+ public TopologyElement(long fromSwitchDpid, int fromSwitchPort,
+ long toSwitchDpid, int toSwitchPort) {
+ this.elementType = Type.ELEMENT_LINK;
+ this.fromSwitchDpid = fromSwitchDpid;
+ this.fromSwitchPort = fromSwitchPort;
+ this.toSwitchDpid = toSwitchDpid;
+ this.toSwitchPort = toSwitchPort;
+ }
+
+ /**
+ * Get the Element type.
+ *
+ * @return the Element type.
+ */
+ public TopologyElement.Type getType() {
+ return elementType;
+ }
+
+ /**
+ * Get the Switch DPID.
+ *
+ * NOTE: Applies for Type.ELEMENT_SWITCH and Type.ELEMENT_PORT
+ *
+ * @return the Switch DPID.
+ */
+ public long getSwitch() {
+ return fromSwitchDpid;
+ }
+
+ /**
+ * Get the Switch Port.
+ *
+ * NOTE: Applies for Type.ELEMENT_PORT
+ *
+ * @return the Switch Port.
+ */
+ public int getSwitchPort() {
+ return fromSwitchPort;
+ }
+
+ /**
+ * Get the Switch DPID the Link begins from.
+ *
+ * NOTE: Applies for Type.ELEMENT_LINK
+ */
+ public long getFromSwitch() {
+ return fromSwitchDpid;
+ }
+
+ /**
+ * Get the Switch Port the Link begins from.
+ *
+ * NOTE: Applies for Type.ELEMENT_LINK
+ */
+ public int getFromPort() {
+ return fromSwitchPort;
+ }
+
+ /**
+ * Get the Switch DPID the Link ends to.
+ *
+ * NOTE: Applies for Type.ELEMENT_LINK
+ */
+ public long getToSwitch() {
+ return toSwitchDpid;
+ }
+
+ /**
+ * Get the Switch Port the Link ends to.
+ *
+ * NOTE: Applies for Type.ELEMENT_LINK
+ */
+ public int getToPort() {
+ return toSwitchPort;
+ }
+
+ /**
+ * Get the Topology Element ID.
+ *
+ * The Topology Element ID has the following format:
+ * - Switch: "Switch=<HexLongDpid>"
+ * Example: "Switch=101"
+ * - Switch Port: "Port=<HexLongDpid>/<IntPortId>"
+ * Example: "Port=102/1"
+ * - Link: "Link=<FromHexLongDpid>/<FromIntPortId>/<ToHexLongDpid>/<ToIntPortId>"
+ * Example: "Link=101/2/103/4"
+ *
+ * NOTE: The Topology Element ID has no syntax meaning. It is used only to
+ * uniquely identify a topology element.
+ *
+ * @return the Topology Element ID.
+ */
+ public String elementId() {
+ switch (elementType) {
+ case ELEMENT_SWITCH:
+ return "Switch=" + Long.toHexString(fromSwitchDpid);
+ case ELEMENT_PORT:
+ return "Port=" +
+ Long.toHexString(fromSwitchDpid) + "/" + fromSwitchPort;
+ case ELEMENT_LINK:
+ return "Link=" +
+ Long.toHexString(fromSwitchDpid) + "/" + fromSwitchPort + "/" +
+ Long.toHexString(toSwitchDpid) + "/" + toSwitchPort;
+ }
+
+ assert(false);
+ return null;
+ }
+
+ /**
+ * Convert the Topology Element to a string.
+ *
+ * @return the Topology Element as a string.
+ */
+ @Override
+ public String toString() {
+ // For now, we just return the Element ID.
+ return elementId();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
new file mode 100644
index 0000000..c0e04f2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
@@ -0,0 +1,329 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.floodlightlistener.INetworkGraphService;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A class for obtaining Topology Snapshot
+ * and PathComputation.
+ *
+ * TODO: PathComputation part should be refactored out to separate class.
+ */
+public class TopologyManager implements IFloodlightModule,
+ ITopologyNetService {
+ private final static Logger log = LoggerFactory.getLogger(TopologyManager.class);
+ protected IFloodlightProviderService floodlightProvider;
+
+ protected GraphDBOperation dbHandler;
+
+
+ /**
+ * Default constructor.
+ */
+ public TopologyManager() {
+ }
+
+ /**
+ * Constructor for given database configuration file.
+ *
+ * @param config the database configuration file to use for
+ * the initialization.
+ */
+ public TopologyManager(String config) {
+ this.init(config);
+ }
+
+ /**
+ * Constructor for a given database operation handler.
+ *
+ * @param dbHandler the database operation handler to use for the
+ * initialization.
+ */
+ public TopologyManager(GraphDBOperation dbHandler) {
+ this.dbHandler = dbHandler;
+ }
+
+ /**
+ * Init the module.
+ *
+ * @param config the database configuration file to use for
+ * the initialization.
+ */
+ public void init(String config) {
+ try {
+ dbHandler = new GraphDBOperation(config);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Shutdown the Topology Manager operation.
+ */
+ public void finalize() {
+ close();
+ }
+
+ /**
+ * Close the service. It will close the corresponding database connection.
+ */
+ public void close() {
+ dbHandler.close();
+ }
+
+ /**
+ * Get the collection of offered module services.
+ *
+ * @return the collection of offered module services.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(ITopologyNetService.class);
+ return l;
+ }
+
+ /**
+ * Get the collection of implemented services.
+ *
+ * @return the collection of implemented services.
+ */
+ @Override
+ public Map<Class<? extends IFloodlightService>, IFloodlightService>
+ getServiceImpls() {
+ Map<Class<? extends IFloodlightService>,
+ IFloodlightService> m =
+ new HashMap<Class<? extends IFloodlightService>,
+ IFloodlightService>();
+ m.put(ITopologyNetService.class, this);
+ return m;
+ }
+
+ /**
+ * Get the collection of modules this module depends on.
+ *
+ * @return the collection of modules this module depends on.
+ */
+ @Override
+ public Collection<Class<? extends IFloodlightService>>
+ getModuleDependencies() {
+ Collection<Class<? extends IFloodlightService>> l =
+ new ArrayList<Class<? extends IFloodlightService>>();
+ l.add(IFloodlightProviderService.class);
+ l.add(INetworkGraphService.class);
+ l.add(IDatagridService.class);
+ return l;
+ }
+
+ /**
+ * Initialize the module.
+ *
+ * @param context the module context to use for the initialization.
+ */
+ @Override
+ public void init(FloodlightModuleContext context)
+ throws FloodlightModuleException {
+ floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+
+ String conf = "";
+ this.init(conf);
+ }
+
+ /**
+ * Startup module operation.
+ *
+ * @param context the module context to use for the startup.
+ */
+ @Override
+ public void startUp(FloodlightModuleContext context) {
+
+ }
+
+ /**
+ * Fetch the Switch and Ports info from the Titan Graph
+ * and return it for fast access during the shortest path
+ * computation.
+ *
+ * After fetching the state, method @ref getTopologyShortestPath()
+ * can be used for fast shortest path computation.
+ *
+ * Note: There is certain cost to fetch the state, hence it should
+ * be used only when there is a large number of shortest path
+ * computations that need to be done on the same topology.
+ * Typically, a single call to @ref newDatabaseTopology()
+ * should be followed by a large number of calls to
+ * method @ref getTopologyShortestPath().
+ * After the last @ref getTopologyShortestPath() call,
+ * method @ref dropTopology() should be used to release
+ * the internal state that is not needed anymore:
+ *
+ * Topology topology = topologyManager.newDatabaseTopology();
+ * for (int i = 0; i < 10000; i++) {
+ * dataPath = topologyManager.getTopologyShortestPath(topology, ...);
+ * ...
+ * }
+ * topologyManager.dropTopology(shortestPathTopo);
+ *
+ * @return the allocated topology handler.
+ */
+ public Topology newDatabaseTopology() {
+ Topology topology = new Topology();
+ topology.readFromDatabase(dbHandler);
+
+ return topology;
+ }
+
+ /**
+ * Release the topology that was populated by
+ * method @ref newDatabaseTopology().
+ *
+ * See the documentation for method @ref newDatabaseTopology()
+ * for additional information and usage.
+ *
+ * @param topology the topology to release.
+ */
+ public void dropTopology(Topology topology) {
+ topology = null;
+ }
+
+ /**
+ * Compute the network path for a Flow.
+ *
+ * @param topology the topology handler to use.
+ * @param flowPath the Flow to compute the network path for.
+ * @return the data path with the computed path if found, otherwise null.
+ */
+ public static DataPath computeNetworkPath(Topology topology,
+ FlowPath flowPath) {
+ //
+ // Compute the network path based on the desired Flow Path type
+ //
+ switch (flowPath.flowPathType()) {
+ case FP_TYPE_SHORTEST_PATH: {
+ SwitchPort src = flowPath.dataPath().srcPort();
+ SwitchPort dest = flowPath.dataPath().dstPort();
+ return ShortestPath.getTopologyShortestPath(topology, src, dest);
+ }
+ case FP_TYPE_EXPLICIT_PATH:
+ return flowPath.dataPath();
+ }
+
+ return null;
+ }
+
+ /**
+ * Test whether two Flow Entries represent same points in a data path.
+ *
+ * NOTE: Two Flow Entries represent same points in a data path if
+ * the Switch DPID, incoming port and outgoing port are same.
+ *
+ * NOTE: This method is specialized for shortest-path unicast paths,
+ * and probably should be moved somewhere else.
+ *
+ * @param oldFlowEntry the first Flow Entry to compare.
+ * @param newFlowEntry the second Flow Entry to compare.
+ * @return true if the two Flow Entries represent same points in a
+ * data path, otherwise false.
+ */
+ public static boolean isSameFlowEntryDataPath(FlowEntry oldFlowEntry,
+ FlowEntry newFlowEntry) {
+ // Test the DPID
+ if (oldFlowEntry.dpid().value() != newFlowEntry.dpid().value())
+ return false;
+
+ // Test the inPort
+ do {
+ Port oldPort = oldFlowEntry.inPort();
+ Port newPort = newFlowEntry.inPort();
+ if ((oldPort != null) && (newPort != null) &&
+ (oldPort.value() == newPort.value())) {
+ break;
+ }
+ if ((oldPort == null) && (newPort == null))
+ break;
+ return false; // inPort is different
+ } while (false);
+
+ // Test the outPort
+ do {
+ Port oldPort = oldFlowEntry.outPort();
+ Port newPort = newFlowEntry.outPort();
+ if ((oldPort != null) && (newPort != null) &&
+ (oldPort.value() == newPort.value())) {
+ break;
+ }
+ if ((oldPort == null) && (newPort == null))
+ break;
+ return false; // outPort is different
+ } while (false);
+
+ return true;
+ }
+
+ /**
+ * Get the shortest path from a source to a destination by
+ * using the pre-populated local topology state prepared
+ * by method @ref newDatabaseTopology().
+ *
+ * See the documentation for method @ref newDatabaseTopology()
+ * for additional information and usage.
+ *
+ * @param topology the topology handler to use.
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ public DataPath getTopologyShortestPath(Topology topology,
+ SwitchPort src, SwitchPort dest) {
+ return ShortestPath.getTopologyShortestPath(topology, src, dest);
+ }
+
+ /**
+ * Get the shortest path from a source to a destination by using
+ * the underlying database.
+ *
+ * @param src the source in the shortest path computation.
+ * @param dest the destination in the shortest path computation.
+ * @return the data path with the computed shortest path if
+ * found, otherwise null.
+ */
+ @Override
+ public DataPath getDatabaseShortestPath(SwitchPort src, SwitchPort dest) {
+ return ShortestPath.getDatabaseShortestPath(dbHandler, src, dest);
+ }
+
+ /**
+ * Test whether a route exists from a source to a destination.
+ *
+ * @param src the source node for the test.
+ * @param dest the destination node for the test.
+ * @return true if a route exists, otherwise false.
+ */
+ @Override
+ public Boolean routeExists(SwitchPort src, SwitchPort dest) {
+ DataPath dataPath = getDatabaseShortestPath(src, dest);
+ return (dataPath != null);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
new file mode 100644
index 0000000..0d33b27
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
@@ -0,0 +1,63 @@
+package net.onrc.onos.ofcontroller.topology.web;
+
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RouteResource extends ServerResource {
+
+ protected final static Logger log = LoggerFactory.getLogger(RouteResource.class);
+
+ @Get("json")
+ public DataPath retrieve() {
+ // Get the services that are needed for the computation
+ ITopologyNetService topologyNetService =
+ (ITopologyNetService)getContext().getAttributes().
+ get(ITopologyNetService.class.getCanonicalName());
+ IFlowService flowService =
+ (IFlowService)getContext().getAttributes().
+ get(IFlowService.class.getCanonicalName());
+
+ if (topologyNetService == null) {
+ log.debug("Topology Net Service not found");
+ return null;
+ }
+ if (flowService == null) {
+ log.debug("Flow Service not found");
+ return null;
+ }
+
+ String srcDpidStr = (String) getRequestAttributes().get("src-dpid");
+ String srcPortStr = (String) getRequestAttributes().get("src-port");
+ String dstDpidStr = (String) getRequestAttributes().get("dst-dpid");
+ String dstPortStr = (String) getRequestAttributes().get("dst-port");
+
+ log.debug( srcDpidStr + "--" + srcPortStr + "--" + dstDpidStr + "--" + dstPortStr);
+
+ Dpid srcDpid = new Dpid(srcDpidStr);
+ Port srcPort = new Port(Short.parseShort(srcPortStr));
+ Dpid dstDpid = new Dpid(dstDpidStr);
+ Port dstPort = new Port(Short.parseShort(dstPortStr));
+
+ DataPath result =
+ topologyNetService.getTopologyShortestPath(
+ flowService.getTopology(),
+ new SwitchPort(srcDpid, srcPort),
+ new SwitchPort(dstDpid, dstPort));
+ if (result != null) {
+ return result;
+ } else {
+ log.debug("ERROR! no route found");
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/CallerId.java b/src/main/java/net/onrc/onos/ofcontroller/util/CallerId.java
similarity index 95%
rename from src/main/java/net/floodlightcontroller/util/CallerId.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/CallerId.java
index ade0f0d..0607533 100644
--- a/src/main/java/net/floodlightcontroller/util/CallerId.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/CallerId.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
new file mode 100644
index 0000000..044cc6d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
@@ -0,0 +1,187 @@
+package net.onrc.onos.ofcontroller.util;
+
+import java.util.ArrayList;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The data forwarding path state from a source to a destination.
+ */
+public class DataPath {
+ private SwitchPort srcPort; // The source port
+ private SwitchPort dstPort; // The destination port
+ private ArrayList<FlowEntry> flowEntries; // The Flow Entries
+
+ /**
+ * Default constructor.
+ */
+ public DataPath() {
+ srcPort = new SwitchPort();
+ dstPort = new SwitchPort();
+ flowEntries = new ArrayList<FlowEntry>();
+ }
+
+ /**
+ * Get the data path source port.
+ *
+ * @return the data path source port.
+ */
+ @JsonProperty("srcPort")
+ public SwitchPort srcPort() { return srcPort; }
+
+ /**
+ * Set the data path source port.
+ *
+ * @param srcPort the data path source port to set.
+ */
+ @JsonProperty("srcPort")
+ public void setSrcPort(SwitchPort srcPort) {
+ this.srcPort = srcPort;
+ }
+
+ /**
+ * Get the data path destination port.
+ *
+ * @return the data path destination port.
+ */
+ @JsonProperty("dstPort")
+ public SwitchPort dstPort() { return dstPort; }
+
+ /**
+ * Set the data path destination port.
+ *
+ * @param dstPort the data path destination port to set.
+ */
+ @JsonProperty("dstPort")
+ public void setDstPort(SwitchPort dstPort) {
+ this.dstPort = dstPort;
+ }
+
+ /**
+ * Get the data path flow entries.
+ *
+ * @return the data path flow entries.
+ */
+ @JsonProperty("flowEntries")
+ public ArrayList<FlowEntry> flowEntries() { return flowEntries; }
+
+ /**
+ * Set the data path flow entries.
+ *
+ * @param flowEntries the data path flow entries to set.
+ */
+ @JsonProperty("flowEntries")
+ public void setFlowEntries(ArrayList<FlowEntry> flowEntries) {
+ this.flowEntries = flowEntries;
+ }
+
+ /**
+ * Apply Flow Path Flags to the pre-computed Data Path.
+ *
+ * @param flowPathFlags the Flow Path Flags to apply.
+ */
+ public void applyFlowPathFlags(FlowPathFlags flowPathFlags) {
+ if (flowPathFlags == null)
+ return; // Nothing to do
+
+ // Discard the first Flow Entry
+ if (flowPathFlags.isDiscardFirstHopEntry()) {
+ if (flowEntries.size() > 0)
+ flowEntries.remove(0);
+ }
+
+ // Keep only the first Flow Entry
+ if (flowPathFlags.isKeepOnlyFirstHopEntry()) {
+ if (flowEntries.size() > 1) {
+ FlowEntry flowEntry = flowEntries.get(0);
+ flowEntries.clear();
+ flowEntries.add(flowEntry);
+ }
+ }
+ }
+
+ /**
+ * Remove Flow Entries that were deleted.
+ */
+ public void removeDeletedFlowEntries() {
+ //
+ // NOTE: We create a new ArrayList, and add only the Flow Entries
+ // that are NOT FE_USER_DELETE.
+ // This is sub-optimal: if it adds notable processing cost,
+ // the Flow Entries container should be changed to LinkedList
+ // or some other container that has O(1) cost of removing an entry.
+ //
+
+ // Test first whether any Flow Entry was deleted
+ boolean foundDeletedFlowEntry = false;
+ for (FlowEntry flowEntry : this.flowEntries) {
+ if (flowEntry.flowEntryUserState() ==
+ FlowEntryUserState.FE_USER_DELETE) {
+ foundDeletedFlowEntry = true;
+ break;
+ }
+ }
+ if (! foundDeletedFlowEntry)
+ return; // Nothing to do
+
+ // Create a new collection and exclude the deleted flow entries
+ ArrayList<FlowEntry> newFlowEntries = new ArrayList<FlowEntry>();
+ for (FlowEntry flowEntry : this.flowEntries()) {
+ if (flowEntry.flowEntryUserState() !=
+ FlowEntryUserState.FE_USER_DELETE) {
+ newFlowEntries.add(flowEntry);
+ }
+ }
+ setFlowEntries(newFlowEntries);
+ }
+
+ /**
+ * Get a string with the summary of the shortest-path data path
+ * computation.
+ *
+ * NOTE: This method assumes the DataPath was created by
+ * using the TopologyManager shortest path computation, so the inPort
+ * and outPort of the Flow Entries are set.
+ * NOTE: This method is a temporary solution and will be removed
+ * in the future.
+ *
+ * @return a string with the summary of the shortest-path
+ * data path computation if valid, otherwise the string "X".
+ * If the shortest-path was valid, The string has the following form:
+ * inPort/dpid/outPort;inPort/dpid/outPort;...
+ */
+ public String dataPathSummary() {
+ StringBuilder resultStr = new StringBuilder(5+1+20+1+5+1);
+ if (this.flowEntries != null) {
+ for (FlowEntry flowEntry : this.flowEntries) {
+ // The data path summary string
+ resultStr.append(flowEntry.inPort().toString()).append('/')
+ .append(flowEntry.dpid().toString()).append('/')
+ .append(flowEntry.outPort().toString()).append(';');
+ }
+ }
+ if (resultStr.length() == 0)
+ resultStr.append("X"); // Invalid shortest-path
+ return resultStr.toString();
+ }
+
+ /**
+ * Convert the data path to a string.
+ *
+ * The string has the following form:
+ * [src=01:01:01:01:01:01:01:01/1111 flowEntry=<entry1> flowEntry=<entry2> flowEntry=<entry3> dst=02:02:02:02:02:02:02:02/2222]
+ *
+ * @return the data path as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[src=" + this.srcPort.toString();
+
+ for (FlowEntry fe : flowEntries) {
+ ret += " flowEntry=" + fe.toString();
+ }
+ ret += " dst=" + this.dstPort.toString() + "]";
+
+ return ret;
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPathEndpoints.java
similarity index 95%
rename from src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/DataPathEndpoints.java
index 3ee88d1..9cdd4fb 100644
--- a/src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPathEndpoints.java
@@ -1,6 +1,5 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import net.floodlightcontroller.util.SwitchPort;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/floodlightcontroller/util/Dpid.java b/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
similarity index 72%
rename from src/main/java/net/floodlightcontroller/util/Dpid.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
index 5af6bea..bd91daa 100644
--- a/src/main/java/net/floodlightcontroller/util/Dpid.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
@@ -1,12 +1,11 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import org.openflow.util.HexString;
-import net.floodlightcontroller.util.serializers.DpidDeserializer;
-import net.floodlightcontroller.util.serializers.DpidSerializer;
+import net.onrc.onos.ofcontroller.util.serializers.DpidDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.DpidSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.openflow.util.HexString;
/**
* The class representing a network switch DPID.
@@ -68,4 +67,22 @@
public String toString() {
return HexString.toHexString(this.value);
}
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof Dpid)) {
+ return false;
+ }
+
+ Dpid otherDpid = (Dpid) other;
+
+ return value == otherDpid.value;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash += 31 * hash + (int)(value ^ value >>> 32);
+ return hash;
+ }
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/EventEntry.java b/src/main/java/net/onrc/onos/ofcontroller/util/EventEntry.java
new file mode 100644
index 0000000..5b296e0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/EventEntry.java
@@ -0,0 +1,64 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * Class for encapsulating events with event-related data entry.
+ */
+public class EventEntry<T> {
+ /**
+ * The event types.
+ */
+ public enum Type {
+ ENTRY_ADD, // Add or update an entry
+ ENTRY_REMOVE // Remove an entry
+ }
+
+ private Type eventType; // The event type
+ private T eventData; // The relevant event data entry
+
+ /**
+ * Constructor for a given event type and event-related data entry.
+ *
+ * @param eventType the event type.
+ * @param eventData the event data entry.
+ */
+ public EventEntry(EventEntry.Type eventType, T eventData) {
+ this.eventType = eventType;
+ this.eventData = eventData;
+ }
+
+ /**
+ * Test whether the event type is ENTRY_ADD.
+ *
+ * @return true if the event type is ENTRY_ADD, otherwise false.
+ */
+ public boolean isAdd() {
+ return (this.eventType == Type.ENTRY_ADD);
+ }
+
+ /**
+ * Test whether the event type is ENTRY_REMOVE.
+ *
+ * @return true if the event type is ENTRY_REMOVE, otherwise false.
+ */
+ public boolean isRemove() {
+ return (this.eventType == Type.ENTRY_REMOVE);
+ }
+
+ /**
+ * Get the event type.
+ *
+ * @return the event type.
+ */
+ public EventEntry.Type eventType() {
+ return this.eventType;
+ }
+
+ /**
+ * Get the event-related data entry.
+ *
+ * @return the event-related data entry.
+ */
+ public T eventData() {
+ return this.eventData;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
new file mode 100644
index 0000000..98dbd88
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
@@ -0,0 +1,384 @@
+package net.onrc.onos.ofcontroller.util;
+
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing the Flow Entry.
+ *
+ * NOTE: The specification is incomplete. E.g., the entry needs to
+ * support multiple in-ports and multiple out-ports.
+ */
+public class FlowEntry {
+ private FlowId flowId; // FlowID of the Flow Entry
+ private FlowEntryId flowEntryId; // The Flow Entry ID
+ private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
+ private FlowEntryActions flowEntryActions; // The Flow Entry Actions
+ private Dpid dpid; // The Switch DPID
+ private Port inPort; // The Switch incoming port. Used only
+ // when the entry is used to return
+ // Shortest Path computation.
+ private Port outPort; // The Switch outgoing port. Used only
+ // when the entry is used to return
+ // Shortest Path computation.
+ private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
+ private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
+ // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
+ private FlowEntryErrorState flowEntryErrorState;
+
+ /**
+ * Default constructor.
+ */
+ public FlowEntry() {
+ // TODO: Test code
+ /*
+ MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06");
+ IPv4 ipv4 = new IPv4("1.2.3.4");
+ IPv4Net ipv4net = new IPv4Net("5.6.7.0/24");
+
+ flowEntryMatch = new FlowEntryMatch();
+ flowEntryMatch.enableInPort(new Port((short)10));
+ flowEntryMatch.enableSrcMac(mac);
+ flowEntryMatch.enableDstMac(mac);
+ flowEntryMatch.enableVlanId((short)20);
+ flowEntryMatch.enableVlanPriority((byte)30);
+ flowEntryMatch.enableEthernetFrameType((short)40);
+ flowEntryMatch.enableIpToS((byte)50);
+ flowEntryMatch.enableIpProto((byte)60);
+ flowEntryMatch.enableSrcIPv4Net(ipv4net);
+ flowEntryMatch.enableDstIPv4Net(ipv4net);
+ flowEntryMatch.enableSrcTcpUdpPort((short)70);
+ flowEntryMatch.enableDstTcpUdpPort((short)80);
+
+ FlowEntryAction action = null;
+ FlowEntryActions actions = new FlowEntryActions();
+
+ action = new FlowEntryAction();
+ action.setActionOutput(new Port((short)12));
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionOutputToController((short)13);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetVlanId((short)14);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetVlanPriority((byte)15);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionStripVlan(true);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetEthernetSrcAddr(mac);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetEthernetDstAddr(mac);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIPv4SrcAddr(ipv4);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIPv4DstAddr(ipv4);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIpToS((byte)16);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpSrcPort((short)17);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpDstPort((short)18);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionEnqueue(new Port((short)19), 20);
+ actions.addAction(action);
+
+ setFlowEntryActions(actions);
+ */
+
+ flowEntryActions = new FlowEntryActions();
+ flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
+ flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
+ }
+
+ /**
+ * Get the Flow ID.
+ *
+ * @return the Flow ID.
+ */
+ @JsonIgnore
+ public FlowId flowId() { return flowId; }
+
+ /**
+ * Set the Flow ID.
+ *
+ * @param flowId the Flow ID to set.
+ */
+ public void setFlowId(FlowId flowId) {
+ this.flowId = flowId;
+ }
+
+ /**
+ * Test whether the Flow ID is valid.
+ *
+ * @return true if the Flow ID is valid, otherwise false.
+ */
+ @JsonIgnore
+ public boolean isValidFlowId() {
+ if (this.flowId == null)
+ return false;
+ return (this.flowId.isValid());
+ }
+
+ /**
+ * Get the Flow Entry ID.
+ *
+ * @return the Flow Entry ID.
+ */
+ @JsonProperty("flowEntryId")
+ public FlowEntryId flowEntryId() { return flowEntryId; }
+
+ /**
+ * Set the Flow Entry ID.
+ *
+ * @param flowEntryId the Flow Entry ID to set.
+ */
+ @JsonProperty("flowEntryId")
+ public void setFlowEntryId(FlowEntryId flowEntryId) {
+ this.flowEntryId = flowEntryId;
+ }
+
+ /**
+ * Test whether the Flow Entry ID is valid.
+ *
+ * @return true if the Flow Entry ID is valid, otherwise false.
+ */
+ @JsonIgnore
+ public boolean isValidFlowEntryId() {
+ if (this.flowEntryId == null)
+ return false;
+ return (this.flowEntryId.isValid());
+ }
+
+ /**
+ * Get the Flow Entry Match.
+ *
+ * @return the Flow Entry Match.
+ */
+ @JsonProperty("flowEntryMatch")
+ public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
+
+ /**
+ * Set the Flow Entry Match.
+ *
+ * @param flowEntryMatch the Flow Entry Match to set.
+ */
+ @JsonProperty("flowEntryMatch")
+ public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
+ this.flowEntryMatch = flowEntryMatch;
+ }
+
+ /**
+ * Get the Flow Entry Actions.
+ *
+ * @return the Flow Entry Actions.
+ */
+ @JsonProperty("flowEntryActions")
+ public FlowEntryActions flowEntryActions() {
+ return flowEntryActions;
+ }
+
+ /**
+ * Set the Flow Entry Actions.
+ *
+ * @param flowEntryActions the Flow Entry Actions to set.
+ */
+ @JsonProperty("flowEntryActions")
+ public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
+ this.flowEntryActions = flowEntryActions;
+ }
+
+ /**
+ * Get the Switch DPID.
+ *
+ * @return the Switch DPID.
+ */
+ @JsonProperty("dpid")
+ public Dpid dpid() { return dpid; }
+
+ /**
+ * Set the Switch DPID.
+ *
+ * @param dpid the Switch DPID to set.
+ */
+ @JsonProperty("dpid")
+ public void setDpid(Dpid dpid) {
+ this.dpid = dpid;
+ }
+
+ /**
+ * Get the Switch incoming port.
+ *
+ * Used only when the entry is used to return Shortest Path computation.
+ *
+ * @return the Switch incoming port.
+ */
+ @JsonProperty("inPort")
+ public Port inPort() { return inPort; }
+
+ /**
+ * Set the Switch incoming port.
+ *
+ * Used only when the entry is used to return Shortest Path computation.
+ *
+ * @param inPort the Switch incoming port to set.
+ */
+ @JsonProperty("inPort")
+ public void setInPort(Port inPort) {
+ this.inPort = inPort;
+ }
+
+ /**
+ * Get the Switch outgoing port.
+ *
+ * Used only when the entry is used to return Shortest Path computation.
+ *
+ * @return the Switch outgoing port.
+ */
+ @JsonProperty("outPort")
+ public Port outPort() { return outPort; }
+
+ /**
+ * Set the Switch outgoing port.
+ *
+ * Used only when the entry is used to return Shortest Path computation.
+ *
+ * @param outPort the Switch outgoing port to set.
+ */
+ @JsonProperty("outPort")
+ public void setOutPort(Port outPort) {
+ this.outPort = outPort;
+ }
+
+ /**
+ * Get the Flow Entry User state.
+ *
+ * @return the Flow Entry User state.
+ */
+ @JsonProperty("flowEntryUserState")
+ public FlowEntryUserState flowEntryUserState() {
+ return flowEntryUserState;
+ }
+
+ /**
+ * Set the Flow Entry User state.
+ *
+ * @param flowEntryUserState the Flow Entry User state to set.
+ */
+ @JsonProperty("flowEntryUserState")
+ public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
+ this.flowEntryUserState = flowEntryUserState;
+ }
+
+ /**
+ * Get the Flow Entry Switch state.
+ *
+ * The Flow Entry Error state is used if FlowEntrySwitchState is
+ * FE_SWITCH_FAILED.
+ *
+ * @return the Flow Entry Switch state.
+ */
+ @JsonProperty("flowEntrySwitchState")
+ public FlowEntrySwitchState flowEntrySwitchState() {
+ return flowEntrySwitchState;
+ }
+
+ /**
+ * Set the Flow Entry Switch state.
+ *
+ * The Flow Entry Error state is used if FlowEntrySwitchState is
+ * FE_SWITCH_FAILED.
+ *
+ * @param flowEntrySwitchState the Flow Entry Switch state to set.
+ */
+ @JsonProperty("flowEntrySwitchState")
+ public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
+ this.flowEntrySwitchState = flowEntrySwitchState;
+ }
+
+ /**
+ * Get the Flow Entry Error state.
+ *
+ * @return the Flow Entry Error state.
+ */
+ @JsonProperty("flowEntryErrorState")
+ public FlowEntryErrorState flowEntryErrorState() {
+ return flowEntryErrorState;
+ }
+
+ /**
+ * Set the Flow Entry Error state.
+ *
+ * @param flowEntryErrorState the Flow Entry Error state to set.
+ */
+ @JsonProperty("flowEntryErrorState")
+ public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
+ this.flowEntryErrorState = flowEntryErrorState;
+ }
+
+ /**
+ * Convert the flow entry to a string.
+ *
+ * The string has the following form:
+ * [flowEntryId=XXX flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
+ * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
+ * flowEntryErrorState=XXX]
+ * @return the flow entry as a string.
+ */
+ @Override
+ public String toString() {
+ StringBuilder ret = new StringBuilder();
+ if ( flowEntryId != null ) {
+ ret.append("[flowEntryId=" + this.flowEntryId.toString());
+ } else {
+ ret.append("[");
+ }
+ if ( flowId != null ) {
+ ret.append(" flowId=" + this.flowId.toString());
+ }
+ if ( flowEntryMatch != null ) {
+ ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
+ }
+ ret.append( " flowEntryActions=" + this.flowEntryActions.toString() );
+ if ( dpid != null ) {
+ ret.append(" dpid=" + this.dpid.toString());
+ }
+ if ( inPort != null ) {
+ ret.append(" inPort=" + this.inPort.toString());
+ }
+ if ( outPort != null ) {
+ ret.append(" outPort=" + this.outPort.toString());
+ }
+ ret.append(" flowEntryUserState=" + this.flowEntryUserState);
+ ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
+ if ( flowEntryErrorState != null ) {
+ ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
+ }
+ ret.append("]");
+
+ return ret.toString();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
new file mode 100644
index 0000000..a1163c8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
@@ -0,0 +1,1664 @@
+package net.onrc.onos.ofcontroller.util;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing a single Flow Entry action.
+ *
+ * A Flow Entry action that needs to be applied to each packet.
+ * Note that it contains only a single action. Multiple actions are
+ * listed in a list inside @ref FlowEntryActions.
+ */
+public class FlowEntryAction {
+ /**
+ * Special action values.
+ *
+ * Those values are taken as-is from the OpenFlow-v1.0.0 specification
+ * (pp 21-22).
+ */
+ public enum ActionValues {
+ ACTION_OUTPUT ((short)0x0), // Output to switch port
+ ACTION_SET_VLAN_VID ((short)0x1), // Set the 802.1q VLAN id
+ ACTION_SET_VLAN_PCP ((short)0x2), // Set the 802.1q priority
+ ACTION_STRIP_VLAN ((short)0x3), // Strip the 802.1q header
+ ACTION_SET_DL_SRC ((short)0x4), // Ethernet source address
+ ACTION_SET_DL_DST ((short)0x5), // Ethernet destination address
+ ACTION_SET_NW_SRC ((short)0x6), // IP source address
+ ACTION_SET_NW_DST ((short)0x7), // IP destination address
+ ACTION_SET_NW_TOS ((short)0x8), // IP ToS (DSCP field, 6 bits)
+ ACTION_SET_TP_SRC ((short)0x9), // TCP/UDP source port
+ ACTION_SET_TP_DST ((short)0xa), // TCP/UDP destination port
+ ACTION_ENQUEUE ((short)0xb), // Output to queue on port
+ ACTION_VENDOR ((short)0xffff); // Vendor-specific
+
+ private final short value; // The value
+
+ /**
+ * Constructor for a given value.
+ *
+ * @param value the value to use for the initialization.
+ */
+ private ActionValues(short value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Action structure for ACTION_OUTPUT: Output to switch port.
+ */
+ public static class ActionOutput {
+ private Port port; // Output port
+ private short maxLen; // Max. length (in bytes) to send to controller
+ // if the port is set to PORT_CONTROLLER
+
+ /**
+ * Default constructor.
+ */
+ public ActionOutput() {
+ this.port = null;
+ this.maxLen = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionOutput(ActionOutput other) {
+ if (other.port != null)
+ this.port = new Port(other.port);
+ this.maxLen = other.maxLen;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionOutput(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given output port and maximum length.
+ *
+ * @param port the output port to set.
+ * @param maxLen the maximum length (in bytes) to send to controller
+ * if the port is set to PORT_CONTROLLER.
+ */
+ public ActionOutput(Port port, short maxLen) {
+ this.port = port;
+ this.maxLen = maxLen;
+ }
+
+ /**
+ * Constructor for a given output port.
+ *
+ * @param port the output port to set.
+ */
+ public ActionOutput(Port port) {
+ this.port = port;
+ this.maxLen = 0;
+ }
+
+ /**
+ * Get the output port.
+ *
+ * @return the output port.
+ */
+ @JsonProperty("port")
+ public Port port() {
+ return this.port;
+ }
+
+ /**
+ * Get the maximum length (in bytes) to send to controller if the
+ * port is set to PORT_CONTROLLER.
+ *
+ * @return the maximum length (in bytes) to send to controller if the
+ * port is set to PORT_CONTROLLER.
+ */
+ @JsonProperty("maxLen")
+ public short maxLen() {
+ return this.maxLen;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port.toString();
+ ret += " maxLen=" + maxLen;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split(" ");
+ String decode = null;
+
+ // Decode the "port=XXX" part
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ String[] tokens = decode.split("port=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ Short valueShort = Short.valueOf(tokens[1]);
+ port = new Port(valueShort);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+
+ // Decode the "maxLen=XXX" part
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ String[] tokens = decode.split("maxLen=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ maxLen = Short.valueOf(tokens[1]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_VLAN_VID: Set the 802.1q VLAN id
+ */
+ public static class ActionSetVlanId {
+ private short vlanId; // The VLAN ID to set
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetVlanId() {
+ this.vlanId = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetVlanId(ActionSetVlanId other) {
+ this.vlanId = other.vlanId;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetVlanId(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given VLAN ID.
+ *
+ * @param vlanId the VLAN ID to set.
+ */
+ public ActionSetVlanId(short vlanId) {
+ this.vlanId = vlanId;
+ }
+
+ /**
+ * Get the VLAN ID.
+ *
+ * @return the VLAN ID.
+ */
+ @JsonProperty("vlanId")
+ public short vlanId() {
+ return this.vlanId;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "vlanId=" + this.vlanId;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("vlanId=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ vlanId = Short.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_VLAN_PCP: Set the 802.1q priority
+ */
+ public static class ActionSetVlanPriority {
+ private byte vlanPriority; // The VLAN priority to set
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetVlanPriority() {
+ this.vlanPriority = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetVlanPriority(ActionSetVlanPriority other) {
+ this.vlanPriority = other.vlanPriority;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetVlanPriority(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given VLAN priority.
+ *
+ * @param vlanPriority the VLAN priority to set.
+ */
+ public ActionSetVlanPriority(byte vlanPriority) {
+ this.vlanPriority = vlanPriority;
+ }
+
+ /**
+ * Get the VLAN priority.
+ *
+ * @return the VLAN priority.
+ */
+ @JsonProperty("vlanPriority")
+ public byte vlanPriority() {
+ return this.vlanPriority;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "vlanPriority=" + this.vlanPriority;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("vlanPriority=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ vlanPriority = Byte.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_STRIP_VLAN: Strip the 802.1q header
+ */
+ public static class ActionStripVlan {
+ private boolean stripVlan; // If true, strip the VLAN header
+
+ /**
+ * Default constructor.
+ */
+ public ActionStripVlan() {
+ this.stripVlan = false;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionStripVlan(ActionStripVlan other) {
+ this.stripVlan = other.stripVlan;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionStripVlan(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given boolean flag.
+ *
+ * @param stripVlan if true, strip the VLAN header.
+ */
+ public ActionStripVlan(boolean stripVlan) {
+ this.stripVlan = stripVlan;
+ }
+
+ /**
+ * Get the boolean flag whether the VLAN header should be stripped.
+ *
+ * @return the boolean flag whether the VLAN header should be stripped.
+ */
+ @JsonProperty("stripVlan")
+ public boolean stripVlan() {
+ return this.stripVlan;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "stripVlan=" + this.stripVlan;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("stripVlan=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ stripVlan = Boolean.valueOf(decode);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_DL_SRC and ACTION_SET_DL_DST:
+ * Set the Ethernet source/destination address.
+ */
+ public static class ActionSetEthernetAddr {
+ private MACAddress addr; // The MAC address to set
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetEthernetAddr() {
+ this.addr = null;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetEthernetAddr(ActionSetEthernetAddr other) {
+ if (other.addr != null)
+ this.addr = MACAddress.valueOf(other.addr.toLong());
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetEthernetAddr(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given MAC address.
+ *
+ * @param addr the MAC address to set.
+ */
+ public ActionSetEthernetAddr(MACAddress addr) {
+ this.addr = addr;
+ }
+
+ /**
+ * Get the MAC address.
+ *
+ * @return the MAC address.
+ */
+ @JsonProperty("addr")
+ public MACAddress addr() {
+ return this.addr;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "addr=" + addr.toString();
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("addr=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ addr = MACAddress.valueOf(decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_NW_SRC and ACTION_SET_NW_DST:
+ * Set the IPv4 source/destination address.
+ */
+ public static class ActionSetIPv4Addr {
+ private IPv4 addr; // The IPv4 address to set
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetIPv4Addr() {
+ this.addr = null;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetIPv4Addr(ActionSetIPv4Addr other) {
+ if (other.addr != null)
+ this.addr = new IPv4(other.addr);
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetIPv4Addr(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given IPv4 address.
+ *
+ * @param addr the IPv4 address to set.
+ */
+ public ActionSetIPv4Addr(IPv4 addr) {
+ this.addr = addr;
+ }
+
+ /**
+ * Get the IPv4 address.
+ *
+ * @return the IPv4 address.
+ */
+ @JsonProperty("addr")
+ public IPv4 addr() {
+ return this.addr;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "addr=" + addr.toString();
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("addr=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ addr = new IPv4(decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_NW_TOS:
+ * Set the IP ToS (DSCP field, 6 bits).
+ */
+ public static class ActionSetIpToS {
+ private byte ipToS; // The IP ToS to set DSCP field, 6 bits)
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetIpToS() {
+ this.ipToS = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetIpToS(ActionSetIpToS other) {
+ this.ipToS = other.ipToS;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetIpToS(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given IP ToS (DSCP field, 6 bits).
+ *
+ * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
+ */
+ public ActionSetIpToS(byte ipToS) {
+ this.ipToS = ipToS;
+ }
+
+ /**
+ * Get the IP ToS (DSCP field, 6 bits).
+ *
+ * @return the IP ToS (DSCP field, 6 bits).
+ */
+ @JsonProperty("ipToS")
+ public byte ipToS() {
+ return this.ipToS;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "ipToS=" + ipToS;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("ipToS=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ ipToS = Byte.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_SET_TP_SRC and ACTION_SET_TP_DST:
+ * Set the TCP/UDP source/destination port.
+ */
+ public static class ActionSetTcpUdpPort {
+ private short port; // The TCP/UDP port to set
+
+ /**
+ * Default constructor.
+ */
+ public ActionSetTcpUdpPort() {
+ this.port = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetTcpUdpPort(ActionSetTcpUdpPort other) {
+ this.port = other.port;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetTcpUdpPort(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given TCP/UDP port.
+ *
+ * @param port the TCP/UDP port to set.
+ */
+ public ActionSetTcpUdpPort(short port) {
+ this.port = port;
+ }
+
+ /**
+ * Get the TCP/UDP port.
+ *
+ * @return the TCP/UDP port.
+ */
+ @JsonProperty("port")
+ public short port() {
+ return this.port;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("port=");
+ String decode = null;
+
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ port = Short.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ /**
+ * Action structure for ACTION_ENQUEUE: Output to queue on port.
+ */
+ public static class ActionEnqueue {
+ private Port port; // Port that queue belongs. Should
+ // refer to a valid physical port
+ // (i.e. < PORT_MAX) or PORT_IN_PORT
+ private int queueId; // Where to enqueue the packets
+
+ /**
+ * Default constructor.
+ */
+ public ActionEnqueue() {
+ this.port = null;
+ this.queueId = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionEnqueue(ActionEnqueue other) {
+ if (other.port != null)
+ this.port = new Port(other.port);
+ this.queueId = other.queueId;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionEnqueue(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Constructor for a given port and queue ID.
+ *
+ * @param port the port to set.
+ * @param queueId the queue ID on the port.
+ */
+ public ActionEnqueue(Port port, int queueId) {
+ this.port = port;
+ this.queueId = queueId;
+ }
+
+ /**
+ * Get the port.
+ *
+ * @return the port.
+ */
+ @JsonProperty("port")
+ public Port port() {
+ return this.port;
+ }
+
+ /**
+ * Get the queue ID.
+ *
+ * @return the queue ID.
+ */
+ @JsonProperty("queueId")
+ public int queueId() {
+ return this.queueId;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port.toString();
+ ret += " queueId=" + queueId;
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split(" ");
+ String decode = null;
+
+ // Decode the "port=XXX" part
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ String[] tokens = decode.split("port=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ Short valueShort = Short.valueOf(tokens[1]);
+ port = new Port(valueShort);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+
+ // Decode the "queueId=XXX" part
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ String[] tokens = decode.split("queueId=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ queueId = Short.valueOf(tokens[1]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ }
+
+ private ActionValues actionType; // The action type
+
+ //
+ // The actions.
+ // NOTE: Only one action should be set.
+ //
+ private ActionOutput actionOutput;
+ private ActionSetVlanId actionSetVlanId;
+ private ActionSetVlanPriority actionSetVlanPriority;
+ private ActionStripVlan actionStripVlan;
+ private ActionSetEthernetAddr actionSetEthernetSrcAddr;
+ private ActionSetEthernetAddr actionSetEthernetDstAddr;
+ private ActionSetIPv4Addr actionSetIPv4SrcAddr;
+ private ActionSetIPv4Addr actionSetIPv4DstAddr;
+ private ActionSetIpToS actionSetIpToS;
+ private ActionSetTcpUdpPort actionSetTcpUdpSrcPort;
+ private ActionSetTcpUdpPort actionSetTcpUdpDstPort;
+ private ActionEnqueue actionEnqueue;
+
+ /**
+ * Default constructor.
+ */
+ public FlowEntryAction() {
+ actionType = ActionValues.ACTION_VENDOR; // XXX: Initial value
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public FlowEntryAction(FlowEntryAction other) {
+ this.actionType = other.actionType;
+
+ //
+ if (other.actionOutput != null)
+ this.actionOutput = new ActionOutput(other.actionOutput);
+ else
+ this.actionOutput = null;
+ //
+ if (other.actionSetVlanId != null)
+ this.actionSetVlanId = new ActionSetVlanId(other.actionSetVlanId);
+ else
+ this.actionSetVlanId = null;
+ //
+ if (other.actionSetVlanPriority != null)
+ this.actionSetVlanPriority = new ActionSetVlanPriority(other.actionSetVlanPriority);
+ else
+ this.actionSetVlanPriority = null;
+ //
+ if (other.actionStripVlan != null)
+ this.actionStripVlan = new ActionStripVlan(other.actionStripVlan);
+ else
+ this.actionStripVlan = null;
+ //
+ if (other.actionSetEthernetSrcAddr != null)
+ this.actionSetEthernetSrcAddr = new ActionSetEthernetAddr(other.actionSetEthernetSrcAddr);
+ else
+ this.actionSetEthernetSrcAddr = null;
+ //
+ if (other.actionSetEthernetDstAddr != null)
+ this.actionSetEthernetDstAddr = new ActionSetEthernetAddr(other.actionSetEthernetDstAddr);
+ else
+ this.actionSetEthernetDstAddr = null;
+ //
+ if (other.actionSetIPv4SrcAddr != null)
+ this.actionSetIPv4SrcAddr = new ActionSetIPv4Addr(other.actionSetIPv4SrcAddr);
+ else
+ this.actionSetIPv4SrcAddr = null;
+ //
+ if (other.actionSetIPv4DstAddr != null)
+ this.actionSetIPv4DstAddr = new ActionSetIPv4Addr(other.actionSetIPv4DstAddr);
+ else
+ this.actionSetIPv4DstAddr = null;
+ //
+ if (other.actionSetIpToS != null)
+ this.actionSetIpToS = new ActionSetIpToS(other.actionSetIpToS);
+ else
+ this.actionSetIpToS = null;
+ //
+ if (other.actionSetTcpUdpSrcPort != null)
+ this.actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpSrcPort);
+ else
+ this.actionSetTcpUdpSrcPort = null;
+ //
+ if (other.actionSetTcpUdpDstPort != null)
+ this.actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpDstPort);
+ else
+ this.actionSetTcpUdpDstPort = null;
+ //
+ if (other.actionEnqueue != null)
+ this.actionEnqueue = new ActionEnqueue(other.actionEnqueue);
+ else
+ this.actionEnqueue = null;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [type=XXX action=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public FlowEntryAction(String actionStr) {
+ this.fromString(actionStr);
+ }
+
+ /**
+ * Get the action type.
+ *
+ * @return the action type.
+ */
+ @JsonProperty("actionType")
+ public ActionValues actionType() { return actionType; }
+
+ /**
+ * Get the output action.
+ *
+ * @return the output action.
+ */
+ @JsonProperty("actionOutput")
+ public ActionOutput actionOutput() { return actionOutput; }
+
+ /**
+ * Set the output action on a port.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionOutput")
+ public void setActionOutput(ActionOutput action) {
+ actionOutput = action;
+ actionType = ActionValues.ACTION_OUTPUT;
+ }
+
+ /**
+ * Set the output action on a port.
+ *
+ * @param port the output port to set.
+ */
+ public void setActionOutput(Port port) {
+ actionOutput = new ActionOutput(port);
+ actionType = ActionValues.ACTION_OUTPUT;
+ }
+
+ /**
+ * Set the output action to controller.
+ *
+ * @param maxLen the maximum length (in bytes) to send to controller.
+ */
+ public void setActionOutputToController(short maxLen) {
+ Port port = new Port(Port.PortValues.PORT_CONTROLLER);
+ actionOutput = new ActionOutput(port, maxLen);
+ actionType = ActionValues.ACTION_OUTPUT;
+ }
+
+ /**
+ * Get the action to set the VLAN ID.
+ *
+ * @return the action to set the VLAN ID.
+ */
+ @JsonProperty("actionSetVlanId")
+ public ActionSetVlanId actionSetVlanId() { return actionSetVlanId; }
+
+ /**
+ * Set the action to set the VLAN ID.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetVlanId")
+ public void setActionSetVlanId(ActionSetVlanId action) {
+ actionSetVlanId = action;
+ actionType = ActionValues.ACTION_SET_VLAN_VID;
+ }
+
+ /**
+ * Set the action to set the VLAN ID.
+ *
+ * @param vlanId the VLAN ID to set.
+ */
+ public void setActionSetVlanId(short vlanId) {
+ actionSetVlanId = new ActionSetVlanId(vlanId);
+ actionType = ActionValues.ACTION_SET_VLAN_VID;
+ }
+
+ /**
+ * Get the action to set the VLAN priority.
+ *
+ * @return the action to set the VLAN priority.
+ */
+ @JsonProperty("actionSetVlanPriority")
+ public ActionSetVlanPriority actionSetVlanPriority() {
+ return actionSetVlanPriority;
+ }
+
+ /**
+ * Set the action to set the VLAN priority.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetVlanPriority")
+ public void setActionSetVlanPriority(ActionSetVlanPriority action) {
+ actionSetVlanPriority = action;
+ actionType = ActionValues.ACTION_SET_VLAN_PCP;
+ }
+
+ /**
+ * Set the action to set the VLAN priority.
+ *
+ * @param vlanPriority the VLAN priority to set.
+ */
+ public void setActionSetVlanPriority(byte vlanPriority) {
+ actionSetVlanPriority = new ActionSetVlanPriority(vlanPriority);
+ actionType = ActionValues.ACTION_SET_VLAN_PCP;
+ }
+
+ /**
+ * Get the action to strip the VLAN header.
+ *
+ * @return the action to strip the VLAN header.
+ */
+ @JsonProperty("actionStripVlan")
+ public ActionStripVlan actionStripVlan() {
+ return actionStripVlan;
+ }
+
+ /**
+ * Set the action to strip the VLAN header.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionStripVlan")
+ public void setActionStripVlan(ActionStripVlan action) {
+ actionStripVlan = action;
+ actionType = ActionValues.ACTION_STRIP_VLAN;
+ }
+
+ /**
+ * Set the action to strip the VLAN header.
+ *
+ * @param stripVlan if true, strip the VLAN header.
+ */
+ public void setActionStripVlan(boolean stripVlan) {
+ actionStripVlan = new ActionStripVlan(stripVlan);
+ actionType = ActionValues.ACTION_STRIP_VLAN;
+ }
+
+ /**
+ * Get the action to set the Ethernet source address.
+ *
+ * @return the action to set the Ethernet source address.
+ */
+ @JsonProperty("actionSetEthernetSrcAddr")
+ public ActionSetEthernetAddr actionSetEthernetSrcAddr() {
+ return actionSetEthernetSrcAddr;
+ }
+
+ /**
+ * Set the action to set the Ethernet source address.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetEthernetSrcAddr")
+ public void setActionSetEthernetSrcAddr(ActionSetEthernetAddr action) {
+ actionSetEthernetSrcAddr = action;
+ actionType = ActionValues.ACTION_SET_DL_SRC;
+ }
+
+ /**
+ * Set the action to set the Ethernet source address.
+ *
+ * @param addr the MAC address to set as the Ethernet source address.
+ */
+ public void setActionSetEthernetSrcAddr(MACAddress addr) {
+ actionSetEthernetSrcAddr = new ActionSetEthernetAddr(addr);
+ actionType = ActionValues.ACTION_SET_DL_SRC;
+ }
+
+ /**
+ * Get the action to set the Ethernet destination address.
+ *
+ * @return the action to set the Ethernet destination address.
+ */
+ @JsonProperty("actionSetEthernetDstAddr")
+ public ActionSetEthernetAddr actionSetEthernetDstAddr() {
+ return actionSetEthernetDstAddr;
+ }
+
+ /**
+ * Set the action to set the Ethernet destination address.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetEthernetDstAddr")
+ public void setActionSetEthernetDstAddr(ActionSetEthernetAddr action) {
+ actionSetEthernetDstAddr = action;
+ actionType = ActionValues.ACTION_SET_DL_DST;
+ }
+
+ /**
+ * Set the action to set the Ethernet destination address.
+ *
+ * @param addr the MAC address to set as the Ethernet destination address.
+ */
+ public void setActionSetEthernetDstAddr(MACAddress addr) {
+ actionSetEthernetDstAddr = new ActionSetEthernetAddr(addr);
+ actionType = ActionValues.ACTION_SET_DL_DST;
+ }
+
+ /**
+ * Get the action to set the IPv4 source address.
+ *
+ * @return the action to set the IPv4 source address.
+ */
+ @JsonProperty("actionSetIPv4SrcAddr")
+ public ActionSetIPv4Addr actionSetIPv4SrcAddr() {
+ return actionSetIPv4SrcAddr;
+ }
+
+ /**
+ * Set the action to set the IPv4 source address.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetIPv4SrcAddr")
+ public void setActionSetIPv4SrcAddr(ActionSetIPv4Addr action) {
+ actionSetIPv4SrcAddr = action;
+ actionType = ActionValues.ACTION_SET_NW_SRC;
+ }
+
+ /**
+ * Set the action to set the IPv4 source address.
+ *
+ * @param addr the IPv4 address to set as the IPv4 source address.
+ */
+ public void setActionSetIPv4SrcAddr(IPv4 addr) {
+ actionSetIPv4SrcAddr = new ActionSetIPv4Addr(addr);
+ actionType = ActionValues.ACTION_SET_NW_SRC;
+ }
+
+ /**
+ * Get the action to set the IPv4 destination address.
+ *
+ * @return the action to set the IPv4 destination address.
+ */
+ @JsonProperty("actionSetIPv4DstAddr")
+ public ActionSetIPv4Addr actionSetIPv4DstAddr() {
+ return actionSetIPv4DstAddr;
+ }
+
+ /**
+ * Set the action to set the IPv4 destination address.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetIPv4DstAddr")
+ public void setActionSetIPv4DstAddr(ActionSetIPv4Addr action) {
+ actionSetIPv4DstAddr = action;
+ actionType = ActionValues.ACTION_SET_NW_DST;
+ }
+
+ /**
+ * Set the action to set the IPv4 destination address.
+ *
+ * @param addr the IPv4 address to set as the IPv4 destination address.
+ */
+ public void setActionSetIPv4DstAddr(IPv4 addr) {
+ actionSetIPv4DstAddr = new ActionSetIPv4Addr(addr);
+ actionType = ActionValues.ACTION_SET_NW_DST;
+ }
+
+ /**
+ * Get the action to set the IP ToS (DSCP field, 6 bits).
+ *
+ * @return the action to set the IP ToS (DSCP field, 6 bits).
+ */
+ @JsonProperty("actionSetIpToS")
+ public ActionSetIpToS actionSetIpToS() {
+ return actionSetIpToS;
+ }
+
+ /**
+ * Set the action to set the IP ToS (DSCP field, 6 bits).
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetIpToS")
+ public void setActionSetIpToS(ActionSetIpToS action) {
+ actionSetIpToS = action;
+ actionType = ActionValues.ACTION_SET_NW_TOS;
+ }
+
+ /**
+ * Set the action to set the IP ToS (DSCP field, 6 bits).
+ *
+ * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
+ */
+ public void setActionSetIpToS(byte ipToS) {
+ actionSetIpToS = new ActionSetIpToS(ipToS);
+ actionType = ActionValues.ACTION_SET_NW_TOS;
+ }
+
+ /**
+ * Get the action to set the TCP/UDP source port.
+ *
+ * @return the action to set the TCP/UDP source port.
+ */
+ @JsonProperty("actionSetTcpUdpSrcPort")
+ public ActionSetTcpUdpPort actionSetTcpUdpSrcPort() {
+ return actionSetTcpUdpSrcPort;
+ }
+
+ /**
+ * Set the action to set the TCP/UDP source port.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetTcpUdpSrcPort")
+ public void setActionSetTcpUdpSrcPort(ActionSetTcpUdpPort action) {
+ actionSetTcpUdpSrcPort = action;
+ actionType = ActionValues.ACTION_SET_TP_SRC;
+ }
+
+ /**
+ * Set the action to set the TCP/UDP source port.
+ *
+ * @param port the TCP/UDP port to set as the TCP/UDP source port.
+ */
+ public void setActionSetTcpUdpSrcPort(short port) {
+ actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(port);
+ actionType = ActionValues.ACTION_SET_TP_SRC;
+ }
+
+ /**
+ * Get the action to set the TCP/UDP destination port.
+ *
+ * @return the action to set the TCP/UDP destination port.
+ */
+ @JsonProperty("actionSetTcpUdpDstPort")
+ public ActionSetTcpUdpPort actionSetTcpUdpDstPort() {
+ return actionSetTcpUdpDstPort;
+ }
+
+ /**
+ * Set the action to set the TCP/UDP destination port.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionSetTcpUdpDstPort")
+ public void setActionSetTcpUdpDstPort(ActionSetTcpUdpPort action) {
+ actionSetTcpUdpDstPort = action;
+ actionType = ActionValues.ACTION_SET_TP_DST;
+ }
+
+ /**
+ * Set the action to set the TCP/UDP destination port.
+ *
+ * @param port the TCP/UDP port to set as the TCP/UDP destination port.
+ */
+ public void setActionSetTcpUdpDstPort(short port) {
+ actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(port);
+ actionType = ActionValues.ACTION_SET_TP_DST;
+ }
+
+ /**
+ * Get the action to output to queue on a port.
+ *
+ * @return the action to output to queue on a port.
+ */
+ @JsonProperty("actionEnqueue")
+ public ActionEnqueue actionEnqueue() { return actionEnqueue; }
+
+ /**
+ * Set the action to output to queue on a port.
+ *
+ * @param action the action to set.
+ */
+ @JsonProperty("actionEnqueue")
+ public void setActionEnqueue(ActionEnqueue action) {
+ actionEnqueue = action;
+ actionType = ActionValues.ACTION_ENQUEUE;
+ }
+
+ /**
+ * Set the action to output to queue on a port.
+ *
+ * @param port the port to set.
+ * @param queueId the queue ID to set.
+ */
+ public void setActionEnqueue(Port port, int queueId) {
+ actionEnqueue = new ActionEnqueue(port, queueId);
+ actionType = ActionValues.ACTION_ENQUEUE;
+ }
+
+ /**
+ * Convert the action to a string.
+ *
+ * The string has the following form:
+ * [type=XXX action=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "type=" + actionType;
+ switch (actionType) {
+ case ACTION_OUTPUT:
+ ret += " action=" + actionOutput.toString();
+ break;
+ case ACTION_SET_VLAN_VID:
+ ret += " action=" + actionSetVlanId.toString();
+ break;
+ case ACTION_SET_VLAN_PCP:
+ ret += " action=" + actionSetVlanPriority.toString();
+ break;
+ case ACTION_STRIP_VLAN:
+ ret += " action=" + actionStripVlan.toString();
+ break;
+ case ACTION_SET_DL_SRC:
+ ret += " action=" + actionSetEthernetSrcAddr.toString();
+ break;
+ case ACTION_SET_DL_DST:
+ ret += " action=" + actionSetEthernetDstAddr.toString();
+ break;
+ case ACTION_SET_NW_SRC:
+ ret += " action=" + actionSetIPv4SrcAddr.toString();
+ break;
+ case ACTION_SET_NW_DST:
+ ret += " action=" + actionSetIPv4DstAddr.toString();
+ break;
+ case ACTION_SET_NW_TOS:
+ ret += " action=" + actionSetIpToS.toString();
+ break;
+ case ACTION_SET_TP_SRC:
+ ret += " action=" + actionSetTcpUdpSrcPort.toString();
+ break;
+ case ACTION_SET_TP_DST:
+ ret += " action=" + actionSetTcpUdpDstPort.toString();
+ break;
+ case ACTION_ENQUEUE:
+ ret += " action=" + actionEnqueue.toString();
+ break;
+ }
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to an action.
+ *
+ * The string has the following form:
+ * [type=XXX action=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("type=");
+ String decode = null;
+
+ // Extract the string after the "type="
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode == null)
+ throw new IllegalArgumentException("Invalid action string");
+
+ // Remove the trailing ']'
+ if ((decode.length() > 0) && (decode.charAt(decode.length() - 1) == ']')) {
+ decode = decode.substring(0, decode.length() - 1);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+
+ // Extract the type value and the action value
+ parts = decode.split(" action=");
+
+ // Decode the "type=XXX" payload
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ try {
+ actionType = Enum.valueOf(ActionValues.class, decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+
+ // Decode the "action=XXX" payload
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode == null)
+ throw new IllegalArgumentException("Invalid action string");
+ //
+ try {
+ switch (actionType) {
+ case ACTION_OUTPUT:
+ actionOutput = new ActionOutput(decode);
+ break;
+ case ACTION_SET_VLAN_VID:
+ actionSetVlanId = new ActionSetVlanId(decode);
+ break;
+ case ACTION_SET_VLAN_PCP:
+ actionSetVlanPriority = new ActionSetVlanPriority(decode);
+ break;
+ case ACTION_STRIP_VLAN:
+ actionStripVlan = new ActionStripVlan(decode);
+ break;
+ case ACTION_SET_DL_SRC:
+ actionSetEthernetSrcAddr = new ActionSetEthernetAddr(decode);
+ break;
+ case ACTION_SET_DL_DST:
+ actionSetEthernetDstAddr = new ActionSetEthernetAddr(decode);
+ break;
+ case ACTION_SET_NW_SRC:
+ actionSetIPv4SrcAddr = new ActionSetIPv4Addr(decode);
+ break;
+ case ACTION_SET_NW_DST:
+ actionSetIPv4DstAddr = new ActionSetIPv4Addr(decode);
+ break;
+ case ACTION_SET_NW_TOS:
+ actionSetIpToS = new ActionSetIpToS(decode);
+ break;
+ case ACTION_SET_TP_SRC:
+ actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(decode);
+ break;
+ case ACTION_SET_TP_DST:
+ actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(decode);
+ break;
+ case ACTION_ENQUEUE:
+ actionEnqueue = new ActionEnqueue(decode);
+ break;
+ }
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryActions.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryActions.java
new file mode 100644
index 0000000..7d9688b
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryActions.java
@@ -0,0 +1,148 @@
+package net.onrc.onos.ofcontroller.util;
+
+import java.util.ArrayList;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing multiple Flow Entry actions.
+ *
+ * A set of Flow Entry actions need to be applied to each packet.
+ */
+public class FlowEntryActions {
+ private ArrayList<FlowEntryAction> actions; // The Flow Entry Actions
+
+ /**
+ * Default constructor.
+ */
+ public FlowEntryActions() {
+ actions = new ArrayList<FlowEntryAction>();
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * The string has the following form:
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ *
+ * @param actionsStr the set of actions as a string.
+ */
+ public FlowEntryActions(String actionsStr) {
+ this.fromString(actionsStr);
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public FlowEntryActions(FlowEntryActions other) {
+ actions = new ArrayList<FlowEntryAction>();
+
+ for (FlowEntryAction action : other.actions) {
+ FlowEntryAction newAction = new FlowEntryAction(action);
+ actions.add(newAction);
+ }
+ }
+
+ /**
+ * Get the Flow Entry Actions.
+ *
+ * @return the Flow Entry Actions.
+ */
+ @JsonProperty("actions")
+ public ArrayList<FlowEntryAction> actions() {
+ return actions;
+ }
+
+ /**
+ * Set the Flow Entry Actions.
+ *
+ * @param actions the Flow Entry Actions to set.
+ */
+ @JsonProperty("actions")
+ public void setActions(ArrayList<FlowEntryAction> actions) {
+ this.actions = actions;
+ }
+
+ /**
+ * Add a Flow Entry Action.
+ *
+ * @param flowEntryAction the Flow Entry Action to add.
+ */
+ public void addAction(FlowEntryAction flowEntryAction) {
+ actions.add(flowEntryAction);
+ }
+
+ /**
+ * Test whether the set of actions is empty.
+ *
+ * @return true if the set of actions is empty, otherwise false.
+ */
+ @JsonIgnore
+ public Boolean isEmpty() {
+ return actions.isEmpty();
+ }
+
+ /**
+ * Convert the set of actions to a string.
+ *
+ * The string has the following form:
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ *
+ * @return the set of actions as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ for (FlowEntryAction action : actions) {
+ ret += action.toString() + ";";
+ }
+ ret += "]";
+
+ return ret;
+ }
+
+ /**
+ * Convert a string to a set of actions.
+ *
+ * The string has the following form:
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ *
+ * @param actionsStr the set of actions as a string.
+ */
+ public void fromString(String actionsStr) {
+ String decode = actionsStr;
+
+ actions = new ArrayList<FlowEntryAction>();
+
+ if (decode.isEmpty())
+ return; // Nothing to do
+
+ // Remove the '[' and ']' in the beginning and the end of the string
+ if ((decode.length() > 1) && (decode.charAt(0) == '[') &&
+ (decode.charAt(decode.length() - 1) == ']')) {
+ decode = decode.substring(1, decode.length() - 1);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+
+ // Split the string, and decode each action
+ String[] parts = decode.split(";");
+ for (int i = 0; i < parts.length; i++) {
+ decode = parts[i];
+ if ((decode == null) || decode.isEmpty())
+ continue;
+ FlowEntryAction flowEntryAction = null;
+ try {
+ flowEntryAction = new FlowEntryAction(decode);
+ } catch (IllegalArgumentException e) {
+ // TODO: Ignore invalid actions for now
+ continue;
+ }
+ if (flowEntryAction != null)
+ actions.add(flowEntryAction);
+ }
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryErrorState.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryErrorState.java
index bf1708d..2e8c448 100644
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryErrorState.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
new file mode 100644
index 0000000..f5728b0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
@@ -0,0 +1,113 @@
+package net.onrc.onos.ofcontroller.util;
+
+import java.math.BigInteger;
+
+import net.onrc.onos.ofcontroller.util.serializers.FlowEntryIdDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.FlowEntryIdSerializer;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * The class representing a Flow Entry ID.
+ */
+@JsonDeserialize(using=FlowEntryIdDeserializer.class)
+@JsonSerialize(using=FlowEntryIdSerializer.class)
+public class FlowEntryId {
+ private long value;
+
+ /**
+ * Default constructor.
+ */
+ public FlowEntryId() {
+ this.value = -1;
+ }
+
+ /**
+ * Constructor from an integer value.
+ *
+ * @param value the value to use.
+ */
+ public FlowEntryId(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * @param value the value to use.
+ */
+ public FlowEntryId(String value) {
+ //
+ // Use the help of BigInteger to parse strings representing
+ // large unsigned hex long values.
+ //
+ char c = 0;
+ if (value.length() > 2)
+ c = value.charAt(1);
+ if ((c == 'x') || (c == 'X'))
+ this.value = new BigInteger(value.substring(2), 16).longValue();
+ else
+ this.value = Long.decode(value);
+ }
+
+ /**
+ * Get the value of the Flow Entry ID.
+ *
+ * @return the value of the Flow Entry ID.
+ */
+ public long value() { return value; }
+
+ /**
+ * Set the value of the Flow Entry ID.
+ *
+ * @param value the value to set.
+ */
+ public void setValue(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Test whether the Flow Entry ID is valid.
+ *
+ * @return true if the Flow Entry ID is valid, otherwise false.
+ */
+ @JsonIgnore
+ public boolean isValid() {
+ return (this.value() != -1);
+ }
+
+ /**
+ * Returns true of the object is another Flow Entry ID with
+ * the same value; otherwise, returns false.
+ *
+ * @param Object to compare
+ */
+ @Override
+ public boolean equals(Object obj){
+ if(obj.getClass() == this.getClass()) {
+ FlowEntryId entry = (FlowEntryId) obj;
+ return this.value() == entry.value();
+ }
+ return false;
+ }
+
+ /**
+ * Return the hash code of the Flow Entry ID
+ */
+ @Override
+ public int hashCode() {
+ return Long.valueOf(value).hashCode();
+ }
+
+ /**
+ * Convert the Flow Entry ID value to a hexadecimal string.
+ *
+ * @return the Flow Entry ID value to a hexadecimal string.
+ */
+ @Override
+ public String toString() {
+ return "0x" + Long.toHexString(this.value);
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
new file mode 100644
index 0000000..a2ac748
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
@@ -0,0 +1,711 @@
+package net.onrc.onos.ofcontroller.util;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing the Flow Entry Matching filter.
+ *
+ * The Flow Entry matching filter that is used to specify
+ * the network data that would be forwarded on the data path from
+ * the source to the destination. Examples: source or destination MAC address,
+ * IP prefix that includes the destination's IP address, etc.
+ */
+public class FlowEntryMatch {
+ /**
+ * A class for storing a value to match.
+ */
+ public static class Field<T> {
+ /**
+ * Default constructor.
+ */
+ public Field() {
+ this.enabled = false;
+ }
+
+ /**
+ * Constructor for a given value to match.
+ *
+ * @param value the value to match.
+ */
+ public Field(T value) {
+ this.value = value;
+ this.enabled = true;
+ }
+
+ /**
+ * Get the value.
+ *
+ * @return the value.
+ */
+ public T value() { return this.value; }
+
+ /**
+ * Enable the matching for a given value.
+ *
+ * @param value the value to set.
+ */
+ public void enableMatch(T value) {
+ this.value = value;
+ this.enabled = true;
+ }
+
+ /**
+ * Disable the matching.
+ */
+ public void disableMatch() {
+ this.enabled = false;
+ }
+
+ /**
+ * Test whether matching is enabled.
+ *
+ * @return true if matching is enabled, otherwise false.
+ */
+ public boolean enabled() { return this.enabled; }
+
+ private T value; // The value to match
+ private boolean enabled; // Set to true, if matching is enabled
+ }
+
+ private Field<Port> inPort; // Matching input switch port
+ private Field<MACAddress> srcMac; // Matching source MAC address
+ private Field<MACAddress> dstMac; // Matching destination MAC address
+ private Field<Short> ethernetFrameType; // Matching Ethernet frame type
+ private Field<Short> vlanId; // Matching VLAN ID
+ private Field<Byte> vlanPriority; // Matching VLAN priority
+ private Field<IPv4Net> srcIPv4Net; // Matching source IPv4 prefix
+ private Field<IPv4Net> dstIPv4Net; // Matching destination IPv4 prefix
+ private Field<Byte> ipProto; // Matching IP protocol
+ private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits)
+ private Field<Short> srcTcpUdpPort; // Matching source TCP/UDP port
+ private Field<Short> dstTcpUdpPort; // Matching destination TCP/UDP port
+
+ /**
+ * Default constructor.
+ */
+ public FlowEntryMatch() {
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public FlowEntryMatch(FlowEntryMatch other) {
+ if ((other.inPort != null) && other.inPort.enabled())
+ this.enableInPort(other.inPort.value());
+ if ((other.srcMac != null) && other.srcMac.enabled())
+ this.enableSrcMac(other.srcMac.value());
+ if ((other.dstMac != null) && other.dstMac.enabled())
+ this.enableDstMac(other.dstMac.value());
+ if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
+ this.enableEthernetFrameType(other.ethernetFrameType.value());
+ if ((other.vlanId != null) && other.vlanId.enabled())
+ this.enableVlanId(other.vlanId.value());
+ if ((other.vlanPriority != null) && other.vlanPriority.enabled())
+ this.enableVlanPriority(other.vlanPriority.value());
+ if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled())
+ this.enableSrcIPv4Net(other.srcIPv4Net.value());
+ if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled())
+ this.enableDstIPv4Net(other.dstIPv4Net.value());
+ if ((other.ipProto != null) && other.ipProto.enabled())
+ this.enableIpProto(other.ipProto.value());
+ if ((other.ipToS != null) && other.ipToS.enabled())
+ this.enableIpToS(other.ipToS.value());
+ if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled())
+ this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
+ if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled())
+ this.enableDstTcpUdpPort(other.dstTcpUdpPort.value());
+ }
+
+ /**
+ * Get the matching input switch port.
+ *
+ * @return the matching input switch port.
+ */
+ @JsonProperty("inPort")
+ public Port inPort() {
+ if (inPort != null)
+ return inPort.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on input switch port.
+ *
+ * @param inPort the input switch port value to enable for matching.
+ */
+ @JsonProperty("inPort")
+ public void enableInPort(Port inPort) {
+ this.inPort = new Field<Port>(inPort);
+ }
+
+ /**
+ * Disable the matching on input switch port.
+ */
+ public void disableInPort() {
+ this.inPort = null;
+ }
+
+ /**
+ * Test if matching on input switch port is enabled.
+ *
+ * @return true if matching on input switch port is enabled.
+ */
+ @JsonProperty("matchInPort")
+ public boolean matchInPort() {
+ if (inPort != null)
+ return inPort.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching source MAC address.
+ *
+ * @return the matching source MAC address.
+ */
+ @JsonProperty("srcMac")
+ public MACAddress srcMac() {
+ if (srcMac != null)
+ return srcMac.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on source MAC address.
+ *
+ * @param srcMac the source MAC address value to enable for matching.
+ */
+ @JsonProperty("srcMac")
+ public void enableSrcMac(MACAddress srcMac) {
+ this.srcMac = new Field<MACAddress>(srcMac);
+ }
+
+ /**
+ * Disable the matching on source MAC address.
+ */
+ public void disableSrcMac() {
+ this.srcMac = null;
+ }
+
+ /**
+ * Test if matching on source MAC address is enabled.
+ *
+ * @return true if matching on source MAC address is enabled.
+ */
+ @JsonProperty("matchSrcMac")
+ public boolean matchSrcMac() {
+ if (srcMac != null)
+ return srcMac.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching destination MAC address.
+ *
+ * @return the matching destination MAC address.
+ */
+ @JsonProperty("dstMac")
+ public MACAddress dstMac() {
+ if (dstMac != null)
+ return dstMac.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on destination MAC address.
+ *
+ * @param dstMac the destination MAC address value to enable for matching.
+ */
+ @JsonProperty("dstMac")
+ public void enableDstMac(MACAddress dstMac) {
+ this.dstMac = new Field<MACAddress>(dstMac);
+ }
+
+ /**
+ * Disable the matching on destination MAC address.
+ */
+ public void disableDstMac() {
+ this.dstMac = null;
+ }
+
+ /**
+ * Test if matching on destination MAC address is enabled.
+ *
+ * @return true if matching on destination MAC address is enabled.
+ */
+ @JsonProperty("matchDstMac")
+ public boolean matchDstMac() {
+ if (dstMac != null)
+ return dstMac.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching Ethernet frame type.
+ *
+ * @return the matching Ethernet frame type.
+ */
+ @JsonProperty("ethernetFrameType")
+ public Short ethernetFrameType() {
+ if (ethernetFrameType != null)
+ return ethernetFrameType.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on Ethernet frame type.
+ *
+ * @param ethernetFrameType the Ethernet frame type value to enable for
+ * matching.
+ */
+ @JsonProperty("ethernetFrameType")
+ public void enableEthernetFrameType(Short ethernetFrameType) {
+ this.ethernetFrameType = new Field<Short>(ethernetFrameType);
+ }
+
+ /**
+ * Disable the matching on Ethernet frame type.
+ */
+ public void disableEthernetFrameType() {
+ this.ethernetFrameType = null;
+ }
+
+ /**
+ * Test if matching on Ethernet frame type is enabled.
+ *
+ * @return true if matching on Ethernet frame type is enabled.
+ */
+ @JsonProperty("matchEthernetFrameType")
+ public boolean matchEthernetFrameType() {
+ if (ethernetFrameType != null)
+ return ethernetFrameType.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching VLAN ID.
+ *
+ * @return the matching VLAN ID.
+ */
+ @JsonProperty("vlanId")
+ public Short vlanId() {
+ if (vlanId != null)
+ return vlanId.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on VLAN ID.
+ *
+ * @param vlanId the VLAN ID value to enable for matching.
+ */
+ @JsonProperty("vlanId")
+ public void enableVlanId(Short vlanId) {
+ this.vlanId = new Field<Short>(vlanId);
+ }
+
+ /**
+ * Disable the matching on VLAN ID.
+ */
+ public void disableVlanId() {
+ this.vlanId = null;
+ }
+
+ /**
+ * Test if matching on VLAN ID is enabled.
+ *
+ * @return true if matching on VLAN ID is enabled.
+ */
+ @JsonProperty("matchVlanId")
+ public boolean matchVlanId() {
+ if (vlanId != null)
+ return vlanId.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching VLAN priority.
+ *
+ * @return the matching VLAN priority.
+ */
+ @JsonProperty("vlanPriority")
+ public Byte vlanPriority() {
+ if (vlanPriority != null)
+ return vlanPriority.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on VLAN priority.
+ *
+ * @param vlanPriority the VLAN priority value to enable for matching.
+ */
+ @JsonProperty("vlanPriority")
+ public void enableVlanPriority(Byte vlanPriority) {
+ this.vlanPriority = new Field<Byte>(vlanPriority);
+ }
+
+ /**
+ * Disable the matching on VLAN priority.
+ */
+ public void disableVlanPriority() {
+ this.vlanPriority = null;
+ }
+
+ /**
+ * Test if matching on VLAN priority is enabled.
+ *
+ * @return true if matching on VLAN priority is enabled.
+ */
+ @JsonProperty("matchVlanPriority")
+ public boolean matchVlanPriority() {
+ if (vlanPriority != null)
+ return vlanPriority.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching source IPv4 prefix.
+ *
+ * @return the matching source IPv4 prefix.
+ */
+ @JsonProperty("srcIPv4Net")
+ public IPv4Net srcIPv4Net() {
+ if (srcIPv4Net != null)
+ return srcIPv4Net.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on source IPv4 prefix.
+ *
+ * @param srcIPv4Net the source IPv4 prefix value to enable for matching.
+ */
+ @JsonProperty("srcIPv4Net")
+ public void enableSrcIPv4Net(IPv4Net srcIPv4Net) {
+ this.srcIPv4Net = new Field<IPv4Net>(srcIPv4Net);
+ }
+
+ /**
+ * Disable the matching on source IPv4 prefix.
+ */
+ public void disableSrcIPv4Net() {
+ this.srcIPv4Net = null;
+ }
+
+ /**
+ * Test if matching on source IPv4 prefix is enabled.
+ *
+ * @return true if matching on source IPv4 prefix is enabled.
+ */
+ @JsonProperty("matchSrcIPv4Net")
+ public boolean matchSrcIPv4Net() {
+ if (srcIPv4Net != null)
+ return srcIPv4Net.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching destination IPv4 prefix.
+ *
+ * @return the matching destination IPv4 prefix.
+ */
+ @JsonProperty("dstIPv4Net")
+ public IPv4Net dstIPv4Net() {
+ if (dstIPv4Net != null)
+ return dstIPv4Net.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on destination IPv4 prefix.
+ *
+ * @param dstIPv4Net the destination IPv4 prefix value to enable for
+ * matching.
+ */
+ @JsonProperty("dstIPv4Net")
+ public void enableDstIPv4Net(IPv4Net dstIPv4Net) {
+ this.dstIPv4Net = new Field<IPv4Net>(dstIPv4Net);
+ }
+
+ /**
+ * Disable the matching on destination IPv4 prefix.
+ */
+ public void disableDstIPv4Net() {
+ this.dstIPv4Net = null;
+ }
+
+ /**
+ * Test if matching on destination IPv4 prefix is enabled.
+ *
+ * @return true if matching on destination IPv4 prefix is enabled.
+ */
+ @JsonProperty("matchDstIPv4Net")
+ public boolean matchDstIPv4Net() {
+ if (dstIPv4Net != null)
+ return dstIPv4Net.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching IP protocol.
+ *
+ * @return the matching IP protocol.
+ */
+ @JsonProperty("ipProto")
+ public Byte ipProto() {
+ if (ipProto != null)
+ return ipProto.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on IP protocol.
+ *
+ * @param ipProto the IP protocol value to enable for matching.
+ */
+ @JsonProperty("ipProto")
+ public void enableIpProto(Byte ipProto) {
+ this.ipProto = new Field<Byte>(ipProto);
+ }
+
+ /**
+ * Disable the matching on IP protocol.
+ */
+ public void disableIpProto() {
+ this.ipProto = null;
+ }
+
+ /**
+ * Test if matching on IP protocol is enabled.
+ *
+ * @return true if matching on IP protocol is enabled.
+ */
+ @JsonProperty("matchIpProto")
+ public boolean matchIpProto() {
+ if (ipProto != null)
+ return ipProto.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching IP ToS (DSCP field, 6 bits)
+ *
+ * @return the matching IP ToS.
+ */
+ @JsonProperty("ipToS")
+ public Byte ipToS() {
+ if (ipToS != null)
+ return ipToS.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on IP ToS (DSCP field, 6 bits).
+ *
+ * @param ipToS the IP ToS value to enable for matching.
+ */
+ @JsonProperty("ipToS")
+ public void enableIpToS(Byte ipToS) {
+ this.ipToS = new Field<Byte>(ipToS);
+ }
+
+ /**
+ * Disable the matching on IP ToS (DSCP field, 6 bits).
+ */
+ public void disableIpToS() {
+ this.ipToS = null;
+ }
+
+ /**
+ * Test if matching on IP ToS (DSCP field, 6 bits) is enabled.
+ *
+ * @return true if matching on IP ToS is enabled.
+ */
+ @JsonProperty("matchIpToS")
+ public boolean matchIpToS() {
+ if (ipToS != null)
+ return ipToS.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching source TCP/UDP port.
+ *
+ * @return the matching source TCP/UDP port.
+ */
+ @JsonProperty("srcTcpUdpPort")
+ public Short srcTcpUdpPort() {
+ if (srcTcpUdpPort != null)
+ return srcTcpUdpPort.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on source TCP/UDP port.
+ *
+ * @param srcTcpUdpPort the source TCP/UDP port to enable for matching.
+ */
+ @JsonProperty("srcTcpUdpPort")
+ public void enableSrcTcpUdpPort(Short srcTcpUdpPort) {
+ this.srcTcpUdpPort = new Field<Short>(srcTcpUdpPort);
+ }
+
+ /**
+ * Disable the matching on source TCP/UDP port.
+ */
+ public void disableSrcTcpUdpPort() {
+ this.srcTcpUdpPort = null;
+ }
+
+ /**
+ * Test if matching on source TCP/UDP port is enabled.
+ *
+ * @return true if matching on source TCP/UDP port is enabled.
+ */
+ @JsonProperty("matchSrcTcpUdpPort")
+ public boolean matchSrcTcpUdpPort() {
+ if (srcTcpUdpPort != null)
+ return srcTcpUdpPort.enabled();
+ return false;
+ }
+
+ /**
+ * Get the matching destination TCP/UDP port.
+ *
+ * @return the matching destination TCP/UDP port.
+ */
+ @JsonProperty("dstTcpUdpPort")
+ public Short dstTcpUdpPort() {
+ if (dstTcpUdpPort != null)
+ return dstTcpUdpPort.value();
+ return null;
+ }
+
+ /**
+ * Enable the matching on destination TCP/UDP port.
+ *
+ * @param dstTcpUdpPort the destination TCP/UDP port to enable for
+ * matching.
+ */
+ @JsonProperty("dstTcpUdpPort")
+ public void enableDstTcpUdpPort(Short dstTcpUdpPort) {
+ this.dstTcpUdpPort = new Field<Short>(dstTcpUdpPort);
+ }
+
+ /**
+ * Disable the matching on destination TCP/UDP port.
+ */
+ public void disableDstTcpUdpPort() {
+ this.dstTcpUdpPort = null;
+ }
+
+ /**
+ * Test if matching on destination TCP/UDP port is enabled.
+ *
+ * @return true if matching on destination TCP/UDP port is enabled.
+ */
+ @JsonProperty("matchDstTcpUdpPort")
+ public boolean matchDstTcpUdpPort() {
+ if (dstTcpUdpPort != null)
+ return dstTcpUdpPort.enabled();
+ return false;
+ }
+
+ /**
+ * Convert the matching filter to a string.
+ *
+ * The string has the following form:
+ * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
+ *
+ * @return the matching filter as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ boolean addSpace = false;
+
+ //
+ // Conditionally add only those matching fields that are enabled
+ //
+ if (matchInPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "inPort=" + this.inPort().toString();
+ }
+ if (matchSrcMac()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcMac=" + this.srcMac().toString();
+ }
+ if (matchDstMac()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstMac=" + this.dstMac().toString();
+ }
+ if (matchEthernetFrameType()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
+ }
+ if (matchVlanId()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "vlanId=" + this.vlanId().toString();
+ }
+ if (matchVlanPriority()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "vlanPriority=" + this.vlanPriority().toString();
+ }
+ if (matchSrcIPv4Net()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcIPv4Net=" + this.srcIPv4Net().toString();
+ }
+ if (matchDstIPv4Net()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
+ }
+ if (matchIpProto()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ipProto=" + this.ipProto().toString();
+ }
+ if (matchIpToS()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ipToS=" + this.ipToS().toString();
+ }
+ if (matchSrcTcpUdpPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString();
+ }
+ if (matchDstTcpUdpPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString();
+ }
+
+ ret += "]";
+
+ return ret;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntrySwitchState.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntrySwitchState.java
new file mode 100644
index 0000000..44439f2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntrySwitchState.java
@@ -0,0 +1,12 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * The Flow Entry state as set by the controller.
+ */
+public enum FlowEntrySwitchState {
+ FE_SWITCH_UNKNOWN, // Initialization value: state unknown
+ FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
+ FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
+ FE_SWITCH_UPDATED, // Switch updated with this entry
+ FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryUserState.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryUserState.java
new file mode 100644
index 0000000..5ed8865
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryUserState.java
@@ -0,0 +1,11 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * The Flow Entry state as set by the user (via the ONOS API).
+ */
+public enum FlowEntryUserState {
+ FE_USER_UNKNOWN, // Initialization value: state unknown
+ FE_USER_ADD, // Flow entry that is added
+ FE_USER_MODIFY, // Flow entry that is modified
+ FE_USER_DELETE // Flow entry that is deleted
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java
new file mode 100644
index 0000000..d90e96f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java
@@ -0,0 +1,102 @@
+package net.onrc.onos.ofcontroller.util;
+
+import java.math.BigInteger;
+
+import net.onrc.onos.ofcontroller.util.serializers.FlowIdDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.FlowIdSerializer;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.map.annotate.JsonDeserialize;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * The class representing a Flow ID.
+ */
+@JsonDeserialize(using=FlowIdDeserializer.class)
+@JsonSerialize(using=FlowIdSerializer.class)
+public class FlowId implements Comparable<FlowId> {
+ private long value;
+
+ /**
+ * Default constructor.
+ */
+ public FlowId() {
+ this.value = -1;
+ }
+
+ /**
+ * Constructor from an integer value.
+ *
+ * @param value the value to use.
+ */
+ public FlowId(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * @param value the value to use.
+ */
+ public FlowId(String value) {
+ //
+ // Use the help of BigInteger to parse strings representing
+ // large unsigned hex long values.
+ //
+ char c = 0;
+ if (value.length() > 2)
+ c = value.charAt(1);
+ if ((c == 'x') || (c == 'X'))
+ this.value = new BigInteger(value.substring(2), 16).longValue();
+ else
+ this.value = Long.decode(value);
+ }
+
+ /**
+ * Get the value of the Flow ID.
+ *
+ * @return the value of the Flow ID.
+ */
+ public long value() { return value; }
+
+ /**
+ * Set the value of the Flow ID.
+ *
+ * @param value the value to set.
+ */
+ public void setValue(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Test whether the Flow ID is valid.
+ *
+ * @return true if the Flow ID is valid, otherwise false.
+ */
+ @JsonIgnore
+ public boolean isValid() {
+ return (this.value() != -1);
+ }
+
+ /**
+ * Convert the Flow ID value to a hexadecimal string.
+ *
+ * @return the Flow ID value to a hexadecimal string.
+ */
+ @Override
+ public String toString() {
+ return "0x" + Long.toHexString(this.value);
+ }
+
+ /**
+ * Compare two FlowId objects numerically using their Flow IDs.
+ *
+ * @return the value 0 if the Flow ID is equal to the argument's Flow ID;
+ * a value less than 0 if the Flow ID is numerically less than the argument's Flow ID;
+ * and a value greater than 0 if the Flow ID is numerically greater than the argument's Flow ID.
+ */
+ @Override
+ public int compareTo(FlowId o) {
+ return Long.valueOf(this.value).compareTo(o.value());
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
new file mode 100644
index 0000000..ab3edb1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -0,0 +1,398 @@
+package net.onrc.onos.ofcontroller.util;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing the Flow Path.
+ */
+public class FlowPath implements Comparable<FlowPath> {
+ private FlowId flowId; // The Flow ID
+ private CallerId installerId; // The Caller ID of the path installer
+ private FlowPathType flowPathType; // The Flow Path type
+ private FlowPathUserState flowPathUserState; // The Flow Path User state
+ private FlowPathFlags flowPathFlags; // The Flow Path flags
+ private DataPath dataPath; // The data path
+ private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
+ // Flow Entries
+ private FlowEntryActions flowEntryActions; // The Flow Entry Actions for
+ // the first Flow Entry
+
+ /**
+ * Default constructor.
+ */
+ public FlowPath() {
+ flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
+ flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN;
+ flowPathFlags = new FlowPathFlags();
+ dataPath = new DataPath();
+ flowEntryActions = new FlowEntryActions();
+ }
+
+ /**
+ * Constructor to instantiate from object in Network Map
+ */
+ public FlowPath(IFlowPath flowObj) {
+ dataPath = new DataPath();
+ this.setFlowId(new FlowId(flowObj.getFlowId()));
+ this.setInstallerId(new CallerId(flowObj.getInstallerId()));
+ this.setFlowPathType(FlowPathType.valueOf(flowObj.getFlowPathType()));
+ this.setFlowPathUserState(FlowPathUserState.valueOf(flowObj.getFlowPathUserState()));
+ this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags()));
+ this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
+ this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
+ this.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch()));
+ this.dataPath().dstPort().setPort(new Port(flowObj.getDstPort()));
+ //
+ // Extract the match conditions that are common for all Flow Entries
+ //
+ {
+ FlowEntryMatch match = new FlowEntryMatch();
+ String matchSrcMac = flowObj.getMatchSrcMac();
+ if (matchSrcMac != null)
+ match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
+ String matchDstMac = flowObj.getMatchDstMac();
+ if (matchDstMac != null)
+ match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+
+ this.setFlowEntryMatch(match);
+ }
+
+ //
+ // Extract the actions for the first Flow Entry
+ //
+ {
+ FlowEntryActions actions = new FlowEntryActions();
+
+ String actionsStr = flowObj.getActions();
+ if (actions != null)
+ actions = new FlowEntryActions(actionsStr);
+
+ this.setFlowEntryActions(actions);
+ }
+
+ //
+ // Extract all Flow Entries
+ //
+ Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
+ for (IFlowEntry flowEntryObj : flowEntries) {
+ FlowEntry flowEntry = new FlowEntry();
+ flowEntry.setFlowEntryId(new FlowEntryId(flowEntryObj.getFlowEntryId()));
+ flowEntry.setDpid(new Dpid(flowEntryObj.getSwitchDpid()));
+
+ //
+ // Extract the match conditions
+ //
+ FlowEntryMatch match = new FlowEntryMatch();
+ //
+ Short matchInPort = flowEntryObj.getMatchInPort();
+ if (matchInPort != null)
+ match.enableInPort(new Port(matchInPort));
+ //
+ String matchSrcMac = flowEntryObj.getMatchSrcMac();
+ if (matchSrcMac != null)
+ match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
+ //
+ String matchDstMac = flowEntryObj.getMatchDstMac();
+ if (matchDstMac != null)
+ match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ //
+ Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ //
+ Short matchVlanId = flowEntryObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ //
+ Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ //
+ String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ //
+ String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ //
+ Byte matchIpProto = flowEntryObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ //
+ Byte matchIpToS = flowEntryObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ //
+ Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ //
+ Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+ //
+ flowEntry.setFlowEntryMatch(match);
+
+ //
+ // Extract the actions
+ //
+ {
+ FlowEntryActions actions = new FlowEntryActions();
+
+ String actionsStr = flowEntryObj.getActions();
+ if (actions != null)
+ actions = new FlowEntryActions(actionsStr);
+
+ flowEntry.setFlowEntryActions(actions);
+ }
+
+ String userState = flowEntryObj.getUserState();
+ flowEntry.setFlowEntryUserState(FlowEntryUserState.valueOf(userState));
+ String switchState = flowEntryObj.getSwitchState();
+ flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.valueOf(switchState));
+ //
+ // TODO: Take care of the FlowEntryErrorState.
+ //
+ this.dataPath().flowEntries().add(flowEntry);
+ }
+ }
+
+ /**
+ * Get the flow path Flow ID.
+ *
+ * @return the flow path Flow ID.
+ */
+ @JsonProperty("flowId")
+ public FlowId flowId() { return flowId; }
+
+ /**
+ * Set the flow path Flow ID.
+ *
+ * @param flowId the flow path Flow ID to set.
+ */
+ @JsonProperty("flowId")
+ public void setFlowId(FlowId flowId) {
+ this.flowId = flowId;
+ }
+
+ /**
+ * Test whether the Flow ID is valid.
+ *
+ * @return true if the Flow ID is valid, otherwise false.
+ */
+ @JsonIgnore
+ public boolean isValidFlowId() {
+ if (this.flowId == null)
+ return false;
+ return (this.flowId.isValid());
+ }
+
+ /**
+ * Get the Caller ID of the flow path installer.
+ *
+ * @return the Caller ID of the flow path installer.
+ */
+ @JsonProperty("installerId")
+ public CallerId installerId() { return installerId; }
+
+ /**
+ * Set the Caller ID of the flow path installer.
+ *
+ * @param installerId the Caller ID of the flow path installer.
+ */
+ @JsonProperty("installerId")
+ public void setInstallerId(CallerId installerId) {
+ this.installerId = installerId;
+ }
+
+ /**
+ * Get the flow path type.
+ *
+ * @return the flow path type.
+ */
+ @JsonProperty("flowPathType")
+ public FlowPathType flowPathType() { return flowPathType; }
+
+ /**
+ * Set the flow path type.
+ *
+ * @param flowPathType the flow path type to set.
+ */
+ @JsonProperty("flowPathType")
+ public void setFlowPathType(FlowPathType flowPathType) {
+ this.flowPathType = flowPathType;
+ }
+
+ /**
+ * Get the flow path user state.
+ *
+ * @return the flow path user state.
+ */
+ @JsonProperty("flowPathUserState")
+ public FlowPathUserState flowPathUserState() { return flowPathUserState; }
+
+ /**
+ * Set the flow path user state.
+ *
+ * @param flowPathUserState the flow path user state to set.
+ */
+ @JsonProperty("flowPathUserState")
+ public void setFlowPathUserState(FlowPathUserState flowPathUserState) {
+ this.flowPathUserState = flowPathUserState;
+ }
+
+ /**
+ * Get the flow path flags.
+ *
+ * @return the flow path flags.
+ */
+ @JsonProperty("flowPathFlags")
+ public FlowPathFlags flowPathFlags() { return flowPathFlags; }
+
+ /**
+ * Set the flow path flags.
+ *
+ * @param flowPathFlags the flow path flags to set.
+ */
+ @JsonProperty("flowPathFlags")
+ public void setFlowPathFlags(FlowPathFlags flowPathFlags) {
+ this.flowPathFlags = flowPathFlags;
+ }
+
+ /**
+ * Get the flow path's data path.
+ *
+ * @return the flow path's data path.
+ */
+ @JsonProperty("dataPath")
+ public DataPath dataPath() { return dataPath; }
+
+ /**
+ * Set the flow path's data path.
+ *
+ * @param dataPath the flow path's data path to set.
+ */
+ @JsonProperty("dataPath")
+ public void setDataPath(DataPath dataPath) {
+ this.dataPath = dataPath;
+ }
+
+ /**
+ * Get the data path flow entries.
+ *
+ * @return the data path flow entries.
+ */
+ public ArrayList<FlowEntry> flowEntries() {
+ return this.dataPath.flowEntries();
+ }
+
+ /**
+ * Get the flow path's match conditions common for all Flow Entries.
+ *
+ * @return the flow path's match conditions common for all Flow Entries.
+ */
+ @JsonProperty("flowEntryMatch")
+ public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
+
+ /**
+ * Set the flow path's match conditions common for all Flow Entries.
+ *
+ * @param flowEntryMatch the flow path's match conditions common for all
+ * Flow Entries.
+ */
+ @JsonProperty("flowEntryMatch")
+ public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
+ this.flowEntryMatch = flowEntryMatch;
+ }
+
+ /**
+ * Get the flow path's flow entry actions for the first Flow Entry.
+ *
+ * @return the flow path's flow entry actions for the first Flow Entry.
+ */
+ @JsonProperty("flowEntryActions")
+ public FlowEntryActions flowEntryActions() {
+ return flowEntryActions;
+ }
+
+ /**
+ * Set the flow path's flow entry actions for the first Flow Entry.
+ *
+ * @param flowEntryActions the flow path's flow entry actions for the first
+ * Flow Entry.
+ */
+ @JsonProperty("flowEntryActions")
+ public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
+ this.flowEntryActions = flowEntryActions;
+ }
+
+ /**
+ * Convert the flow path to a string.
+ *
+ * The string has the following form:
+ * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX
+ * flowPathFlags=XXX dataPath=XXX flowEntryMatch=XXX
+ * flowEntryActions=XXX]
+ *
+ * @return the flow path as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[flowId=" + this.flowId.toString();
+ ret += " installerId=" + this.installerId.toString();
+ ret += " flowPathType=" + this.flowPathType;
+ ret += " flowPathUserState=" + this.flowPathUserState;
+ ret += " flowPathFlags=" + this.flowPathFlags.toString();
+ if (dataPath != null)
+ ret += " dataPath=" + this.dataPath.toString();
+ if (flowEntryMatch != null)
+ ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
+ if (flowEntryActions != null)
+ ret += " flowEntryActions=" + this.flowEntryActions.toString();
+ ret += "]";
+ return ret;
+ }
+
+ /**
+ * CompareTo method to order flowPath by Id
+ */
+ @Override
+ public int compareTo(FlowPath f) {
+ return (int) (this.flowId.value() - f.flowId.value());
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
new file mode 100644
index 0000000..4bbd399
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
@@ -0,0 +1,128 @@
+package net.onrc.onos.ofcontroller.util;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing the Flow Path flags.
+ */
+public class FlowPathFlags {
+ private long flags;
+
+ // Discard the first-hop Flow Entry
+ private static final long DISCARD_FIRST_HOP_ENTRY = (1 << 0);
+
+ // Keep only the first-hop Flow Entry
+ private static final long KEEP_ONLY_FIRST_HOP_ENTRY = (1 << 1);
+
+ /**
+ * Default constructor.
+ */
+ public FlowPathFlags() {
+ this.flags = 0;
+ }
+
+ /**
+ * Constructor for given flags.
+ *
+ * @param flags the flags value to set.
+ */
+ public FlowPathFlags(long flags) {
+ this.flags = flags;
+ }
+
+ /**
+ * Constructor for given flags as a string.
+ *
+ * The string value should contain the name of each flags to set. E.g.:
+ * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ * @param flagsStr the string value of the flags to set.
+ */
+ public FlowPathFlags(String flagsStr) {
+ this.setFlagsStr(flagsStr);
+ }
+
+ /**
+ * Get the flags.
+ *
+ * @return the flags.
+ */
+ @JsonProperty("flags")
+ public long flags() { return flags; }
+
+ /**
+ * Set the flags.
+ *
+ * @param flags the flags value to set.
+ */
+ @JsonProperty("flags")
+ public void setFlags(long flags) {
+ this.flags = flags;
+ }
+
+ /**
+ * Set the flags as a string.
+ *
+ * The string value should contain the name of each flags to set. E.g.:
+ * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ * @param flagsStr the string value of the flags to set.
+ */
+ @JsonProperty("flagsStr")
+ public void setFlagsStr(String flagsStr) {
+ this.flags = 0L;
+
+ // Test all flags
+ if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY"))
+ this.flags |= DISCARD_FIRST_HOP_ENTRY;
+ if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY"))
+ this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
+ }
+
+ /**
+ * Test whether the DISCARD_FIRST_HOP_ENTRY flag is set.
+ *
+ * @return true if the DISCARD_FIRST_HOP_ENTRY flag is set,
+ * otherwise false.
+ */
+ public boolean isDiscardFirstHopEntry() {
+ return ((flags & DISCARD_FIRST_HOP_ENTRY) != 0);
+ }
+
+ /**
+ * Test whether the KEEP_ONLY_FIRST_HOP_ENTRY flag is set.
+ *
+ * @return true if the KEEP_ONLY_FIRST_HOP_ENTRY flag is set,
+ * otherwise false.
+ */
+ public boolean isKeepOnlyFirstHopEntry() {
+ return ((flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0);
+ }
+
+ /**
+ * Convert the Flow Path Flags to a string.
+ *
+ * The string has the following form:
+ * [flags=DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY]
+ *
+ * @return the Flow Path flags as a string.
+ */
+ @Override
+ public String toString() {
+ String flagsStr = null;
+ String ret = "[flags=";
+
+ // Test all flags
+ if ((this.flags & DISCARD_FIRST_HOP_ENTRY) != 0) {
+ if (flagsStr != null)
+ flagsStr += ",";
+ flagsStr += "DISCARD_FIRST_HOP_ENTRY";
+ }
+ if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
+ if (flagsStr != null)
+ flagsStr += ",";
+ flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
+ }
+ ret += "]";
+
+ return ret;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java
new file mode 100644
index 0000000..87f2d98
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * The Flow Path types.
+ */
+public enum FlowPathType {
+ FP_TYPE_UNKNOWN, // Initialization value: state unknown
+ FP_TYPE_SHORTEST_PATH, // Shortest path flow
+ FP_TYPE_EXPLICIT_PATH // Flow path with explicit flow entries
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathUserState.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathUserState.java
new file mode 100644
index 0000000..96b6345
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathUserState.java
@@ -0,0 +1,11 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * The Flow Path state as set by the user (via the ONOS API).
+ */
+public enum FlowPathUserState {
+ FP_USER_UNKNOWN, // Initialization value: state unknown
+ FP_USER_ADD, // Flow path that is added
+ FP_USER_MODIFY, // Flow path that is modified
+ FP_USER_DELETE // Flow path that is deleted
+}
diff --git a/src/main/java/net/floodlightcontroller/util/IPv4.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
similarity index 83%
rename from src/main/java/net/floodlightcontroller/util/IPv4.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
index ef3a1e5..119165c 100644
--- a/src/main/java/net/floodlightcontroller/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
@@ -1,9 +1,8 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import net.floodlightcontroller.util.serializers.IPv4Deserializer;
-import net.floodlightcontroller.util.serializers.IPv4Serializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv4Deserializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv4Serializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -23,6 +22,15 @@
}
/**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public IPv4(IPv4 other) {
+ this.value = other.value;
+ }
+
+ /**
* Constructor from an integer value.
*
* @param value the value to use.
diff --git a/src/main/java/net/floodlightcontroller/util/IPv4Net.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/IPv4Net.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
index 824e3e2..9ce247c 100644
--- a/src/main/java/net/floodlightcontroller/util/IPv4Net.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
@@ -1,10 +1,8 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import net.floodlightcontroller.util.IPv4;
-import net.floodlightcontroller.util.serializers.IPv4NetDeserializer;
-import net.floodlightcontroller.util.serializers.IPv4NetSerializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv4NetDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv4NetSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -25,6 +23,17 @@
}
/**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public IPv4Net(IPv4Net other) {
+ if (other.address != null)
+ this.address = new IPv4(other.address);
+ this.prefixLen = other.prefixLen;
+ }
+
+ /**
* Constructor for a given address and prefix length.
*
* @param address the address to use.
diff --git a/src/main/java/net/floodlightcontroller/util/IPv6.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
similarity index 87%
rename from src/main/java/net/floodlightcontroller/util/IPv6.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
index eda4502..f5dae11 100644
--- a/src/main/java/net/floodlightcontroller/util/IPv6.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
@@ -1,12 +1,11 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import org.openflow.util.HexString;
-import net.floodlightcontroller.util.serializers.IPv6Deserializer;
-import net.floodlightcontroller.util.serializers.IPv6Serializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv6Deserializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv6Serializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.openflow.util.HexString;
/**
* The class representing an IPv6 address.
@@ -26,6 +25,16 @@
}
/**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public IPv6(IPv6 other) {
+ this.valueHigh = other.valueHigh;
+ this.valueLow = other.valueLow;
+ }
+
+ /**
* Constructor from integer values.
*
* @param valueHigh the higher (more significant) 64 bits of the address.
diff --git a/src/main/java/net/floodlightcontroller/util/IPv6Net.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/IPv6Net.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
index b6f7d67..65ffe54 100644
--- a/src/main/java/net/floodlightcontroller/util/IPv6Net.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
@@ -1,10 +1,8 @@
-package net.floodlightcontroller.util;
+package net.onrc.onos.ofcontroller.util;
-import net.floodlightcontroller.util.IPv6;
-import net.floodlightcontroller.util.serializers.IPv6NetDeserializer;
-import net.floodlightcontroller.util.serializers.IPv6NetSerializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv6NetDeserializer;
+import net.onrc.onos.ofcontroller.util.serializers.IPv6NetSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -25,6 +23,17 @@
}
/**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public IPv6Net(IPv6Net other) {
+ if (other.address != null)
+ this.address = new IPv6(other.address);
+ this.prefixLen = other.prefixLen;
+ }
+
+ /**
* Constructor for a given address and prefix length.
*
* @param address the address to use.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/Pair.java b/src/main/java/net/onrc/onos/ofcontroller/util/Pair.java
new file mode 100644
index 0000000..2245758
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/Pair.java
@@ -0,0 +1,20 @@
+package net.onrc.onos.ofcontroller.util;
+
+/**
+ * A generic class representing a pair of two values.
+ */
+public class Pair<F, S> {
+ public F first; // The first value in the pair
+ public S second; // The second value in the pair
+
+ /**
+ * Constructor for a pair of two values.
+ *
+ * @param first the first value in the pair.
+ * @param second the second value in the pair.
+ */
+ public Pair(F first, S second) {
+ this.first = first;
+ this.second = second;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/Port.java b/src/main/java/net/onrc/onos/ofcontroller/util/Port.java
new file mode 100644
index 0000000..fedc8df
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/Port.java
@@ -0,0 +1,153 @@
+package net.onrc.onos.ofcontroller.util;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing a network port of a switch.
+ */
+
+public class Port {
+ /**
+ * Special port values.
+ *
+ * Those values are taken as-is from the OpenFlow-v1.0.0 specification
+ * (pp 18-19).
+ */
+ public enum PortValues {
+ /* Maximum number of physical switch ports. */
+ PORT_MAX ((short)0xff00),
+
+ /* Fake output "ports". */
+
+ /* Send the packet out the input port. This
+ virtual port must be explicitly used
+ in order to send back out of the input
+ port. */
+ PORT_IN_PORT ((short)0xfff8),
+
+ /* Perform actions in flow table.
+ NB: This can only be the destination
+ port for packet-out messages. */
+ PORT_TABLE ((short)0xfff9),
+
+ /* Process with normal L2/L3 switching. */
+ PORT_NORMAL ((short)0xfffa),
+
+ /* All physical ports except input port and
+ those disabled by STP. */
+ PORT_FLOOD ((short)0xfffb),
+
+ /* All physical ports except input port. */
+ PORT_ALL ((short)0xfffc),
+
+ /* Send to controller. */
+ PORT_CONTROLLER ((short)0xfffd),
+
+ /* Local openflow "port". */
+ PORT_LOCAL ((short)0xfffe),
+
+ /* Not associated with a physical port. */
+ PORT_NONE ((short)0xffff);
+
+ private final short value; // The value
+
+ /**
+ * Constructor for a given value.
+ *
+ * @param value the value to use for the initialization.
+ */
+ private PortValues(short value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the value as a short integer.
+ *
+ * @return the value as a short integer.
+ */
+ private short value() { return this.value; }
+ }
+
+ private short value;
+
+ /**
+ * Default constructor.
+ */
+ public Port() {
+ this.value = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public Port(Port other) {
+ this.value = other.value();
+ }
+
+ /**
+ * Constructor from a short integer value.
+ *
+ * @param value the value to use.
+ */
+ public Port(short value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructor from a PortValues enum value.
+ *
+ * @param value the value to use.
+ */
+ public Port(PortValues value) {
+ this.value = value.value();
+ }
+
+ /**
+ * Get the value of the port.
+ *
+ * @return the value of the port.
+ */
+ @JsonProperty("value")
+ public short value() { return value; }
+
+ /**
+ * Set the value of the port.
+ *
+ * @param value the value to set.
+ */
+ @JsonProperty("value")
+ public void setValue(short value) {
+ this.value = value;
+ }
+
+ /**
+ * Convert the port value to a string.
+ *
+ * @return the port value as a string.
+ */
+ @Override
+ public String toString() {
+ return Short.toString(this.value);
+ }
+
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof Port)) {
+ return false;
+ }
+
+ Port otherPort = (Port) other;
+
+ return value == otherPort.value;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash += 31 * hash + (int)value;
+ return hash;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/Switch.java b/src/main/java/net/onrc/onos/ofcontroller/util/Switch.java
new file mode 100644
index 0000000..f7df223
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/Switch.java
@@ -0,0 +1,116 @@
+package net.onrc.onos.ofcontroller.util;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing a Switch.
+ * NOTE: Currently this class is (almost) not used.
+ */
+public class Switch {
+ /**
+ * The Switch state.
+ */
+ public enum SwitchState {
+ INACTIVE,
+ ACTIVE,
+ }
+
+ private Dpid dpid; // The DPID of the switch
+ private SwitchState state; // The state of the switch
+
+ /**
+ * Default constructor.
+ *
+ * NOTE: The default state for the switch is INACTIVE.
+ */
+ public Switch() {
+ this.dpid = new Dpid();
+ this.state = SwitchState.INACTIVE;
+ }
+
+ /**
+ * Constructor for a given DPID.
+ *
+ * NOTE: The state for the switch with a given DPID is ACTIVE.
+ *
+ * @param dpid the DPID to use.
+ */
+ public Switch(Dpid dpid) {
+ this.dpid = dpid;
+ this.state = SwitchState.ACTIVE;
+ }
+
+ /**
+ * Constructor for a given DPID and Switch State.
+ *
+ * @param dpid the DPID to use.
+ * @param state the Switch State to use.
+ */
+ public Switch(Dpid dpid, SwitchState state) {
+ this.dpid = dpid;
+ this.state = state;
+ }
+
+ /**
+ * Get the DPID.
+ *
+ * @return the DPID.
+ */
+ @JsonProperty("dpid")
+ public Dpid dpid() { return dpid; }
+
+ /**
+ * Set the DPID.
+ *
+ * @param dpid the DPID to use.
+ */
+ @JsonProperty("dpid")
+ public void setDpid(Dpid dpid) {
+ this.dpid = dpid;
+ }
+
+ /**
+ * Get the state.
+ *
+ * @return the state.
+ */
+ @JsonProperty("state")
+ public SwitchState state() { return state; }
+
+ /**
+ * Set the state.
+ *
+ * @param state the state to use.
+ */
+ @JsonProperty("state")
+ public void setState(SwitchState state) {
+ this.state = state;
+ }
+
+ /**
+ * Set the Switch State to ACTIVE.
+ */
+ public void setStateActive() {
+ this.state = SwitchState.ACTIVE;
+ }
+
+ /**
+ * Set the Switch State to INACTIVE.
+ */
+ public void setStateInactive() {
+ this.state = SwitchState.INACTIVE;
+ }
+
+ /**
+ * Convert the Switch value to a string.
+ *
+ * The string has the following form:
+ * dpid/state
+ *
+ * @return the Switch value as a string.
+ */
+ @Override
+ public String toString() {
+ return this.dpid.toString() + "/" + this.state.toString();
+ }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/SwitchPort.java b/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
similarity index 78%
rename from src/main/java/net/floodlightcontroller/util/SwitchPort.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
index 027b681..8912803 100644
--- a/src/main/java/net/floodlightcontroller/util/SwitchPort.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
@@ -1,7 +1,4 @@
-package net.floodlightcontroller.util;
-
-import net.floodlightcontroller.util.Dpid;
-import net.floodlightcontroller.util.Port;
+package net.onrc.onos.ofcontroller.util;
import org.codehaus.jackson.annotate.JsonProperty;
@@ -88,4 +85,25 @@
public String toString() {
return this.dpid.toString() + "/" + this.port;
}
+
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof SwitchPort)) {
+ return false;
+ }
+
+ SwitchPort otherSwitchPort = (SwitchPort) other;
+
+ return (dpid.equals(otherSwitchPort.dpid) &&
+ port.equals(otherSwitchPort.port));
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash += 31 * hash + dpid.hashCode();
+ hash += 31 * hash + port.hashCode();
+ return hash;
+ }
}
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/DpidDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
similarity index 78%
rename from src/main/java/net/floodlightcontroller/util/serializers/DpidDeserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
index 9297f56..fe93245 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/DpidDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
@@ -1,17 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.Dpid;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.Dpid;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -20,7 +17,7 @@
*/
public class DpidDeserializer extends JsonDeserializer<Dpid> {
- protected static Logger log = LoggerFactory.getLogger(DpidDeserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(DpidDeserializer.class);
@Override
public Dpid deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/DpidSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/DpidSerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
index 06fab62..7ece4d3 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/DpidSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.Dpid;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.Dpid;
-
/**
* Serialize a DPID as a string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
similarity index 78%
rename from src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdDeserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
index e6481d5..71b02e0 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
@@ -1,17 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.FlowEntryId;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -20,7 +17,7 @@
*/
public class FlowEntryIdDeserializer extends JsonDeserializer<FlowEntryId> {
- protected static Logger log = LoggerFactory.getLogger(FlowEntryIdDeserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(FlowEntryIdDeserializer.class);
@Override
public FlowEntryId deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
similarity index 84%
rename from src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdSerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
index 4b6583c..bf73265 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/FlowEntryIdSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.FlowEntryId;
-
/**
* Serialize a Flow Entry ID as a hexadecimal string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/FlowIdDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
similarity index 78%
rename from src/main/java/net/floodlightcontroller/util/serializers/FlowIdDeserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
index a7f53d4..f341027 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/FlowIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
@@ -1,17 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.FlowId;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -20,7 +17,7 @@
*/
public class FlowIdDeserializer extends JsonDeserializer<FlowId> {
- protected static Logger log = LoggerFactory.getLogger(FlowIdDeserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(FlowIdDeserializer.class);
@Override
public FlowId deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/FlowIdSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/FlowIdSerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
index 6f1a6f6..34f6e05 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/FlowIdSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.FlowId;
-
/**
* Serialize a Flow ID as a hexadecimal string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv4Deserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
similarity index 75%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv4Deserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
index 7ce7d5c..2969e60 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv4Deserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
@@ -1,26 +1,23 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.IPv4;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.IPv4;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Deserialize an IPv4 from a string.
+ * Deserialize an IPv4 address from a string.
*/
public class IPv4Deserializer extends JsonDeserializer<IPv4> {
- protected static Logger log = LoggerFactory.getLogger(IPv4Deserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(IPv4Deserializer.class);
@Override
public IPv4 deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv4NetDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
similarity index 75%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv4NetDeserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
index e35fc80..b2592af 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv4NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
@@ -1,26 +1,23 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.IPv4Net;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.IPv4Net;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Deserialize an IPv4Net from a string.
+ * Deserialize an IPv4Net address from a string.
*/
public class IPv4NetDeserializer extends JsonDeserializer<IPv4Net> {
- protected static Logger log = LoggerFactory.getLogger(IPv4NetDeserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(IPv4NetDeserializer.class);
@Override
public IPv4Net deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv4NetSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv4NetSerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
index 5c5e1d0..0454a58 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv4NetSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv4Net;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.IPv4Net;
-
/**
* Serialize an IPv4Net address as a string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv4Serializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv4Serializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
index ba7d825..aefc8a0 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv4Serializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv4;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.IPv4;
-
/**
* Serialize an IPv4 address as a string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv6Deserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
similarity index 75%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv6Deserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
index 6713f93..c825377 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv6Deserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
@@ -1,26 +1,23 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.IPv6;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.IPv6;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Deserialize an IPv6 from a string.
+ * Deserialize an IPv6 address from a string.
*/
public class IPv6Deserializer extends JsonDeserializer<IPv6> {
- protected static Logger log = LoggerFactory.getLogger(IPv6Deserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(IPv6Deserializer.class);
@Override
public IPv6 deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv6NetDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
similarity index 75%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv6NetDeserializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
index 596ee50..7191fa9 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv6NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
@@ -1,26 +1,23 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
+import net.onrc.onos.ofcontroller.util.IPv6Net;
+
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
-
-import net.floodlightcontroller.util.IPv6Net;
-
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Deserialize an IPv6Net from a string.
+ * Deserialize an IPv6Net address from a string.
*/
public class IPv6NetDeserializer extends JsonDeserializer<IPv6Net> {
- protected static Logger log = LoggerFactory.getLogger(IPv6NetDeserializer.class);
+ protected final static Logger log = LoggerFactory.getLogger(IPv6NetDeserializer.class);
@Override
public IPv6Net deserialize(JsonParser jp,
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv6NetSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv6NetSerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
index fc5d262..06dc6cf 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv6NetSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv6Net;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.IPv6Net;
-
/**
* Serialize an IPv6Net address as a string.
*/
diff --git a/src/main/java/net/floodlightcontroller/util/serializers/IPv6Serializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
similarity index 85%
rename from src/main/java/net/floodlightcontroller/util/serializers/IPv6Serializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
index 0b08a63..b6709b8 100644
--- a/src/main/java/net/floodlightcontroller/util/serializers/IPv6Serializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
@@ -1,14 +1,14 @@
-package net.floodlightcontroller.util.serializers;
+package net.onrc.onos.ofcontroller.util.serializers;
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv6;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.IPv6;
-
/**
* Serialize an IPv6 address as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
new file mode 100644
index 0000000..1355fe0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
@@ -0,0 +1,161 @@
+package net.onrc.onos.ofcontroller.util.serializers;
+
+import java.util.ArrayList;
+import java.util.TreeMap;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
+import net.onrc.onos.ofcontroller.topology.TopologyElement;
+import net.onrc.onos.ofcontroller.util.CallerId;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction;
+import net.onrc.onos.ofcontroller.util.FlowEntryActions;
+import net.onrc.onos.ofcontroller.util.FlowEntryErrorState;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+import net.onrc.onos.ofcontroller.util.FlowEntrySwitchState;
+import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
+import net.onrc.onos.ofcontroller.util.FlowPathType;
+import net.onrc.onos.ofcontroller.util.FlowPathUserState;
+import net.onrc.onos.ofcontroller.util.IPv4;
+import net.onrc.onos.ofcontroller.util.IPv4Net;
+import net.onrc.onos.ofcontroller.util.IPv6;
+import net.onrc.onos.ofcontroller.util.IPv6Net;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.Switch;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import com.esotericsoftware.kryo2.Kryo;
+
+/**
+ * Class factory for allocating Kryo instances for
+ * serialization/deserialization of classes.
+ */
+public class KryoFactory {
+ private ArrayList<Kryo> kryoList = new ArrayList<Kryo>();
+
+ /**
+ * Default constructor.
+ */
+ public KryoFactory() {
+ Kryo kryo;
+ // Preallocate
+ for (int i = 0; i < 100; i++) {
+ kryo = newKryoImpl();
+ kryoList.add(kryo);
+ }
+ }
+
+ /**
+ * Create and initialize a new Kryo object.
+ *
+ * @return the created Kryo object.
+ */
+ public Kryo newKryo() {
+ return newDeleteKryo(null);
+ }
+
+ /**
+ * Delete an existing Kryo object.
+ *
+ * @param deleteKryo the object to delete.
+ */
+ public void deleteKryo(Kryo deleteKryo) {
+ newDeleteKryo(deleteKryo);
+ }
+
+ /**
+ * Create or delete a Kryo object.
+ *
+ * @param deleteKryo if null, then allocate and return a new object,
+ * otherwise delete the provided object.
+ * @return a new Kryo object if needed, otherwise null.
+ */
+ synchronized private Kryo newDeleteKryo(Kryo deleteKryo) {
+ if (deleteKryo != null) {
+ // Delete an entry by moving it back to the buffer
+ kryoList.add(deleteKryo);
+ return null;
+ } else {
+ Kryo kryo = null;
+ if (kryoList.isEmpty()) {
+ // Preallocate
+ for (int i = 0; i < 100; i++) {
+ kryo = newKryoImpl();
+ kryoList.add(kryo);
+ }
+ }
+
+ kryo = kryoList.remove(kryoList.size() - 1);
+ return kryo;
+ }
+ }
+
+ /**
+ * Create and initialize a new Kryo object.
+ *
+ * @return the created Kryo object.
+ */
+ private Kryo newKryoImpl() {
+ Kryo kryo = new Kryo();
+ kryo.setRegistrationRequired(true);
+ // kryo.setReferences(false);
+ //
+ kryo.register(ArrayList.class);
+
+ // FlowPath and related classes
+ kryo.register(CallerId.class);
+ kryo.register(DataPath.class);
+ kryo.register(DataPathEndpoints.class);
+ kryo.register(Dpid.class);
+ kryo.register(FlowEntryAction.class);
+ kryo.register(FlowEntryAction.ActionEnqueue.class);
+ kryo.register(FlowEntryAction.ActionOutput.class);
+ kryo.register(FlowEntryAction.ActionSetEthernetAddr.class);
+ kryo.register(FlowEntryAction.ActionSetIpToS.class);
+ kryo.register(FlowEntryAction.ActionSetIPv4Addr.class);
+ kryo.register(FlowEntryAction.ActionSetTcpUdpPort.class);
+ kryo.register(FlowEntryAction.ActionSetVlanId.class);
+ kryo.register(FlowEntryAction.ActionSetVlanPriority.class);
+ kryo.register(FlowEntryAction.ActionStripVlan.class);
+ kryo.register(FlowEntryAction.ActionValues.class);
+ kryo.register(FlowEntryActions.class);
+ kryo.register(FlowEntryErrorState.class);
+ kryo.register(FlowEntryId.class);
+ kryo.register(FlowEntry.class);
+ kryo.register(FlowEntryMatch.class);
+ kryo.register(FlowEntryMatch.Field.class);
+ kryo.register(FlowEntrySwitchState.class);
+ kryo.register(FlowEntryUserState.class);
+ kryo.register(FlowId.class);
+ kryo.register(FlowPath.class);
+ kryo.register(FlowPathFlags.class);
+ kryo.register(FlowPathType.class);
+ kryo.register(FlowPathUserState.class);
+ kryo.register(IPv4.class);
+ kryo.register(IPv4Net.class);
+ kryo.register(IPv6.class);
+ kryo.register(IPv6Net.class);
+ kryo.register(byte[].class);
+ kryo.register(MACAddress.class);
+ kryo.register(Port.class);
+ kryo.register(Switch.class);
+ kryo.register(SwitchPort.class);
+
+ // Topology-related classes
+ kryo.register(TopologyElement.class);
+ kryo.register(TopologyElement.Type.class);
+ kryo.register(TreeMap.class);
+
+ //ARP message
+ kryo.register(ArpMessage.class);
+
+ return kryo;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java
new file mode 100644
index 0000000..5253dce
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java
@@ -0,0 +1,40 @@
+package net.onrc.onos.ofcontroller.util.serializers;
+
+import java.io.IOException;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Deserialize a MAC address from a string.
+ */
+public class MACAddressDeserializer extends JsonDeserializer<MACAddress> {
+
+ protected final static Logger log = LoggerFactory.getLogger(MACAddressDeserializer.class);
+
+ @Override
+ public MACAddress deserialize(JsonParser jp,
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ MACAddress mac = null;
+
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: " + fieldname + " Value: " + value);
+ mac = MACAddress.valueOf(value);
+ }
+ }
+ return mac;
+ }
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java
new file mode 100644
index 0000000..9c0e225
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java
@@ -0,0 +1,25 @@
+package net.onrc.onos.ofcontroller.util.serializers;
+
+import java.io.IOException;
+
+import net.floodlightcontroller.util.MACAddress;
+
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+
+/**
+ * Serialize a MAC address as a string.
+ */
+public class MACAddressSerializer extends JsonSerializer<MACAddress> {
+
+ @Override
+ public void serialize(MACAddress mac, JsonGenerator jGen,
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", mac.toString());
+ jGen.writeEndObject();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/registry/controller/ControllerRegistryResource.java b/src/main/java/net/onrc/onos/registry/controller/ControllerRegistryResource.java
index 51f1d32..8660688 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ControllerRegistryResource.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ControllerRegistryResource.java
@@ -10,7 +10,7 @@
public class ControllerRegistryResource extends ServerResource {
- protected static Logger log = LoggerFactory.getLogger(ControllerRegistryResource.class);
+ protected final static Logger log = LoggerFactory.getLogger(ControllerRegistryResource.class);
@Get("json")
public Collection<String> getControllers() {
diff --git a/src/main/java/net/onrc/onos/registry/controller/ControllerService.java b/src/main/java/net/onrc/onos/registry/controller/ControllerService.java
new file mode 100644
index 0000000..c74e85d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/registry/controller/ControllerService.java
@@ -0,0 +1,26 @@
+package net.onrc.onos.registry.controller;
+
+
+
+//@JsonRootName("controller")
+public class ControllerService {
+
+ private String controllerId;
+
+ public ControllerService(){
+ this("");
+ }
+
+ public ControllerService(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public void setControllerId(String controllerId) {
+ this.controllerId = controllerId;
+ }
+
+ public String getControllerId() {
+ return controllerId;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java b/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
index afd9dc6..33ba272 100644
--- a/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
+++ b/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
@@ -6,6 +6,23 @@
import net.floodlightcontroller.core.module.IFloodlightService;
+/**
+ * A registry service that allows ONOS to register controllers and switches
+ * in a way that is global to the entire ONOS cluster. The registry is the
+ * arbiter for allowing controllers to control switches.
+ *
+ * The OVS/OF1.{2,3} fault tolerance model is a switch connects to multiple
+ * controllers, and the controllers send role requests to determine what their
+ * role is in controlling the switch.
+ *
+ * The ONOS fault tolerance model allows only a single controller to have
+ * control of a switch (MASTER role) at once. Controllers therefore need a
+ * mechanism that enables them to decide who should control a each switch.
+ * The registry service provides this mechanism.
+ *
+ * @author jono
+ *
+ */
public interface IControllerRegistryService extends IFloodlightService {
/**
@@ -54,24 +71,16 @@
*/
public boolean hasControl(long dpid);
-
- /**
- * Superseded by registerController
- * @param id
- */
- @Deprecated
- public void setMastershipId (String id);
-
/**
* Get the unique ID used to identify this controller in the cluster
* @return
*/
- public String getMastershipId ();
+ public String getControllerId ();
/**
* Register a controller to the ONOS cluster. Must be called before
* the registry can be used to take control of any switches.
- * @param controller A unique string ID identifying this controller
+ * @param controllerId A unique string ID identifying this controller
* in the cluster
* @throws errors connecting to registry service,
* controllerId already registered
@@ -92,7 +101,21 @@
*/
public Map<String, List<ControllerRegistryEntry>> getAllSwitches();
+ /**
+ * Get the controller that has control of a given switch
+ * @param dpid Switch to find controller for
+ * @return controller ID
+ * @throws RegistryException Errors contacting registry service
+ */
public String getControllerForSwitch(long dpid) throws RegistryException;
+ /**
+ * Get all switches controlled by a given controller
+ * @param controllerId
+ * @return Collection of dpids
+ */
public Collection<Long> getSwitchesControlledByController(String controllerId);
+
+ public IdBlock allocateUniqueIdBlock();
+
}
diff --git a/src/main/java/net/onrc/onos/registry/controller/IdBlock.java b/src/main/java/net/onrc/onos/registry/controller/IdBlock.java
new file mode 100644
index 0000000..64b2af8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/registry/controller/IdBlock.java
@@ -0,0 +1,31 @@
+package net.onrc.onos.registry.controller;
+
+public class IdBlock {
+ private long start;
+ private long end;
+ private long size;
+
+ public IdBlock(long start, long end, long size) {
+ this.start = start;
+ this.end = end;
+ this.size = size;
+ }
+
+ public long getStart() {
+ return start;
+ }
+
+ public long getEnd() {
+ return end;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ @Override
+ public String toString() {
+ return "IdBlock [start=" + start + ", end=" + end + ", size=" + size
+ + "]";
+ }
+}
diff --git a/src/main/java/net/onrc/onos/registry/controller/RegistryRunner.java b/src/main/java/net/onrc/onos/registry/controller/RegistryRunner.java
deleted file mode 100644
index 164f328..0000000
--- a/src/main/java/net/onrc/onos/registry/controller/RegistryRunner.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package net.onrc.onos.registry.controller;
-
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
-
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Used for lightweight testing of the mastership module without having
- * to load up the entire ONOS.
- * @author jono
- *
- */
-public class RegistryRunner {
- protected static Logger log = LoggerFactory.getLogger(RegistryRunner.class);
-
- public static void main(String args[]){
- FloodlightModuleContext fmc = new FloodlightModuleContext();
- ZookeeperRegistry rm = new ZookeeperRegistry();
-
- fmc.addConfigParam(rm, "enableZookeeper", "true");
-
- String id = null;
- if (args.length > 0){
- id = args[0];
- log.info("Using unique id: {}", id);
- }
-
- try {
- rm.init(fmc);
- rm.startUp(fmc);
-
- if (id == null){
- log.error("No unique ID supplied");
- System.exit(1);
- }
-
- rm.registerController(id);
- //rm.setMastershipId(id);
-
- rm.requestControl(1L,
- new ControlChangeCallback(){
- @Override
- public void controlChanged(long dpid, boolean isMaster) {
- if (isMaster){
- log.debug("Callback for becoming master for {}", HexString.toHexString(dpid));
- }
- else {
- log.debug("Callback for losing mastership for {}", HexString.toHexString(dpid));
- }
- }
- });
-
- Thread.sleep(1000);
-
- /*
- Map<String, List<ControllerRegistryEntry>> switches = rm.getAllSwitches();
- for (List<ControllerRegistryEntry> ls : switches.values()){
- for (ControllerRegistryEntry cre : ls){
- log.debug("ctrlr: {}", cre.getControllerId());
- }
- }
- */
- //"Server" loop
- while (true) {
- Thread.sleep(60000);
- }
-
- } catch (FloodlightModuleException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- log.debug("is master: {}", rm.hasControl(1L));
- }
-}
diff --git a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
index 8a468bc..b6d980a 100644
--- a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
@@ -16,14 +16,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Implementation of a registry that doesn't rely on any external registry
+ * service. This is designed to be used only in single-node setups (e.g. for
+ * development). All registry data is stored in local memory.
+ * @author jono
+ *
+ */
public class StandaloneRegistry implements IFloodlightModule,
IControllerRegistryService {
- protected static Logger log = LoggerFactory.getLogger(StandaloneRegistry.class);
+ protected final static Logger log = LoggerFactory.getLogger(StandaloneRegistry.class);
protected IRestApiService restApi;
- //protected String controllerId;
-
protected String controllerId = null;
protected Map<String, ControlChangeCallback> switchCallbacks;
@@ -63,13 +68,7 @@
}
@Override
- public void setMastershipId(String id) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String getMastershipId() {
+ public String getControllerId() {
return controllerId;
}
@@ -92,7 +91,7 @@
@Override
public String getControllerForSwitch(long dpid) throws RegistryException {
- return controllerId;
+ return (switchCallbacks.get(HexString.toHexString(dpid)) != null)? controllerId: null;
}
@Override
@@ -116,6 +115,24 @@
String controllerId) {
throw new RuntimeException("Not yet implemented");
}
+
+ private long blockTop = 0L;
+ private static final long BLOCK_SIZE = 0x1000000L;
+
+ /**
+ * Returns a block of IDs which are unique and unused.
+ * Range of IDs is fixed size and is assigned incrementally as this method called.
+ */
+ @Override
+ public synchronized IdBlock allocateUniqueIdBlock(){
+ long blockHead = blockTop;
+ long blockTail = blockTop + BLOCK_SIZE;
+
+ IdBlock block = new IdBlock(blockHead, blockTail - 1, BLOCK_SIZE);
+ blockTop = blockTail;
+
+ return block;
+ }
@Override
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
@@ -147,16 +164,6 @@
restApi = context.getServiceImpl(IRestApiService.class);
switchCallbacks = new HashMap<String, ControlChangeCallback>();
-
- //Put some data in for testing
- /*
- try {
- registerController("hurro");
- requestControl(2L, null);
- } catch (RegistryException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }*/
}
@Override
diff --git a/src/main/java/net/onrc/onos/registry/controller/SwitchLeadershipData.java b/src/main/java/net/onrc/onos/registry/controller/SwitchLeadershipData.java
new file mode 100644
index 0000000..eb513fd
--- /dev/null
+++ b/src/main/java/net/onrc/onos/registry/controller/SwitchLeadershipData.java
@@ -0,0 +1,25 @@
+package net.onrc.onos.registry.controller;
+
+import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
+
+import com.netflix.curator.framework.recipes.leader.LeaderLatch;
+
+public class SwitchLeadershipData {
+
+ private LeaderLatch latch;
+ private ControlChangeCallback cb;
+
+ public SwitchLeadershipData(LeaderLatch latch, ControlChangeCallback cb) {
+ this.latch = latch;
+ this.cb = cb;
+ }
+
+ public LeaderLatch getLatch(){
+ return latch;
+ }
+
+ public ControlChangeCallback getCallback(){
+ return cb;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java b/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java
index d6f3dee..599a1af 100644
--- a/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java
+++ b/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java
@@ -6,12 +6,8 @@
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class SwitchRegistryResource extends ServerResource {
-
- protected static Logger log = LoggerFactory.getLogger(SwitchRegistryResource.class);
@Get("json")
public Map<String, List<ControllerRegistryEntry>> getAllControllers(){
@@ -26,12 +22,6 @@
switches = new HashMap<String, List<ControllerRegistryEntry>>();
}
- for (List<ControllerRegistryEntry> list: switches.values()){
- for (ControllerRegistryEntry en : list) {
- log.debug("Controller id {}", en.getControllerId());
- }
- }
-
return switches;
}
}
diff --git a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
index 468bb07..50ee137 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
@@ -1,13 +1,14 @@
package net.onrc.onos.registry.controller;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
@@ -15,9 +16,6 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.restserver.IRestApiService;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.openflow.util.HexString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,153 +24,147 @@
import com.netflix.curator.RetryPolicy;
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
-import com.netflix.curator.framework.api.CuratorWatcher;
+import com.netflix.curator.framework.recipes.atomic.AtomicValue;
+import com.netflix.curator.framework.recipes.atomic.DistributedAtomicLong;
import com.netflix.curator.framework.recipes.cache.ChildData;
import com.netflix.curator.framework.recipes.cache.PathChildrenCache;
import com.netflix.curator.framework.recipes.cache.PathChildrenCache.StartMode;
import com.netflix.curator.framework.recipes.cache.PathChildrenCacheEvent;
import com.netflix.curator.framework.recipes.cache.PathChildrenCacheListener;
import com.netflix.curator.framework.recipes.leader.LeaderLatch;
-import com.netflix.curator.framework.recipes.leader.Participant;
+import com.netflix.curator.framework.recipes.leader.LeaderLatchEvent;
+import com.netflix.curator.framework.recipes.leader.LeaderLatchListener;
import com.netflix.curator.retry.ExponentialBackoffRetry;
+import com.netflix.curator.retry.RetryOneTime;
+import com.netflix.curator.x.discovery.ServiceCache;
+import com.netflix.curator.x.discovery.ServiceDiscovery;
+import com.netflix.curator.x.discovery.ServiceDiscoveryBuilder;
+import com.netflix.curator.x.discovery.ServiceInstance;
+/**
+ * A registry service that uses Zookeeper. All data is stored in Zookeeper,
+ * so this can be used as a global registry in a multi-node ONOS cluster.
+ * @author jono
+ *
+ */
public class ZookeeperRegistry implements IFloodlightModule, IControllerRegistryService {
- protected static Logger log = LoggerFactory.getLogger(ZookeeperRegistry.class);
+ protected final static Logger log = LoggerFactory.getLogger(ZookeeperRegistry.class);
protected String controllerId = null;
protected IRestApiService restApi;
- //TODO read this from configuration
+ //This is the default, it's overwritten by the connectionString configuration parameter
protected String connectionString = "localhost:2181";
-
private final String namespace = "onos";
private final String switchLatchesPath = "/switches";
- private final String controllerPath = "/controllers";
+
+ private final String SERVICES_PATH = "/"; //i.e. the root of our namespace
+ private final String CONTROLLER_SERVICE_NAME = "controllers";
protected CuratorFramework client;
- protected PathChildrenCache controllerCache;
protected PathChildrenCache switchCache;
- protected Map<String, LeaderLatch> switchLatches;
- protected Map<String, ControlChangeCallback> switchCallbacks;
+ protected ConcurrentHashMap<String, SwitchLeadershipData> switches;
protected Map<String, PathChildrenCache> switchPathCaches;
- //Zookeeper performance-related configuration
- protected static final int sessionTimeout = 2000;
- protected static final int connectionTimeout = 4000;
+ private final String ID_COUNTER_PATH = "/flowidcounter";
+ private final Long ID_BLOCK_SIZE = 0x100000000L;
+ protected DistributedAtomicLong distributedIdCounter;
- protected class ParamaterizedCuratorWatcher implements CuratorWatcher {
- private String dpid;
- private boolean isLeader = false;
- private String latchPath;
+ //Zookeeper performance-related configuration
+ protected static final int sessionTimeout = 5000;
+ protected static final int connectionTimeout = 7000;
+
+
+ protected class SwitchLeaderListener implements LeaderLatchListener{
+ String dpid;
+ LeaderLatch latch;
- public ParamaterizedCuratorWatcher(String dpid, String latchPath){
+ public SwitchLeaderListener(String dpid, LeaderLatch latch){
this.dpid = dpid;
- this.latchPath = latchPath;
+ this.latch = latch;
}
@Override
- public synchronized void process(WatchedEvent event) throws Exception {
- log.debug("Watch Event: {}", event);
-
- LeaderLatch latch = switchLatches.get(dpid);
+ public void leaderLatchEvent(CuratorFramework arg0,
+ LeaderLatchEvent arg1) {
+ log.debug("Leadership changed for {}, now {}",
+ dpid, latch.hasLeadership());
- if (event.getState() == KeeperState.Disconnected){
- if (isLeader) {
- log.debug("Disconnected while leader - lost leadership for {}", dpid);
-
- isLeader = false;
- ControlChangeCallback cb = switchCallbacks.get(dpid);
- if (cb != null) {
- //Allow callback to be null if the requester doesn't want a callback
- cb.controlChanged(HexString.toLong(dpid), false);
- }
- }
- return;
+ //Check that the leadership request is still active - the client
+ //may have since released the request or even begun another request
+ //(this is why we use == to check the object instance is the same)
+ SwitchLeadershipData swData = switches.get(dpid);
+ if (swData != null && swData.getLatch() == latch){
+ swData.getCallback().controlChanged(
+ HexString.toLong(dpid), latch.hasLeadership());
}
-
- try {
-
- Participant leader = latch.getLeader();
-
- if (leader.getId().equals(controllerId) && !isLeader){
- log.debug("Became leader for {}", dpid);
-
- isLeader = true;
- switchCallbacks.get(dpid).controlChanged(HexString.toLong(dpid), true);
- }
- else if (!leader.getId().equals(controllerId) && isLeader){
- log.debug("Lost leadership for {}", dpid);
-
- isLeader = false;
- switchCallbacks.get(dpid).controlChanged(HexString.toLong(dpid), false);
- }
- } catch (Exception e){
- if (isLeader){
- log.debug("Exception checking leadership status. Assume leadship lost for {}",
- dpid);
-
- isLeader = false;
- switchCallbacks.get(dpid).controlChanged(HexString.toLong(dpid), false);
- }
+ else {
+ log.debug("Latch for {} has changed: old latch {} - new latch {}",
+ new Object[]{dpid, latch, swData.getLatch()});
}
-
- client.getChildren().usingWatcher(this).inBackground().forPath(latchPath);
- //client.getChildren().usingWatcher(this).forPath(latchPath);
}
}
-
- /*
- * Listens for changes to the switch znodes in Zookeeper. This maintains the second level of
- * PathChildrenCaches that hold the controllers contending for each switch - there's one for
- * each switch.
- */
- PathChildrenCacheListener switchPathCacheListener = new PathChildrenCacheListener() {
+ protected class SwitchPathCacheListener implements PathChildrenCacheListener {
@Override
public void childEvent(CuratorFramework client,
PathChildrenCacheEvent event) throws Exception {
- log.debug("Root switch path cache got {} event", event.getType());
+ //log.debug("Root switch path cache got {} event", event.getType());
String strSwitch = null;
if (event.getData() != null){
- log.debug("Event path {}", event.getData().getPath());
String[] splitted = event.getData().getPath().split("/");
strSwitch = splitted[splitted.length - 1];
- log.debug("Switch name is {}", strSwitch);
}
switch (event.getType()){
case CHILD_ADDED:
case CHILD_UPDATED:
//Check we have a PathChildrenCache for this child, add one if not
- if (switchPathCaches.get(strSwitch) == null){
- PathChildrenCache pc = new PathChildrenCache(client,
- event.getData().getPath(), true);
- pc.start(StartMode.NORMAL);
- switchPathCaches.put(strSwitch, pc);
+ synchronized (switchPathCaches){
+ if (switchPathCaches.get(strSwitch) == null){
+ PathChildrenCache pc = new PathChildrenCache(client,
+ event.getData().getPath(), true);
+ pc.start(StartMode.NORMAL);
+ switchPathCaches.put(strSwitch, pc);
+ }
}
break;
case CHILD_REMOVED:
//Remove our PathChildrenCache for this child
- PathChildrenCache pc = switchPathCaches.remove(strSwitch);
- pc.close();
+ PathChildrenCache pc = null;
+ synchronized(switchPathCaches){
+ pc = switchPathCaches.remove(strSwitch);
+ }
+ if (pc != null){
+ pc.close();
+ }
break;
default:
- //All other events are connection status events. We need to do anything
- //as the path cache handles these on its own.
+ //All other events are connection status events. We don't need to
+ //do anything as the path cache handles these on its own.
break;
}
}
};
+ /**
+ * Listens for changes to the switch znodes in Zookeeper. This maintains
+ * the second level of PathChildrenCaches that hold the controllers
+ * contending for each switch - there's one for each switch.
+ */
+ PathChildrenCacheListener switchPathCacheListener = new SwitchPathCacheListener();
+ protected ServiceDiscovery<ControllerService> serviceDiscovery;
+ protected ServiceCache<ControllerService> serviceCache;
@Override
public void requestControl(long dpid, ControlChangeCallback cb) throws RegistryException {
+ log.info("Requesting control for {}", HexString.toHexString(dpid));
if (controllerId == null){
throw new RuntimeException("Must register a controller before calling requestControl");
@@ -181,20 +173,33 @@
String dpidStr = HexString.toHexString(dpid);
String latchPath = switchLatchesPath + "/" + dpidStr;
- if (switchLatches.get(dpidStr) != null){
- throw new RuntimeException("Leader election for switch " + dpidStr +
- "is already running");
+ if (switches.get(dpidStr) != null){
+ log.debug("Already contesting {}, returning", HexString.toHexString(dpid));
+ throw new RegistryException("Already contesting control for " + dpidStr);
}
LeaderLatch latch = new LeaderLatch(client, latchPath, controllerId);
- switchLatches.put(dpidStr, latch);
- switchCallbacks.put(dpidStr, cb);
+ latch.addListener(new SwitchLeaderListener(dpidStr, latch));
+
+ SwitchLeadershipData swData = new SwitchLeadershipData(latch, cb);
+ SwitchLeadershipData oldData = switches.putIfAbsent(dpidStr, swData);
+
+ if (oldData != null){
+ //There was already data for that key in the map
+ //i.e. someone else got here first so we can't succeed
+ log.debug("Already requested control for {}", dpidStr);
+ throw new RegistryException("Already requested control for " + dpidStr);
+ }
+
+ //Now that we know we were able to add our latch to the collection,
+ //we can start the leader election in Zookeeper. However I don't know
+ //how to handle if the start fails - the latch is already in our
+ //switches list.
+ //TODO seems like there's a Curator bug when latch.start is called when
+ //there's no Zookeeper connection which causes two znodes to be put in
+ //Zookeeper at the latch path when we reconnect to Zookeeper.
try {
- //client.getChildren().usingWatcher(watcher).inBackground().forPath(singleLatchPath);
- client.getChildren().usingWatcher(
- new ParamaterizedCuratorWatcher(dpidStr, latchPath))
- .inBackground().forPath(latchPath);
latch.start();
} catch (Exception e) {
log.warn("Error starting leader latch: {}", e.getMessage());
@@ -205,52 +210,46 @@
@Override
public void releaseControl(long dpid) {
+ log.info("Releasing control for {}", HexString.toHexString(dpid));
String dpidStr = HexString.toHexString(dpid);
- LeaderLatch latch = switchLatches.get(dpidStr);
- if (latch == null) {
- log.debug("Trying to release mastership for switch we are not contesting");
+ SwitchLeadershipData swData = switches.remove(dpidStr);
+
+ if (swData == null) {
+ log.debug("Trying to release control of a switch we are not contesting");
return;
}
+
+ LeaderLatch latch = swData.getLatch();
+
+ latch.removeAllListeners();
try {
latch.close();
} catch (IOException e) {
- //I think it's OK not to do anything here. Either the node got deleted correctly,
- //or the connection went down and the node got deleted.
- } finally {
- switchLatches.remove(dpidStr);
- switchCallbacks.remove(dpidStr);
+ //I think it's OK not to do anything here. Either the node got
+ //deleted correctly, or the connection went down and the node got deleted.
+ log.debug("releaseControl: caught IOException {}", dpidStr);
}
}
@Override
public boolean hasControl(long dpid) {
+ String dpidStr = HexString.toHexString(dpid);
- LeaderLatch latch = switchLatches.get(HexString.toHexString(dpid));
+ SwitchLeadershipData swData = switches.get(dpidStr);
- if (latch == null) {
- log.warn("No leader latch for dpid {}", HexString.toHexString(dpid));
+ if (swData == null) {
+ log.warn("No leader latch for dpid {}", dpidStr);
return false;
}
- try {
- return latch.getLeader().getId().equals(controllerId);
- } catch (Exception e) {
- //TODO swallow exception?
- return false;
- }
+ return swData.getLatch().hasLeadership();
}
@Override
- public void setMastershipId(String id) {
- //TODO remove this method if not needed
- //controllerId = id;
- }
-
- @Override
- public String getMastershipId() {
+ public String getControllerId() {
return controllerId;
}
@@ -259,17 +258,13 @@
log.debug("Getting all controllers");
List<String> controllers = new ArrayList<String>();
- for (ChildData data : controllerCache.getCurrentData()){
-
- String d = null;
- try {
- d = new String(data.getData(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RegistryException("Error encoding string", e);
+ for (ServiceInstance<ControllerService> instance : serviceCache.getInstances()){
+ String id = instance.getPayload().getControllerId();
+ if (!controllers.contains(id)){
+ controllers.add(id);
}
-
- controllers.add(d);
}
+
return controllers;
}
@@ -282,43 +277,65 @@
controllerId = id;
- byte bytes[] = id.getBytes(Charsets.UTF_8);
-
- String path = controllerPath + "/" + id;
-
- log.info("Registering controller with id {}", id);
-
- //Create ephemeral node in controller registry
try {
- client.create().withProtection().withMode(CreateMode.EPHEMERAL)
- .forPath(path, bytes);
+ ServiceInstance<ControllerService> thisInstance = ServiceInstance.<ControllerService>builder()
+ .name(CONTROLLER_SERVICE_NAME)
+ .payload(new ControllerService(controllerId))
+ //.port((int)(65535 * Math.random())) // in a real application, you'd use a common port
+ //.uriSpec(uriSpec)
+ .build();
+
+ serviceDiscovery.registerService(thisInstance);
} catch (Exception e) {
- throw new RegistryException("Error contacting the Zookeeper service", e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+
}
@Override
public String getControllerForSwitch(long dpid) throws RegistryException {
- // TODO Work out how we should store this controller/switch data.
- // The leader latch might be a index to the /controllers collections
- // which holds more info on the controller (how to talk to it for example).
+ String dpidStr = HexString.toHexString(dpid);
- String strDpid = HexString.toHexString(dpid);
- LeaderLatch latch = switchLatches.get(strDpid);
+ PathChildrenCache switchCache = switchPathCaches.get(dpidStr);
- if (latch == null){
+ if (switchCache == null){
log.warn("Tried to get controller for non-existent switch");
return null;
}
- Participant leader = null;
try {
- leader = latch.getLeader();
+ //We've seen issues with these caches get stuck out of date, so we'll have to
+ //force them to refresh before each read. This slows down the method as it
+ //blocks on a Zookeeper query, however at the moment only the cleanup thread
+ //uses this and that isn't particularly time-sensitive.
+ switchCache.rebuild();
} catch (Exception e) {
- throw new RegistryException("Error contacting the Zookeeper service", e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
- return leader.getId();
+ List<ChildData> sortedData = new ArrayList<ChildData>(switchCache.getCurrentData());
+
+ Collections.sort(
+ sortedData,
+ new Comparator<ChildData>(){
+ private String getSequenceNumber(String path){
+ return path.substring(path.lastIndexOf('-') + 1);
+ }
+ @Override
+ public int compare(ChildData lhs, ChildData rhs) {
+ return getSequenceNumber(lhs.getPath()).
+ compareTo(getSequenceNumber(rhs.getPath()));
+ }
+ }
+ );
+
+ if (sortedData.size() == 0){
+ return null;
+ }
+
+ return new String(sortedData.get(0).getData(), Charsets.UTF_8);
}
@Override
@@ -328,6 +345,9 @@
}
+ //TODO what should happen when there's no ZK connection? Currently we just return
+ //the cache but this may lead to false impressions - i.e. we don't actually know
+ //what's in ZK so we shouldn't say we do
@Override
public Map<String, List<ControllerRegistryEntry>> getAllSwitches() {
Map<String, List<ControllerRegistryEntry>> data =
@@ -338,7 +358,8 @@
new ArrayList<ControllerRegistryEntry>();
if (entry.getValue().getCurrentData().size() < 1){
- log.info("Switch entry with no leader elections: {}", entry.getKey());
+ //TODO prevent even having the PathChildrenCache in this case
+ //log.info("Switch entry with no leader elections: {}", entry.getKey());
continue;
}
@@ -358,6 +379,27 @@
return data;
}
+ /**
+ * Returns a block of IDs which are unique and unused.
+ * Range of IDs is fixed size and is assigned incrementally as this method called.
+ * Since the range of IDs is managed by Zookeeper in distributed way, this method may block when
+ * requests come up simultaneously.
+ */
+ public IdBlock allocateUniqueIdBlock(){
+ try {
+ AtomicValue<Long> result = null;
+ do {
+ result = distributedIdCounter.add(ID_BLOCK_SIZE);
+ } while (result == null || !result.succeeded());
+
+ return new IdBlock(result.preValue(), result.postValue() - 1, ID_BLOCK_SIZE);
+ } catch (Exception e) {
+ log.error("Error allocating ID block");
+ }
+
+ return null;
+ }
+
/*
* IFloodlightModule
*/
@@ -386,6 +428,8 @@
return l;
}
+ //TODO currently blocks startup when it can't get a Zookeeper connection.
+ //Do we support starting up with no Zookeeper connection?
@Override
public void init (FloodlightModuleContext context) throws FloodlightModuleException {
log.info("Initialising the Zookeeper Registry - Zookeeper connection required");
@@ -400,31 +444,44 @@
restApi = context.getServiceImpl(IRestApiService.class);
- switchLatches = new HashMap<String, LeaderLatch>();
- switchCallbacks = new HashMap<String, ControlChangeCallback>();
- switchPathCaches = new HashMap<String, PathChildrenCache>();
+ switches = new ConcurrentHashMap<String, SwitchLeadershipData>();
+ //switchPathCaches = new HashMap<String, PathChildrenCache>();
+ switchPathCaches = new ConcurrentHashMap<String, PathChildrenCache>();
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
client = CuratorFrameworkFactory.newClient(this.connectionString,
sessionTimeout, connectionTimeout, retryPolicy);
client.start();
-
client = client.usingNamespace(namespace);
+ distributedIdCounter = new DistributedAtomicLong(
+ client,
+ ID_COUNTER_PATH,
+ new RetryOneTime(100));
- controllerCache = new PathChildrenCache(client, controllerPath, true);
switchCache = new PathChildrenCache(client, switchLatchesPath, true);
switchCache.getListenable().addListener(switchPathCacheListener);
+ //Build the service discovery object
+ serviceDiscovery = ServiceDiscoveryBuilder.builder(ControllerService.class)
+ .client(client).basePath(SERVICES_PATH).build();
+
+ //We read the list of services very frequently (GUI periodically queries them)
+ //so we'll cache them to cut down on Zookeeper queries.
+ serviceCache = serviceDiscovery.serviceCacheBuilder()
+ .name(CONTROLLER_SERVICE_NAME).build();
+
+
try {
- controllerCache.start(StartMode.BUILD_INITIAL_CACHE);
+ serviceDiscovery.start();
+ serviceCache.start();
//Don't prime the cache, we want a notification for each child node in the path
switchCache.start(StartMode.NORMAL);
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new FloodlightModuleException("Error initialising ZookeeperRegistry: "
+ + e.getMessage());
}
}
@@ -432,5 +489,4 @@
public void startUp (FloodlightModuleContext context) {
restApi.addRestletRoutable(new RegistryWebRoutable());
}
-
}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
deleted file mode 100644
index 724095b..0000000
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package net.onrc.onos.util;
-
-import java.util.Set;
-
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.frames.FramedGraph;
-
-public class GraphDBConnection {
- public enum Transaction {
- COMMIT,
- ROLLBACK
- }
- private static GraphDBConnection singleton = new GraphDBConnection( );
- private static TitanGraph graph;
- private static GraphDBUtils utils;
-
- /* A private Constructor prevents any other
- * class from instantiating.
- */
- private GraphDBConnection(){ }
-
- /* Static 'instance' method */
- public static GraphDBConnection getInstance(String conf) {
- if (graph == null||graph.isOpen() == Boolean.FALSE) {
- graph = TitanFactory.open(conf);
- // FIXME: Creation on Indexes should be done only once
- Set<String> s = graph.getIndexedKeys(Vertex.class);
- if (!s.contains("dpid")) {
- graph.createKeyIndex("dpid", Vertex.class);
- }
- if (!s.contains("type")) {
- graph.createKeyIndex("type", Vertex.class);
- }
- if (!s.contains("dl_address")) {
- graph.createKeyIndex("dl_address", Vertex.class);
- }
- if (!s.contains("flow_id")) {
- graph.createKeyIndex("flow_id", Vertex.class);
- }
- if (!s.contains("flow_entry_id")) {
- graph.createKeyIndex("flow_entry_id",
- Vertex.class);
- }
- }
- graph.stopTransaction(Conclusion.SUCCESS);
- if (utils == null) {
- utils = new GraphDBUtils();
- }
- return singleton;
- }
-
- public IDBUtils utils() {
- return utils;
- }
-
- protected FramedGraph<TitanGraph> getFramedGraph() {
-
- if (isValid()) {
- FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
- return fg;
- } else {
- return null;
- }
- }
-
- public Boolean isValid() {
-
- return (graph != null||graph.isOpen());
- }
-
- public void startTx() {
-
- }
-
- public void endTx(Transaction tx) {
- switch (tx) {
- case COMMIT:
- graph.stopTransaction(Conclusion.SUCCESS);
- case ROLLBACK:
- graph.stopTransaction(Conclusion.FAILURE);
- }
- }
-
- public void close() {
-
- }
-
-}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
deleted file mode 100644
index 097cfa0..0000000
--- a/src/main/java/net/onrc/onos/util/GraphDBUtils.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.onrc.onos.util;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.frames.FramedGraph;
-import com.tinkerpop.frames.FramedVertexIterable;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.util.FlowEntryId;
-import net.floodlightcontroller.util.FlowId;
-
-public class GraphDBUtils implements IDBUtils {
-
- @Override
- public ISwitchObject searchSwitch(GraphDBConnection conn, String dpid) {
- // TODO Auto-generated method stub
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-
- return fg.getVertices("dpid",dpid).iterator().hasNext() ?
- fg.getVertices("dpid",dpid,ISwitchObject.class).iterator().next() : null;
-
- }
-
- @Override
- public IDeviceObject searchDevice(GraphDBConnection conn, String macAddr) {
- // TODO Auto-generated method stub
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- return fg.getVertices("dl_address",macAddr).iterator().hasNext() ? fg.getVertices("dl_address",macAddr,
- IDeviceObject.class).iterator().next() : null;
-
- }
-
- @Override
- public IPortObject searchPort(GraphDBConnection conn, String dpid, short number) {
- ISwitchObject sw = searchSwitch(conn, dpid);
- GremlinPipeline<Vertex, IPortObject> pipe = new GremlinPipeline<Vertex, IPortObject>();
- pipe.start(sw.asVertex());
- pipe.out("on").has("number", number);
- FramedVertexIterable<IPortObject> r = new FramedVertexIterable(conn.getFramedGraph(), pipe, IPortObject.class);
- return r.iterator().hasNext() ? r.iterator().next() : null;
- }
-
- @Override
- public IDeviceObject newDevice(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- IDeviceObject obj = fg.addVertex(null,IDeviceObject.class);
- return obj;
- }
-
- @Override
- public void removeDevice(GraphDBConnection conn, IDeviceObject dev) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- fg.removeVertex(dev.asVertex());
- }
-
- @Override
- public Iterable<IDeviceObject> getDevices(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- return fg.getVertices("type","device",IDeviceObject.class);
- }
-
- @Override
- public IFlowPath searchFlowPath(GraphDBConnection conn,
- FlowId flowId) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-
- return fg.getVertices("flow_id", flowId.toString()).iterator().hasNext() ?
- fg.getVertices("flow_id", flowId.toString(),
- IFlowPath.class).iterator().next() : null;
- }
-
- @Override
- public IFlowPath newFlowPath(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- IFlowPath flowPath = fg.addVertex(null, IFlowPath.class);
- return flowPath;
- }
-
- @Override
- public void removeFlowPath(GraphDBConnection conn,
- IFlowPath flowPath) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- fg.removeVertex(flowPath.asVertex());
- }
-
- @Override
- public IFlowPath getFlowPathByFlowEntry(GraphDBConnection conn,
- IFlowEntry flowEntry) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- GremlinPipeline<Vertex, IFlowPath> pipe = new GremlinPipeline<Vertex, IFlowPath>();
- pipe.start(flowEntry.asVertex());
- pipe.out("flow");
- FramedVertexIterable<IFlowPath> r = new FramedVertexIterable(conn.getFramedGraph(), pipe, IFlowPath.class);
- return r.iterator().hasNext() ? r.iterator().next() : null;
- }
-
- @Override
- public Iterable<IFlowPath> getAllFlowPaths(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-
- return fg.getVertices("type", "flow", IFlowPath.class);
- }
-
- @Override
- public IFlowEntry searchFlowEntry(GraphDBConnection conn,
- FlowEntryId flowEntryId) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-
- return fg.getVertices("flow_entry_id", flowEntryId.toString()).iterator().hasNext() ?
- fg.getVertices("flow_entry_id", flowEntryId.toString(),
- IFlowEntry.class).iterator().next() : null;
- }
-
- @Override
- public IFlowEntry newFlowEntry(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- IFlowEntry flowEntry = fg.addVertex(null, IFlowEntry.class);
- return flowEntry;
- }
-
- @Override
- public void removeFlowEntry(GraphDBConnection conn,
- IFlowEntry flowEntry) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
- fg.removeVertex(flowEntry.asVertex());
- }
-
- @Override
- public Iterable<IFlowEntry> getAllFlowEntries(GraphDBConnection conn) {
- FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-
- return fg.getVertices("type", "flow_entry", IFlowEntry.class);
- }
-}
diff --git a/src/main/java/net/onrc/onos/util/IDBUtils.java b/src/main/java/net/onrc/onos/util/IDBUtils.java
deleted file mode 100644
index 48d5946..0000000
--- a/src/main/java/net/onrc/onos/util/IDBUtils.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.onrc.onos.util;
-
-import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.floodlightcontroller.util.FlowEntryId;
-import net.floodlightcontroller.util.FlowId;
-
-public interface IDBUtils {
- public ISwitchObject searchSwitch(GraphDBConnection conn, String dpid);
- public IDeviceObject searchDevice(GraphDBConnection conn, String macAddr);
- public IDeviceObject newDevice(GraphDBConnection conn);
- public void removeDevice(GraphDBConnection conn, IDeviceObject dev);
- public IPortObject searchPort(GraphDBConnection conn, String dpid, short number);
- public Iterable<IDeviceObject> getDevices(GraphDBConnection conn);
- public IFlowPath searchFlowPath(GraphDBConnection conn, FlowId flowId);
- public IFlowPath newFlowPath(GraphDBConnection conn);
- public void removeFlowPath(GraphDBConnection conn, IFlowPath flowPath);
- public IFlowPath getFlowPathByFlowEntry(GraphDBConnection conn,
- IFlowEntry flowEntry);
- public Iterable<IFlowPath> getAllFlowPaths(GraphDBConnection conn);
- public IFlowEntry searchFlowEntry(GraphDBConnection conn,
- FlowEntryId flowEntryId);
- public IFlowEntry newFlowEntry(GraphDBConnection conn);
- public void removeFlowEntry(GraphDBConnection conn,
- IFlowEntry flowEntry);
- public Iterable<IFlowEntry> getAllFlowEntries(GraphDBConnection conn);
-}
diff --git a/src/main/java/org/openflow/protocol/OFMatch.java b/src/main/java/org/openflow/protocol/OFMatch.java
index 0336d7d..397263d 100644
--- a/src/main/java/org/openflow/protocol/OFMatch.java
+++ b/src/main/java/org/openflow/protocol/OFMatch.java
@@ -911,7 +911,7 @@
* one of STR_NW_DST or STR_NW_SRC
* @throws IllegalArgumentException
*/
- private void setFromCIDR(String cidr, String which)
+ public void setFromCIDR(String cidr, String which)
throws IllegalArgumentException {
String values[] = cidr.split("/");
String[] ip_str = values[0].split("\\.");
diff --git a/src/main/java/org/openflow/util/HexString.java b/src/main/java/org/openflow/util/HexString.java
index 5777612..07cc1f7 100644
--- a/src/main/java/org/openflow/util/HexString.java
+++ b/src/main/java/org/openflow/util/HexString.java
@@ -27,35 +27,35 @@
*/
public static String toHexString(byte[] bytes) {
int i;
- String ret = "";
+ StringBuilder ret = new StringBuilder(8*2+7);
String tmp;
for(i=0; i< bytes.length; i++) {
if(i> 0)
- ret += ":";
+ ret.append(':');
tmp = Integer.toHexString(U8.f(bytes[i]));
if (tmp.length() == 1)
- ret += "0";
- ret += tmp;
+ ret.append('0');
+ ret.append(tmp);
}
- return ret;
+ return ret.toString();
}
public static String toHexString(long val, int padTo) {
char arr[] = Long.toHexString(val).toCharArray();
- String ret = "";
+ StringBuilder ret = new StringBuilder(8*2+7);
// prepend the right number of leading zeros
int i = 0;
for (; i < (padTo * 2 - arr.length); i++) {
- ret += "0";
+ ret.append('0');
if ((i % 2) == 1)
- ret += ":";
+ ret.append(':');
}
for (int j = 0; j < arr.length; j++) {
- ret += arr[j];
+ ret.append(arr[j]);
if ((((i + j) % 2) == 1) && (j < (arr.length - 1)))
- ret += ":";
+ ret.append(':');
}
- return ret;
+ return ret.toString();
}
public static String toHexString(long val) {
diff --git a/src/main/python/PythonClient.py b/src/main/python/PythonClient.py
deleted file mode 100644
index 5c9890e..0000000
--- a/src/main/python/PythonClient.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-sys.path.append('../../../target/gen-py')
-
-from packetstreamer import PacketStreamer
-from packetstreamer.ttypes import *
-
-from thrift import Thrift
-from thrift.transport import TSocket
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-
-try:
-
- # Make socket
- transport = TSocket.TSocket('localhost', 9090)
-
- # Buffering is critical. Raw sockets are very slow
- transport = TTransport.TFramedTransport(transport)
-
- # Wrap in a protocol
- protocol = TBinaryProtocol.TBinaryProtocol(transport)
-
- # Create a client to use the protocol encoder
- client = PacketStreamer.Client(protocol)
-
- # Connect!
- transport.open()
-
- while 1:
- packets = client.getPackets("session1")
- print 'session1 packets num: %d' % (len(packets))
- count = 1
- for packet in packets:
- print "Packet %d: %s"% (count, packet)
- if "FilterTimeout" in packet:
- sys.exit()
- count += 1
-
- # Close!
- transport.close()
-
-except Thrift.TException, tx:
- print '%s' % (tx.message)
-
-except KeyboardInterrupt, e:
- print 'Bye-bye'
diff --git a/src/main/python/PythonServer.py b/src/main/python/PythonServer.py
deleted file mode 100644
index c3c844e..0000000
--- a/src/main/python/PythonServer.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import logging
-sys.path.append('../../../target/gen-py')
-
-from packetstreamer import PacketStreamer
-from packetstreamer.ttypes import *
-
-from thrift.transport import TSocket
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-from thrift.server import TServer
-
-class PacketStreamerHandler:
- def __init__(self):
- logging.handlers.codecs = None
- self.log = logging.getLogger("packetstreamer")
- self.log.setLevel(logging.DEBUG)
- handler = logging.handlers.SysLogHandler("/dev/log")
- handler.setFormatter(logging.Formatter("%(name)s: %(levelname)s %(message)s"))
- self.log.addHandler(handler)
-
- def ping(self):
- self.log.debug('ping()')
- return true
-
- def pushPacketSync(self, packet):
- self.log.debug('receive a packet synchronously: %s' %(packet))
- return 0
-
- def pushPacketAsync(self, packet):
- self.log.debug('receive a packet Asynchronously: %s' %(packet))
-
-handler = PacketStreamerHandler()
-processor = PacketStreamer.Processor(handler)
-transport = TSocket.TServerSocket(9090)
-tfactory = TTransport.TBufferedTransportFactory()
-pfactory = TBinaryProtocol.TBinaryProtocolFactory()
-
-server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)
-
-# You could do one of these for a multithreaded server
-#server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
-#server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory)
-
-print 'Starting the server...'
-server.serve()
-print 'done.'
diff --git a/src/main/python/compileall.py b/src/main/python/compileall.py
deleted file mode 100644
index b21d95f..0000000
--- a/src/main/python/compileall.py
+++ /dev/null
@@ -1,157 +0,0 @@
-"""Module/script to "compile" all .py files to .pyc (or .pyo) file.
-
-When called as a script with arguments, this compiles the directories
-given as arguments recursively; the -l option prevents it from
-recursing into directories.
-
-Without arguments, if compiles all modules on sys.path, without
-recursing into subdirectories. (Even though it should do so for
-packages -- for now, you'll have to deal with packages separately.)
-
-See module py_compile for details of the actual byte-compilation.
-
-"""
-
-import os
-import sys
-import py_compile
-
-__all__ = ["compile_dir","compile_path"]
-
-def compile_dir(dir, maxlevels=10, ddir=None,
- force=0, rx=None, quiet=0):
- """Byte-compile all modules in the given directory tree.
-
- Arguments (only dir is required):
-
- dir: the directory to byte-compile
- maxlevels: maximum recursion level (default 10)
- ddir: if given, purported directory name (this is the
- directory name that will show up in error messages)
- force: if 1, force compilation, even if timestamps are up-to-date
- quiet: if 1, be quiet during compilation
-
- """
- if not quiet:
- print 'Listing', dir, '...'
- try:
- names = os.listdir(dir)
- except os.error:
- print "Can't list", dir
- names = []
- names.sort()
- success = 1
- for name in names:
- fullname = os.path.join(dir, name)
- if ddir is not None:
- dfile = os.path.join(ddir, name)
- else:
- dfile = None
- if rx is not None:
- mo = rx.search(fullname)
- if mo:
- continue
- if os.path.isfile(fullname):
- head, tail = name[:-3], name[-3:]
- if tail == '.py':
- cfile = fullname + (__debug__ and 'c' or 'o')
- ftime = os.stat(fullname).st_mtime
- try: ctime = os.stat(cfile).st_mtime
- except os.error: ctime = 0
- if (ctime > ftime) and not force: continue
- if not quiet:
- print 'Compiling', fullname, '...'
- try:
- ok = py_compile.compile(fullname, None, dfile, True)
- except KeyboardInterrupt:
- raise KeyboardInterrupt
- except py_compile.PyCompileError,err:
- if quiet:
- print 'Compiling', fullname, '...'
- print err.msg
- success = 0
- except IOError, e:
- print "Sorry", e
- success = 0
- else:
- if ok == 0:
- success = 0
- elif maxlevels > 0 and \
- name != os.curdir and name != os.pardir and \
- os.path.isdir(fullname) and \
- not os.path.islink(fullname):
- if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, quiet):
- success = 0
- return success
-
-def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
- """Byte-compile all module on sys.path.
-
- Arguments (all optional):
-
- skip_curdir: if true, skip current directory (default true)
- maxlevels: max recursion level (default 0)
- force: as for compile_dir() (default 0)
- quiet: as for compile_dir() (default 0)
-
- """
- success = 1
- for dir in sys.path:
- if (not dir or dir == os.curdir) and skip_curdir:
- print 'Skipping current directory'
- else:
- success = success and compile_dir(dir, maxlevels, None,
- force, quiet=quiet)
- return success
-
-def main():
- """Script main program."""
- import getopt
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
- except getopt.error, msg:
- print msg
- print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
- "[-x regexp] [directory ...]"
- print "-l: don't recurse down"
- print "-f: force rebuild even if timestamps are up-to-date"
- print "-q: quiet operation"
- print "-d destdir: purported directory name for error messages"
- print " if no directory arguments, -l sys.path is assumed"
- print "-x regexp: skip files matching the regular expression regexp"
- print " the regexp is search for in the full path of the file"
- sys.exit(2)
- maxlevels = 10
- ddir = None
- force = 0
- quiet = 0
- rx = None
- for o, a in opts:
- if o == '-l': maxlevels = 0
- if o == '-d': ddir = a
- if o == '-f': force = 1
- if o == '-q': quiet = 1
- if o == '-x':
- import re
- rx = re.compile(a)
- if ddir:
- if len(args) != 1:
- print "-d destdir require exactly one directory argument"
- sys.exit(2)
- success = 1
- try:
- if args:
- for dir in args:
- if not compile_dir(dir, maxlevels, ddir,
- force, rx, quiet):
- success = 0
- else:
- success = compile_path()
- except KeyboardInterrupt:
- print "\n[interrupt]"
- success = 0
- return success
-
-if __name__ == '__main__':
- exit_status = int(not main())
- sys.exit(exit_status)
diff --git a/src/main/python/debugserver.py b/src/main/python/debugserver.py
deleted file mode 100644
index d8c81f9..0000000
--- a/src/main/python/debugserver.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-from threading import currentThread
-from SocketServer import BaseRequestHandler, TCPServer
-from code import InteractiveConsole
-
-_locals = None
-
-class DebugLogger(object):
- def do_print(self, *args):
- for i in args:
- print i,
- print
- info = do_print
- warn = do_print
- debug = do_print
-_log = DebugLogger()
-
-
-class DebugConsole(InteractiveConsole):
- def __init__(self, request):
- self.request = request
- InteractiveConsole.__init__(self, _locals)
-
- def raw_input(self, prompt):
- self.request.send(prompt)
- data = self.request.recv(10000).rstrip()
- if len(data) == 1 and ord(data[0]) == 4:
- sys.exit()
- return data
-
- def write(self, data):
- self.request.send(str(data))
-
- def write_nl(self, data):
- self.write(str(data)+"\r\n")
-
-class DebugServerHandler(BaseRequestHandler):
- def __init__(self, request, client_address, server):
- currentThread()._thread.setName("debugserver-%s:%d" % client_address)
- _log.debug('Open connection to DebugServer from %s:%d' % client_address)
- BaseRequestHandler.__init__(self, request, client_address, server)
-
- def handle(self):
- console = DebugConsole(self.request)
- sys.displayhook = console.write_nl
- console.interact('DebugServer')
- self.request.close()
-
-class DebugServer(TCPServer):
- daemon_threads = True
- allow_reuse_address = True
-
- def handle_error(self, request, client_address):
- _log.debug('Closing connection to DebugServer from %s:%d' % client_address)
- request.close()
-
-def run_server(port=6655, host='0.0.0.0', locals=locals()):
- currentThread()._thread.setName("debugserver-main")
-
- global _locals
- _locals = locals
- if "log" in locals.keys():
- global _log
- _log = locals["log"]
-
- _log.info("Starting DebugServer on port %d" % port)
- server = DebugServer(('', port), DebugServerHandler)
- try:
- server.serve_forever()
- except KeyboardInterrupt:
- pass
-
-if __name__ == "__main__":
- run_server()
diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
index 99ca4c8..fcdd6b5 100644
--- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
+++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
@@ -1,31 +1,28 @@
net.floodlightcontroller.core.FloodlightProvider
net.floodlightcontroller.storage.memory.MemoryStorageSource
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl
-net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
+net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager
net.floodlightcontroller.topology.TopologyManager
net.floodlightcontroller.forwarding.Forwarding
net.floodlightcontroller.flowcache.FlowReconcileManager
-net.floodlightcontroller.core.OFMessageFilterManager
net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher
net.floodlightcontroller.perfmon.PktInProcessingTime
net.floodlightcontroller.perfmon.NullPktInProcessingTime
net.floodlightcontroller.restserver.RestApiServer
-net.floodlightcontroller.learningswitch.LearningSwitch
-net.floodlightcontroller.hub.Hub
-net.floodlightcontroller.jython.JythonDebugInterface
net.floodlightcontroller.counter.CounterStore
net.floodlightcontroller.counter.NullCounterStore
net.floodlightcontroller.threadpool.ThreadPool
net.floodlightcontroller.ui.web.StaticWebRoutable
-net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter
net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier
net.floodlightcontroller.devicemanager.test.MockDeviceManager
net.floodlightcontroller.core.test.MockFloodlightProvider
net.floodlightcontroller.core.test.MockThreadPoolService
-net.floodlightcontroller.firewall.Firewall
-net.floodlightcontroller.onoslistener.OnosPublisher
-net.floodlightcontroller.flowcache.FlowManager
-net.floodlightcontroller.routing.TopoRouteService
+net.onrc.onos.datagrid.HazelcastDatagrid
+net.onrc.onos.ofcontroller.flowmanager.FlowManager
+net.onrc.onos.ofcontroller.flowprogrammer.FlowProgrammer
+net.onrc.onos.ofcontroller.topology.TopologyManager
+net.onrc.onos.ofcontroller.bgproute.BgpRoute
net.onrc.onos.registry.controller.ZookeeperRegistry
net.onrc.onos.registry.controller.StandaloneRegistry
-
+net.onrc.onos.ofcontroller.core.module.OnosModuleLoader
diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties
index 9ea7a92..9f83ec8 100644
--- a/src/main/resources/floodlightdefault.properties
+++ b/src/main/resources/floodlightdefault.properties
@@ -2,18 +2,14 @@
net.floodlightcontroller.core.FloodlightProvider,\
net.floodlightcontroller.threadpool.ThreadPool,\
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl,\
-net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
-net.floodlightcontroller.firewall.Firewall,\
-net.floodlightcontroller.forwarding.Forwarding,\
-net.floodlightcontroller.jython.JythonDebugInterface,\
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
-net.floodlightcontroller.onoslistener.OnosPublisher, \
-net.onrc.onos.registry.controller.StandaloneRegistry
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
+net.onrc.onos.registry.controller.ZookeeperRegistry
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
-net.floodlightcontroller.jython.JythonDebugInterface.port = 6655
net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.floodlightcontroller.onoslistener.OnosPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.EnableCleanup = True
diff --git a/src/main/thrift/packetstreamer.thrift b/src/main/thrift/packetstreamer.thrift
deleted file mode 100644
index 827dd85..0000000
--- a/src/main/thrift/packetstreamer.thrift
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# Interface definition for packetstreamer service
-#
-
-namespace java net.floodlightcontroller.packetstreamer.thrift
-namespace cpp net.floodlightcontroller.packetstreamer
-namespace py packetstreamer
-namespace php packetstreamer
-namespace perl packetstreamer
-
-const string VERSION = "0.1.0"
-
-#
-# data structures
-#
-
-/**
- * OFMessage type
- **/
-enum OFMessageType {
- HELLO = 0,
- ERROR = 1,
- ECHO_REQUEST = 2,
- ECHO_REPLY = 3,
- VENDOR = 4,
- FEATURES_REQUEST = 5,
- FEATURES_REPLY = 6,
- GET_CONFIG_REQUEST = 7,
- GET_CONFIG_REPLY = 8,
- SET_CONFIG = 9,
- PACKET_IN = 10,
- FLOW_REMOVED = 11,
- PORT_STATUS = 12,
- PACKET_OUT = 13,
- FLOW_MOD = 14,
- PORT_MOD = 15,
- STATS_REQUEST = 16,
- STATS_REPLY = 17,
- BARRIER_REQUEST = 18,
- BARRIER_REPLY = 19,
-}
-
-/**
- * A struct that defines switch port tuple
- */
-struct SwitchPortTuple {
- 1: i64 dpid,
- 2: i16 port,
-}
-
-struct Packet {
- 1: OFMessageType messageType,
- 2: SwitchPortTuple swPortTuple,
- 3: binary data,
-}
-
-struct Message {
- 1: list<string> sessionIDs,
- 2: Packet packet,
-}
-
-/**
- * Packetstreamer API
- */
-service PacketStreamer {
-
- /**
- * Synchronous method to get packets for a given sessionid
- */
- list<binary> getPackets(1:string sessionid),
-
- /**
- * Synchronous method to publish a packet.
- * It ensure the order that the packets are pushed
- */
- i32 pushMessageSync(1:Message packet),
-
- /**
- * Asynchronous method to publish a packet.
- * Order is not guaranteed.
- */
- oneway void pushMessageAsync(1:Message packet)
-
- /**
- * Terminate a session
- */
- void terminateSession(1:string sessionid)
-}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index a6948c0..4c9c340 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -17,36 +17,43 @@
package net.floodlightcontroller.core.internal;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.same;
+import static org.easymock.EasyMock.verify;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import net.floodlightcontroller.core.FloodlightProvider;
import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.FloodlightProvider;
import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IFloodlightProviderService.Role;
-import net.floodlightcontroller.core.IOFMessageFilterManagerService;
-import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IHAListener;
import net.floodlightcontroller.core.IListener.Command;
+import net.floodlightcontroller.core.IOFMessageListener;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.IOFSwitchListener;
-import net.floodlightcontroller.core.OFMessageFilterManager;
-import net.floodlightcontroller.core.internal.Controller.IUpdate;
+import net.floodlightcontroller.core.IUpdate;
import net.floodlightcontroller.core.internal.Controller.SwitchUpdate;
import net.floodlightcontroller.core.internal.Controller.SwitchUpdateType;
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
import net.floodlightcontroller.counter.CounterStore;
import net.floodlightcontroller.counter.ICounterStoreService;
@@ -62,6 +69,15 @@
import net.floodlightcontroller.storage.memory.MemoryStorageSource;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
+import net.onrc.onos.ofcontroller.flowmanager.FlowManager;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.registry.controller.IControllerRegistryService;
+import net.onrc.onos.registry.controller.StandaloneRegistry;
import org.easymock.Capture;
import org.easymock.EasyMock;
@@ -72,17 +88,15 @@
import org.openflow.protocol.OFError.OFErrorType;
import org.openflow.protocol.OFFeaturesReply;
import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPacketIn.OFPacketInReason;
import org.openflow.protocol.OFPhysicalPort;
-import org.openflow.protocol.OFPort;
+import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
import org.openflow.protocol.OFPortStatus;
+import org.openflow.protocol.OFPortStatus.OFPortReason;
import org.openflow.protocol.OFStatisticsReply;
import org.openflow.protocol.OFType;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFPortStatus.OFPortReason;
import org.openflow.protocol.OFVendor;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
import org.openflow.protocol.factory.BasicFactory;
import org.openflow.protocol.statistics.OFFlowStatisticsReply;
import org.openflow.protocol.statistics.OFStatistics;
@@ -124,16 +138,30 @@
tp = new MockThreadPoolService();
fmc.addService(IThreadPoolService.class, tp);
+ // Following added by ONOS
+ // TODO replace with mock if further testing is needed.
+ fmc.addService(IFlowService.class, new FlowManager() );
+ fmc.addService(ITopologyNetService.class, new TopologyManager() );
+ StandaloneRegistry sr = new StandaloneRegistry();
+ fmc.addService(IControllerRegistryService.class, sr );
+ LinkDiscoveryManager linkDiscovery = new LinkDiscoveryManager();
+ fmc.addService(ILinkDiscoveryService.class, linkDiscovery);
+
+
ppt.init(fmc);
restApi.init(fmc);
memstorage.init(fmc);
cm.init(fmc);
tp.init(fmc);
+ sr.init(fmc);
+ linkDiscovery.init(fmc);
ppt.startUp(fmc);
restApi.startUp(fmc);
memstorage.startUp(fmc);
cm.startUp(fmc);
tp.startUp(fmc);
+ sr.startUp(fmc);
+ linkDiscovery.startUp(fmc);
}
public Controller getController() {
@@ -359,125 +387,6 @@
}
@Test
- public void testMessageFilterManager() throws Exception {
- class MyOFMessageFilterManager extends OFMessageFilterManager {
- public MyOFMessageFilterManager(int timer_interval) {
- super();
- TIMER_INTERVAL = timer_interval;
- }
- }
- FloodlightModuleContext fmCntx = new FloodlightModuleContext();
- MockFloodlightProvider mfp = new MockFloodlightProvider();
- OFMessageFilterManager mfm = new MyOFMessageFilterManager(100);
- MockThreadPoolService mtp = new MockThreadPoolService();
- fmCntx.addService(IOFMessageFilterManagerService.class, mfm);
- fmCntx.addService(IFloodlightProviderService.class, mfp);
- fmCntx.addService(IThreadPoolService.class, mtp);
- String sid = null;
-
- mfm.init(fmCntx);
- mfm.startUp(fmCntx);
-
- ConcurrentHashMap <String, String> filter;
- int i;
-
- //Adding the filter works -- adds up to the maximum filter size.
- for(i=mfm.getMaxFilterSize(); i > 0; --i) {
- filter = new ConcurrentHashMap<String,String>();
- filter.put("mac", String.format("00:11:22:33:44:%d%d", i,i));
- sid = mfm.setupFilter(null, filter, 60);
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize() - i +1);
- }
-
- // Add one more to see if you can't
- filter = new ConcurrentHashMap<String,String>();
- filter.put("mac", "mac2");
- mfm.setupFilter(null, filter, 10*1000);
-
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize());
-
- // Deleting the filter works.
- mfm.setupFilter(sid, null, -1);
- assertTrue(mfm.getNumberOfFilters() == mfm.getMaxFilterSize()-1);
-
- // Creating mock switch to which we will send packet out and
- IOFSwitch sw = createMock(IOFSwitch.class);
- expect(sw.getId()).andReturn(new Long(0));
-
- // Mock Packet-in
- IPacket testPacket = new Ethernet()
- .setSourceMACAddress("00:44:33:22:11:00")
- .setDestinationMACAddress("00:11:22:33:44:55")
- .setEtherType(Ethernet.TYPE_ARP)
- .setPayload(
- new ARP()
- .setHardwareType(ARP.HW_TYPE_ETHERNET)
- .setProtocolType(ARP.PROTO_TYPE_IP)
- .setHardwareAddressLength((byte) 6)
- .setProtocolAddressLength((byte) 4)
- .setOpCode(ARP.OP_REPLY)
- .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:00"))
- .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
- .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
- .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
- byte[] testPacketSerialized = testPacket.serialize();
-
- // Build the PacketIn
- OFPacketIn pi = ((OFPacketIn) new BasicFactory().getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(testPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) testPacketSerialized.length);
-
- // Mock Packet-out
- OFPacketOut packetOut =
- (OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT);
- packetOut.setBufferId(pi.getBufferId())
- .setInPort(pi.getInPort());
- List<OFAction> poactions = new ArrayList<OFAction>();
- poactions.add(new OFActionOutput(OFPort.OFPP_TABLE.getValue(), (short) 0));
- packetOut.setActions(poactions)
- .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
- .setPacketData(testPacketSerialized)
- .setLengthU(OFPacketOut.MINIMUM_LENGTH+packetOut.getActionsLength()+testPacketSerialized.length);
-
- FloodlightContext cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD, (Ethernet) testPacket);
-
-
- // Let's check the listeners.
- List <IOFMessageListener> lm;
-
- // Check to see if all the listeners are active.
- lm = mfp.getListeners().get(OFType.PACKET_OUT);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- lm = mfp.getListeners().get(OFType.FLOW_MOD);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- lm = mfp.getListeners().get(OFType.PACKET_IN);
- assertTrue(lm.size() == 1);
- assertTrue(lm.get(0).equals(mfm));
-
- HashSet<String> matchedFilters;
-
- // Send a packet in and check if it matches a filter.
- matchedFilters = mfm.getMatchedFilters(pi, cntx);
- assertTrue(matchedFilters.size() == 1);
-
- // Send a packet out and check if it matches a filter
- matchedFilters = mfm.getMatchedFilters(packetOut, cntx);
- assertTrue(matchedFilters.size() == 1);
-
- // Wait for all filters to be timed out.
- Thread.sleep(150);
- assertEquals(0, mfm.getNumberOfFilters());
- }
-
- @Test
public void testAddSwitch() throws Exception {
controller.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
@@ -504,12 +413,11 @@
Channel channel2 = createMock(Channel.class);
expect(newsw.getChannel()).andReturn(channel2);
expect(channel2.getRemoteAddress()).andReturn(null);
- expect(newsw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>());
+ expect(newsw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>()).times(2);
expect(newsw.getCapabilities()).andReturn(0).anyTimes();
expect(newsw.getBuffers()).andReturn(0).anyTimes();
expect(newsw.getTables()).andReturn((byte)0).anyTimes();
expect(newsw.getActions()).andReturn(0).anyTimes();
- expect(newsw.getPorts()).andReturn(new ArrayList<OFPhysicalPort>());
controller.activeSwitches.put(0L, oldsw);
replay(newsw, channel, channel2);
@@ -520,7 +428,7 @@
@Test
public void testUpdateQueue() throws Exception {
- class DummySwitchListener implements IOFSwitchListener {
+ class DummySwitchListener implements IOFSwitchListener, IOFSwitchPortListener {
public int nAdded;
public int nRemoved;
public int nPortChanged;
@@ -545,9 +453,23 @@
nPortChanged++;
notifyAll();
}
+ @Override
+ public void switchPortAdded(Long switchId, OFPhysicalPort port) {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
+ // TODO Auto-generated method stub
+
+ }
}
DummySwitchListener switchListener = new DummySwitchListener();
IOFSwitch sw = createMock(IOFSwitch.class);
+ expect(sw.getId()).andReturn(1L).anyTimes();
+ expect(sw.getEnabledPorts()).andReturn(null);
+ expect(sw.getChannel()).andReturn(null).anyTimes();
+ replay(sw);
ControllerRunThread t = new ControllerRunThread();
t.start();
@@ -747,12 +669,12 @@
controller.setRole(Role.SLAVE);
verify(roleChanger);
- Controller.IUpdate upd = controller.updates.poll();
+ IUpdate upd = controller.updates.poll();
assertNotNull("Check that update queue has an update", upd);
assertTrue("Check that update is HARoleUpdate",
upd instanceof Controller.HARoleUpdate);
Controller.HARoleUpdate roleUpd = (Controller.HARoleUpdate)upd;
- assertSame(null, roleUpd.oldRole);
+ assertSame(Role.MASTER, roleUpd.oldRole);
assertSame(Role.SLAVE, roleUpd.newRole);
}
@@ -806,15 +728,16 @@
state.hasGetConfigReply = true;
// Role support disabled. Switch should be promoted to active switch
// list.
- setupSwitchForAddSwitch(chdlr.sw, 0L);
- chdlr.sw.clearAllFlowMods();
- replay(controller.roleChanger, chdlr.sw);
- chdlr.checkSwitchReady();
- verify(controller.roleChanger, chdlr.sw);
- assertSame(OFChannelState.HandshakeState.READY, state.hsState);
- assertSame(chdlr.sw, controller.activeSwitches.get(0L));
- assertTrue(controller.connectedSwitches.contains(chdlr.sw));
- assertTrue(state.firstRoleReplyReceived);
+// FIXME: ONOS modified the behavior to always submit Role Request to trigger OFS error.
+// setupSwitchForAddSwitch(chdlr.sw, 0L);
+// chdlr.sw.clearAllFlowMods();
+// replay(controller.roleChanger, chdlr.sw);
+// chdlr.checkSwitchReady();
+// verify(controller.roleChanger, chdlr.sw);
+// assertSame(OFChannelState.HandshakeState.READY, state.hsState);
+// assertSame(chdlr.sw, controller.activeSwitches.get(0L));
+// assertTrue(controller.connectedSwitches.contains(chdlr.sw));
+// assertTrue(state.firstRoleReplyReceived);
reset(chdlr.sw);
reset(controller.roleChanger);
controller.connectedSwitches.clear();
@@ -824,9 +747,15 @@
// Role support enabled.
state.hsState = OFChannelState.HandshakeState.FEATURES_REPLY;
controller.role = Role.MASTER;
+ expect(chdlr.sw.getStringId()).andReturn("SomeID").anyTimes();
+ expect(chdlr.sw.getId()).andReturn(42L).anyTimes();
Capture<Collection<OFSwitchImpl>> swListCapture =
new Capture<Collection<OFSwitchImpl>>();
controller.roleChanger.submitRequest(capture(swListCapture),
+ same(Role.SLAVE));
+ Capture<Collection<OFSwitchImpl>> swListCapture2 =
+ new Capture<Collection<OFSwitchImpl>>();
+ controller.roleChanger.submitRequest(capture(swListCapture2),
same(Role.MASTER));
replay(controller.roleChanger, chdlr.sw);
chdlr.checkSwitchReady();
@@ -834,7 +763,7 @@
assertSame(OFChannelState.HandshakeState.READY, state.hsState);
assertTrue(controller.activeSwitches.isEmpty());
assertTrue(controller.connectedSwitches.contains(chdlr.sw));
- assertTrue(state.firstRoleReplyReceived);
+// assertTrue(state.firstRoleReplyReceived);
Collection<OFSwitchImpl> swList = swListCapture.getValue();
assertEquals(1, swList.size());
assertTrue("swList must contain this switch", swList.contains(chdlr.sw));
@@ -930,7 +859,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.SLAVE;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ expect(chdlr.sw.deliverRoleRequestNotSupportedEx(xid)).andReturn(Role.SLAVE);
expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
expect(ch.close()).andReturn(null);
@@ -950,7 +879,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.SLAVE;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ expect(chdlr.sw.deliverRoleRequestNotSupportedEx(xid)).andReturn(Role.SLAVE);
expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
expect(ch.close()).andReturn(null);
replay(ch, chdlr.sw);
@@ -969,7 +898,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.MASTER;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ expect(chdlr.sw.deliverRoleRequestNotSupportedEx(xid)).andReturn(Role.MASTER);
setupSwitchForAddSwitch(chdlr.sw, 0L);
chdlr.sw.clearAllFlowMods();
replay(ch, chdlr.sw);
@@ -1207,6 +1136,26 @@
assertEquals(SwitchUpdateType.PORTCHANGED, swUpdate.switchUpdateType);
}
+ public void verifyPortAddedUpdateInQueue(IOFSwitch sw) throws Exception {
+ assertEquals(2, controller.updates.size());
+ IUpdate update = controller.updates.take();
+ assertEquals(true, update instanceof SwitchUpdate);
+ SwitchUpdate swUpdate = (SwitchUpdate)update;
+ assertEquals(sw, swUpdate.sw);
+ assertEquals(SwitchUpdateType.PORTADDED, swUpdate.switchUpdateType);
+ verifyPortChangedUpdateInQueue(sw);
+ }
+
+ public void verifyPortRemovedUpdateInQueue(IOFSwitch sw) throws Exception {
+ assertEquals(2, controller.updates.size());
+ IUpdate update = controller.updates.take();
+ assertEquals(true, update instanceof SwitchUpdate);
+ SwitchUpdate swUpdate = (SwitchUpdate)update;
+ assertEquals(sw, swUpdate.sw);
+ assertEquals(SwitchUpdateType.PORTREMOVED, swUpdate.switchUpdateType);
+ verifyPortChangedUpdateInQueue(sw);
+ }
+
/*
* Test handlePortStatus()
* TODO: test correct updateStorage behavior!
@@ -1214,6 +1163,7 @@
@Test
public void testHandlePortStatus() throws Exception {
IOFSwitch sw = createMock(IOFSwitch.class);
+ expect(sw.getId()).andReturn(1L).anyTimes();
OFPhysicalPort port = new OFPhysicalPort();
port.setName("myPortName1");
port.setPortNumber((short)42);
@@ -1227,25 +1177,51 @@
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
- verifyPortChangedUpdateInQueue(sw);
+ verifyPortAddedUpdateInQueue(sw);
reset(sw);
+ // ONOS:Port is considered added if Link state is not down and not configured to be down
ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
sw.setPort(port);
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
- verifyPortChangedUpdateInQueue(sw);
+ verifyPortAddedUpdateInQueue(sw);
reset(sw);
+ // ONOS:Port is considered removed if Link state is down
+ ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
+ port.setState(OFPortState.OFPPS_LINK_DOWN.getValue());
+ sw.setPort(port);
+ expectLastCall().once();
+ replay(sw);
+ controller.handlePortStatusMessage(sw, ofps, false);
+ verify(sw);
+ verifyPortRemovedUpdateInQueue(sw);
+ reset(sw);
+ port.setState(0);// reset
+
+ // ONOS: .. or is configured to be down
+ ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
+ port.setConfig(OFPortConfig.OFPPC_PORT_DOWN.getValue());
+ sw.setPort(port);
+ expectLastCall().once();
+ replay(sw);
+ controller.handlePortStatusMessage(sw, ofps, false);
+ verify(sw);
+ verifyPortRemovedUpdateInQueue(sw);
+ reset(sw);
+ port.setConfig(0);// reset
+
+
ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
sw.deletePort(port.getPortNumber());
expectLastCall().once();
replay(sw);
controller.handlePortStatusMessage(sw, ofps, false);
verify(sw);
- verifyPortChangedUpdateInQueue(sw);
+ verifyPortRemovedUpdateInQueue(sw);
reset(sw);
}
}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
index 758cd05..128c09f 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
@@ -197,7 +197,7 @@
sw.role = Role.SLAVE;
sw.pendingRoleRequests.add(pending);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(pending.xid);
+ sw.deliverRoleRequestNotSupportedEx(pending.xid);
verify(sw.channel);
assertEquals(false, sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE));
assertEquals(null, sw.role);
@@ -210,7 +210,7 @@
sw.role = Role.SLAVE;
expect(sw.channel.close()).andReturn(null);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(1);
+ sw.deliverRoleRequestNotSupportedEx(1);
verify(sw.channel);
assertEquals(null, sw.role);
assertEquals(0, sw.pendingRoleRequests.size());
@@ -228,7 +228,7 @@
sw.pendingRoleRequests.add(pending);
expect(sw.channel.close()).andReturn(null);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(pending.xid+1);
+ sw.deliverRoleRequestNotSupportedEx(pending.xid+1);
verify(sw.channel);
assertEquals(null, sw.role);
assertEquals(0, sw.pendingRoleRequests.size());
diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java
new file mode 100644
index 0000000..2aeb60e
--- /dev/null
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleChangeCallbackTest.java
@@ -0,0 +1,143 @@
+package net.floodlightcontroller.core.internal;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+// Extends Controller class to access protected inner class
+public class RoleChangeCallbackTest extends Controller {
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test if {@link RoleChangeCallback#controlChanged(long, boolean)} correctly calls {@link RoleChanger#submitRequest(Collection, net.floodlightcontroller.core.IFloodlightProviderService.Role)}
+ * when connectedSwitch is not empty.
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testNormalSwitches() throws Exception {
+ Long [] dpids = new Long [] { 1000L, 1001L, 1002L, 1003L };
+ final long dpidExist = 1000L;
+ final long dpidNotExist = 2000L;
+
+ roleChanger = EasyMock.createMock(RoleChanger.class);
+
+ // First call will be called with (dpidExist,true)
+ roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>)EasyMock.getCurrentArguments()[0];
+ Role role = (Role)EasyMock.getCurrentArguments()[1];
+
+ List<Long> dpids = new ArrayList<Long>();
+
+ for(OFSwitchImpl sw : switches) {
+ dpids.add(sw.getId());
+ }
+ assertTrue(dpids.contains(dpidExist));
+ assertEquals(role, Role.MASTER);
+
+ return null;
+ }
+ }).once();
+
+ // Second call will be called with (dpidExist,false)
+ roleChanger.submitRequest(EasyMock.anyObject(Collection.class), EasyMock.anyObject(Role.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ Collection<OFSwitchImpl> switches = (Collection<OFSwitchImpl>)EasyMock.getCurrentArguments()[0];
+ Role role = (Role)EasyMock.getCurrentArguments()[1];
+
+ List<Long> dpids = new ArrayList<Long>();
+
+ for(OFSwitchImpl sw : switches) {
+ dpids.add(sw.getId());
+ }
+ assertTrue(dpids.contains(dpidExist));
+ assertEquals(role, Role.SLAVE);
+
+ return null;
+ }
+ }).once();
+
+ EasyMock.replay(roleChanger);
+
+ initNetwork(roleChanger, dpids);
+
+ RoleChangeCallback callback = new RoleChangeCallback();
+ callback.controlChanged(dpidExist, true);
+ callback.controlChanged(dpidExist, false);
+ callback.controlChanged(dpidNotExist, true);
+ callback.controlChanged(dpidNotExist, false);
+
+ EasyMock.verify(roleChanger);
+ }
+
+ /**
+ * Test if {@link RoleChangeCallback#controlChanged(long, boolean)} doesn't call RoleChanger methods
+ * when connectedSwitch is empty.
+ * @throws Exception
+ */
+ @Test
+ public void testEmptySwitches() throws Exception {
+ Long [] dpids = new Long [] {};
+ final long dpidToTest = 1000L;
+
+ roleChanger = EasyMock.createMock(RoleChanger.class);
+ // roleChanger methods must not be used
+ EasyMock.replay(roleChanger);
+
+ initNetwork(roleChanger, dpids);
+
+ RoleChangeCallback callback = new RoleChangeCallback();
+ callback.controlChanged(dpidToTest, true);
+ callback.controlChanged(dpidToTest, false);
+
+ EasyMock.verify(roleChanger);
+ }
+
+ /**
+ * Create mock OFSwitchImpl object.
+ * @param id
+ * @return
+ */
+ private OFSwitchImpl createOFSwitchImplMock(Long id) {
+ OFSwitchImpl sw = EasyMock.createMock(OFSwitchImpl.class);
+
+ EasyMock.expect(sw.getId()).andReturn(id).anyTimes();
+ EasyMock.replay(sw);
+
+ return sw;
+ }
+
+ /**
+ * Setup connectedSwitches
+ * @param changer
+ * @param ids
+ * @throws Exception
+ */
+ private void initNetwork(RoleChanger changer, Long [] ids) throws Exception {
+ connectedSwitches = new HashSet<OFSwitchImpl>();
+
+ for(Long id : ids) {
+ connectedSwitches.add(createOFSwitchImplMock(id));
+ }
+ }
+}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
index 991afff..a6a6d85 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
@@ -16,6 +16,7 @@
import org.easymock.EasyMock;
import org.jboss.netty.channel.Channel;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class RoleChangerTest {
@@ -58,6 +59,7 @@
* The connection should be closed.
*/
@Test
+ @Ignore // FIXME: ONOS modified the behavior here to intentionally trigger OFS error.
public void testSendRoleRequestMasterNotSupported() {
LinkedList<OFSwitchImpl> switches = new LinkedList<OFSwitchImpl>();
diff --git a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java b/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
deleted file mode 100644
index b4a044f..0000000
--- a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
+++ /dev/null
@@ -1,275 +0,0 @@
-package net.floodlightcontroller.core.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import net.floodlightcontroller.core.ISwitchStorage;
-import net.floodlightcontroller.core.ISwitchStorage.SwitchState;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openflow.protocol.OFPhysicalPort;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-import com.tinkerpop.pipes.PipeFunction;
-import com.tinkerpop.pipes.branch.LoopPipe.LoopBundle;
-
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
-
-
-public class SwitchStorageImplTest {
-
- private ISwitchStorage switchStorage;
- private TitanGraph titanGraph;
-
- @Before
- public void setUp() throws Exception {
- titanGraph = TestDatabaseManager.getTestDatabase();
- TestDatabaseManager.populateTestData(titanGraph);
-
- switchStorage = new TestableSwitchStorageImpl(titanGraph);
- }
-
- @After
- public void tearDown() throws Exception {
- titanGraph.shutdown();
- }
-
- @Ignore @Test
- public void testUpdate() {
- fail("Not yet implemented");
- }
-
- @Test
- public void testAddPort() {
-
- String dpid = "00:00:00:00:00:00:0a:01";
- short portNumber = 5;
-
- OFPhysicalPort portToAdd = new OFPhysicalPort();
- portToAdd.setName("port 5 at SEA switch");
- portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
- portToAdd.setPortNumber(portNumber);
-
- switchStorage.addPort(dpid, portToAdd);
-
- Vertex sw = titanGraph.getVertices("dpid", dpid).iterator().next();
-
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- pipe.start(sw).out("on").has("number", portNumber);
-
- assertTrue(pipe.hasNext());
- Vertex addedPort = pipe.next();
- assertFalse(pipe.hasNext());
-
- assertEquals(addedPort.getProperty("number"), portNumber);
- }
-
- @Ignore @Test
- public void testGetPorts() {
- fail("Not yet implemented");
- }
-
- @Ignore @Test
- public void testGetPortStringShort() {
- fail("Not yet implemented");
- }
-
- @Ignore @Test
- public void testGetPortStringString() {
- fail("Not yet implemented");
- }
-
- @Test
- public void testAddSwitch() {
- String dpid = "00:00:00:00:00:00:0a:07";
-
- switchStorage.addSwitch(dpid);
-
- Iterator<Vertex> it = titanGraph.getVertices("dpid", dpid).iterator();
- assertTrue(it.hasNext());
- Vertex addedSwitch = it.next();
- assertFalse(it.hasNext());
-
- assertEquals(addedSwitch.getProperty("type"), "switch");
- assertEquals(addedSwitch.getProperty("dpid"), dpid);
- assertEquals(addedSwitch.getProperty("state"), SwitchState.ACTIVE.toString());
- }
-
-
- @Test
- public void testDeleteSwitch() {
- String dpid = "00:00:00:00:00:00:0a:01";
-
- switchStorage.deleteSwitch(dpid);
-
- Iterator<Vertex> it = titanGraph.getVertices("dpid", dpid).iterator();
- assertFalse(it.hasNext());
- }
-
- @Test
- public void testDeletePortByPortNum() {
- //FIXME fails because query for the port is wrong in SwitchStorageImpl
-
- String dpid = "00:00:00:00:00:00:0a:01";
- short portNum = 3;
-
- switchStorage.deletePort(dpid, portNum);
-
- Vertex sw = titanGraph.getVertices("dpid", dpid).iterator().next();
-
- /*
- Iterator<Vertex> it = sw.getVertices(Direction.OUT, "on").iterator();
-
- while (it.hasNext()){
- System.out.println(it.next());
- }
- */
-
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- pipe.start(sw).out("on").has("number", portNum);
- assertFalse(pipe.hasNext());
- }
-
- @Ignore @Test
- public void testDeletePortStringString() {
- fail("Not yet implemented");
- }
-
- @Ignore @Test
- public void testGetActiveSwitches() {
- fail("Not yet implemented");
- }
-
- static class MyLoopFunction implements PipeFunction<LoopBundle<Vertex>, Boolean> {
- String dpid;
- public MyLoopFunction(String dpid) {
- super();
- this.dpid = dpid;
- }
- public Boolean compute(LoopBundle<Vertex> bundle) {
- Boolean output = false;
- if (bundle.getObject().getProperty("dpid") != dpid) {
- output = true;
- }
- return output;
- }
- }
-
- @Test
- public void testShortestPath() {
- String dpid_src = "00:00:00:00:00:00:0a:01";
- String dpid_dest = "00:00:00:00:00:00:0a:06";
-
- //
- // Implement the Shortest Path between two vertices by using
- // the following Gremlin CLI code:
- // v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path(){it.dpid}{it.number}{it.number}
- // The equivalent code used here is:
- // results = []; v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path().fill(results)
- //
-
- String gremlin = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid}.path().fill(results)";
-
- String gremlin_nopath = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != \"NO-SUCH-DPID\"}.path().fill(results)";
-
- // Get the source vertex
- Iterator<Vertex> iter = titanGraph.getVertices("dpid", dpid_src).iterator();
- if (! iter.hasNext())
- return; // Source vertex not found
- Vertex v_src = iter.next();
-
- // Get the destination vertex
- iter = titanGraph.getVertices("dpid", dpid_dest).iterator();
- if (! iter.hasNext())
- return; // Destination vertex not found
- Vertex v_dest = iter.next();
-
- //
- // Implement the Gremlin script and run it
- //
- ScriptEngine engine = new GremlinGroovyScriptEngine();
-
- ArrayList<ArrayList<Vertex>> results = new ArrayList<ArrayList<Vertex>>();
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("g", titanGraph);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("v_src", v_src);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("v_dest", v_dest);
- engine.getBindings(ScriptContext.ENGINE_SCOPE).put("results", results);
-
- try {
- engine.eval(gremlin);
- } catch (ScriptException e) {
- System.err.println("Caught ScriptException running Gremlin script: " + e.getMessage());
- return;
- }
-
- //
- // Extract the result and compose it into a string
- //
- String results_str = "";
- // System.out.println("BEGIN " + results.size());
- for (ArrayList<Vertex> lv : results) {
- // System.out.println(lv);
- for (Vertex v: lv) {
- // System.out.println(v);
- String type = v.getProperty("type").toString();
- results_str += "[type: " + type;
- // System.out.println("type: " + type);
- if (type.equals("port")) {
- String number = v.getProperty("number").toString();
- // System.out.println("number: " + number);
- results_str += " number: " + number + "]";
- }
- if (type.equals("switch")) {
- String dpid = v.getProperty("dpid").toString();
- // System.out.println("dpid: " + dpid);
- results_str += " dpid: " + dpid + "]";
- }
- }
- }
- // System.out.println("END\n");
- System.out.println(results_str);
-
- String expected_result = "[type: switch dpid: 00:00:00:00:00:00:0a:01][type: port number: 2][type: port number: 1][type: switch dpid: 00:00:00:00:00:00:0a:03][type: port number: 2][type: port number: 2][type: switch dpid: 00:00:00:00:00:00:0a:04][type: port number: 3][type: port number: 1][type: switch dpid: 00:00:00:00:00:00:0a:06]";
-
-
- // Pipe<Vertex, Vertex> pipe = Gremlin.compile(gremlin);
- // pipe.setStarts(new SingleIterator<Vertex>(v1));
-
- //
- // XXX: An alternative (faster?) solution that fails to compile
- //
- // MyLoopFunction whileFunction = new MyLoopFunction(dpid_dest);
- // GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- // ArrayList<ArrayList<Vertex>> results2 = new ArrayList<ArrayList<Vertex>>();
- // TODO: The statement below doesn't compile
- // pipe.start(v_src).as("x").out("on").out("link").in("on").dedup().loop("x", whileFunction).path().fill(results2);
-
- // Check the result
- assertEquals(results_str, expected_result);
-
- //
- // Test Shortest-Path computation to non-existing destination
- //
- results.clear();
- try {
- engine.eval(gremlin_nopath);
- } catch (ScriptException e) {
- System.err.println("Caught ScriptException running Gremlin script: " + e.getMessage());
- return;
- }
- assertTrue(results.size() == 0);
- }
-}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
index cea67c3..4e6477b 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
@@ -8,9 +8,8 @@
import java.util.Iterator;
import java.util.Set;
-import junit.framework.Assert;
-
import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
@@ -18,6 +17,7 @@
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader;
+@SuppressWarnings("deprecation")
public class TestDatabaseManager {
private static final String testDbLocation = "/tmp/onos-testdb";
@@ -27,7 +27,8 @@
public static TitanGraph getTestDatabase(){
//return TitanFactory.open(testDbLocation);
- return TitanFactory.openInMemoryGraph();
+// return TitanFactory.openInMemoryGraph();
+ return TitanFactory.open(testDbLocation);
}
public static void populateTestData(TitanGraph titanGraph){
@@ -57,8 +58,17 @@
Iterator<Vertex> it = titanGraph.getVertices("type", "port").iterator();
while (it.hasNext()){
Vertex port = it.next();
- Integer portNum = (Integer) port.getProperty("number");
- port.setProperty("number", portNum.shortValue());
+
+ if(port.getProperty("number") instanceof Short)
+ {
+ Short portNum = (Short) port.getProperty("number");
+ port.setProperty("number", portNum.shortValue());
+ }
+ else{
+ Integer portNum = (Integer) port.getProperty("number");
+ port.setProperty("number", portNum.shortValue());
+ }
+
}
titanGraph.stopTransaction(Conclusion.SUCCESS);
}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java b/src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java
deleted file mode 100644
index 0d429e6..0000000
--- a/src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.floodlightcontroller.core.internal;
-
-import java.util.Set;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-
-/**
- * Seam that allows me to set up a testable instance of SwitchStorageImpl that
- * writes to a file database rather than a Cassandra cluster.
- * It seems the init() API on SwitchStorageImpl might change so I won't rely
- * on it yet.
- *
- * @author jono
- *
- */
-
-public class TestableSwitchStorageImpl extends SwitchStorageImpl {
-
- public TestableSwitchStorageImpl(TitanGraph graph){
- this.graph = graph;
- }
-
- @Override
- public void init(String conf){
- Set<String> s = graph.getIndexedKeys(Vertex.class);
- if (!s.contains("dpid")) {
- graph.createKeyIndex("dpid", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
- if (!s.contains("type")) {
- graph.createKeyIndex("type", Vertex.class);
- graph.stopTransaction(Conclusion.SUCCESS);
- }
-
- }
-}
diff --git a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
index 2ba838e..be43a8b 100644
--- a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
+++ b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
@@ -19,7 +19,7 @@
import net.floodlightcontroller.topology.TopologyManager;
public class FloodlightTestModuleLoader extends FloodlightModuleLoader {
- protected static Logger log = LoggerFactory.getLogger(FloodlightTestModuleLoader.class);
+ protected final static Logger log = LoggerFactory.getLogger(FloodlightTestModuleLoader.class);
// List of default modules to use unless specified otherwise
public static final Class<? extends IFloodlightModule> DEFAULT_STORAGE_SOURCE =
diff --git a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
index e83fc58..2a158e5 100644
--- a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
+++ b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java
@@ -38,6 +38,7 @@
import net.floodlightcontroller.core.IOFSwitchFilter;
import net.floodlightcontroller.core.IOFSwitchListener;
import net.floodlightcontroller.core.IListener.Command;
+import net.floodlightcontroller.core.IUpdate;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
@@ -57,7 +58,7 @@
* @author David Erickson (daviderickson@cs.stanford.edu)
*/
public class MockFloodlightProvider implements IFloodlightModule, IFloodlightProviderService {
- protected static Logger log = LoggerFactory.getLogger(MockFloodlightProvider.class);
+ protected final static Logger log = LoggerFactory.getLogger(MockFloodlightProvider.class);
protected ConcurrentMap<OFType, ListenerDispatcher<OFType,IOFMessageListener>> listeners;
protected List<IOFSwitchListener> switchListeners;
protected List<IHAListener> haListeners;
@@ -347,4 +348,10 @@
// TODO Auto-generated method stub
}
+
+ @Override
+ public void publishUpdate(IUpdate update) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
index e266d4a..7afb78a 100644
--- a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
+++ b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
@@ -65,6 +65,7 @@
import org.easymock.EasyMock;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.openflow.protocol.OFPacketIn;
import org.openflow.protocol.OFPhysicalPort;
@@ -74,9 +75,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Ignore //TODO broken 11/19/13, should fix
public class DeviceManagerImplTest extends FloodlightTestCase {
- protected static Logger logger =
+ protected final static Logger logger =
LoggerFactory.getLogger(DeviceManagerImplTest.class);
protected OFPacketIn packetIn_1, packetIn_2, packetIn_3;
diff --git a/src/test/java/net/floodlightcontroller/firewall/FirewallTest.java b/src/test/java/net/floodlightcontroller/firewall/FirewallTest.java
deleted file mode 100644
index 959bb49..0000000
--- a/src/test/java/net/floodlightcontroller/firewall/FirewallTest.java
+++ /dev/null
@@ -1,513 +0,0 @@
-package net.floodlightcontroller.firewall;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.test.MockFloodlightProvider;
-import net.floodlightcontroller.packet.ARP;
-import net.floodlightcontroller.packet.Data;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.packet.TCP;
-import net.floodlightcontroller.packet.UDP;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.restserver.RestApiServer;
-import net.floodlightcontroller.routing.IRoutingDecision;
-import net.floodlightcontroller.storage.IStorageSourceService;
-import net.floodlightcontroller.storage.memory.MemoryStorageSource;
-import net.floodlightcontroller.test.FloodlightTestCase;
-import net.floodlightcontroller.util.MACAddress;
-
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFType;
-import org.openflow.util.HexString;
-
-/**
- * Unit test for stateless firewall implemented as a Google Summer of Code project.
- *
- * @author Amer Tahir
- */
-public class FirewallTest extends FloodlightTestCase {
- protected MockFloodlightProvider mockFloodlightProvider;
- protected FloodlightContext cntx;
- protected OFPacketIn packetIn;
- protected IOFSwitch sw;
- protected IPacket tcpPacket;
- protected IPacket broadcastARPPacket;
- protected IPacket ARPReplyPacket;
- protected IPacket broadcastIPPacket;
- protected IPacket tcpPacketReply;
- protected IPacket broadcastMalformedPacket;
- private Firewall firewall;
- public static String TestSwitch1DPID = "00:00:00:00:00:00:00:01";
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- cntx = new FloodlightContext();
- mockFloodlightProvider = getMockFloodlightProvider();
- firewall = new Firewall();
- IStorageSourceService storageService = new MemoryStorageSource();
- RestApiServer restApi = new RestApiServer();
-
- // Mock switches
- long dpid = HexString.toLong(TestSwitch1DPID);
- sw = EasyMock.createNiceMock(IOFSwitch.class);
- expect(sw.getId()).andReturn(dpid).anyTimes();
- expect(sw.getStringId()).andReturn(TestSwitch1DPID).anyTimes();
- replay(sw);
- // Load the switch map
- Map<Long, IOFSwitch> switches = new HashMap<Long, IOFSwitch>();
- switches.put(dpid, sw);
- mockFloodlightProvider.setSwitches(switches);
-
- FloodlightModuleContext fmc = new FloodlightModuleContext();
- fmc.addService(IFloodlightProviderService.class,
- mockFloodlightProvider);
- fmc.addService(IFirewallService.class, firewall);
- fmc.addService(IStorageSourceService.class, storageService);
- fmc.addService(IRestApiService.class, restApi);
-
- try {
- restApi.init(fmc);
- } catch (FloodlightModuleException e) {
- e.printStackTrace();
- }
-
- firewall.init(fmc);
- firewall.startUp(fmc);
-
- // Build our test packet
- this.tcpPacket = new Ethernet()
- .setDestinationMACAddress("00:11:22:33:44:55")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new TCP()
- .setSourcePort((short) 81)
- .setDestinationPort((short) 80)
- .setPayload(new Data(new byte[] {0x01}))));
-
- // Build a broadcast ARP packet
- this.broadcastARPPacket = new Ethernet()
- .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_ARP)
- .setPayload(
- new ARP()
- .setHardwareType(ARP.HW_TYPE_ETHERNET)
- .setProtocolType(ARP.PROTO_TYPE_IP)
- .setOpCode(ARP.OP_REQUEST)
- .setHardwareAddressLength((byte)6)
- .setProtocolAddressLength((byte)4)
- .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:00"))
- .setSenderProtocolAddress(IPv4.toIPv4Address("192.168.1.1"))
- .setTargetHardwareAddress(Ethernet.toMACAddress("00:00:00:00:00:00"))
- .setTargetProtocolAddress(IPv4.toIPv4Address("192.168.1.2"))
- .setPayload(new Data(new byte[] {0x01})));
-
- // Build a ARP packet
- this.ARPReplyPacket = new Ethernet()
- .setDestinationMACAddress("00:44:33:22:11:00")
- .setSourceMACAddress("00:11:22:33:44:55")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_ARP)
- .setPayload(
- new ARP()
- .setHardwareType(ARP.HW_TYPE_ETHERNET)
- .setProtocolType(ARP.PROTO_TYPE_IP)
- .setOpCode(ARP.OP_REQUEST)
- .setHardwareAddressLength((byte)6)
- .setProtocolAddressLength((byte)4)
- .setSenderHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
- .setSenderProtocolAddress(IPv4.toIPv4Address("192.168.1.2"))
- .setTargetHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:00"))
- .setTargetProtocolAddress(IPv4.toIPv4Address("192.168.1.1"))
- .setPayload(new Data(new byte[] {0x01})));
-
- // Build a broadcast IP packet
- this.broadcastIPPacket = new Ethernet()
- .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.255")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
-
- // Build a malformed broadcast packet
- this.broadcastMalformedPacket = new Ethernet()
- .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
-
- this.tcpPacketReply = new Ethernet()
- .setDestinationMACAddress("00:44:33:22:11:00")
- .setSourceMACAddress("00:11:22:33:44:55")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.2")
- .setDestinationAddress("192.168.1.1")
- .setPayload(new TCP()
- .setSourcePort((short) 80)
- .setDestinationPort((short) 81)
- .setPayload(new Data(new byte[] {0x02}))));
- }
-
- protected void setPacketIn(IPacket packet) {
- byte[] serializedPacket = packet.serialize();
- // Build the PacketIn
- this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(serializedPacket)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) serializedPacket.length);
-
- // Add the packet to the context store
- IFloodlightProviderService.bcStore.
- put(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
- (Ethernet)packet);
- }
-
- @Test
- public void testNoRules() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
- // simulate a packet-in event
- this.setPacketIn(tcpPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- assertEquals(0, firewall.rules.size());
-
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- // no rules to match, so firewall should deny
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.DROP);
- }
-
- @Test
- public void testReadRulesFromStorage() throws Exception {
- // add 2 rules first
- FirewallRule rule = new FirewallRule();
- rule.in_port = 2;
- rule.dl_src = MACAddress.valueOf("00:00:00:00:00:01").toLong();
- rule.dl_dst = MACAddress.valueOf("00:00:00:00:00:02").toLong();
- rule.priority = 1;
- rule.action = FirewallRule.FirewallAction.DENY;
- firewall.addRule(rule);
- rule = new FirewallRule();
- rule.in_port = 3;
- rule.dl_src = MACAddress.valueOf("00:00:00:00:00:02").toLong();
- rule.dl_dst = MACAddress.valueOf("00:00:00:00:00:01").toLong();
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.tp_dst = 80;
- rule.priority = 2;
- rule.action = FirewallRule.FirewallAction.ALLOW;
- firewall.addRule(rule);
-
- List<FirewallRule> rules = firewall.readRulesFromStorage();
- // verify rule 1
- FirewallRule r = rules.get(0);
- assertEquals(r.in_port, 2);
- assertEquals(r.priority, 1);
- assertEquals(r.dl_src, MACAddress.valueOf("00:00:00:00:00:01").toLong());
- assertEquals(r.dl_dst, MACAddress.valueOf("00:00:00:00:00:02").toLong());
- assertEquals(r.action, FirewallRule.FirewallAction.DENY);
- // verify rule 2
- r = rules.get(1);
- assertEquals(r.in_port, 3);
- assertEquals(r.priority, 2);
- assertEquals(r.dl_src, MACAddress.valueOf("00:00:00:00:00:02").toLong());
- assertEquals(r.dl_dst, MACAddress.valueOf("00:00:00:00:00:01").toLong());
- assertEquals(r.nw_proto, IPv4.PROTOCOL_TCP);
- assertEquals(r.tp_dst, 80);
- assertEquals(r.wildcard_nw_proto, false);
- assertEquals(r.action, FirewallRule.FirewallAction.ALLOW);
- }
-
- @Test
- public void testRuleInsertionIntoStorage() throws Exception {
- // add TCP rule
- FirewallRule rule = new FirewallRule();
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.priority = 1;
- firewall.addRule(rule);
-
- List<Map<String, Object>> rulesFromStorage = firewall.getStorageRules();
- assertEquals(1, rulesFromStorage.size());
- assertEquals(Integer.parseInt((String)rulesFromStorage.get(0).get("ruleid")), rule.ruleid);
- }
-
- @Test
- public void testRuleDeletion() throws Exception {
- // add TCP rule
- FirewallRule rule = new FirewallRule();
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.priority = 1;
- firewall.addRule(rule);
- int rid = rule.ruleid;
-
- List<Map<String, Object>> rulesFromStorage = firewall.getStorageRules();
- assertEquals(1, rulesFromStorage.size());
- assertEquals(Integer.parseInt((String)rulesFromStorage.get(0).get("ruleid")), rid);
-
- // delete rule
- firewall.deleteRule(rid);
- rulesFromStorage = firewall.getStorageRules();
- assertEquals(0, rulesFromStorage.size());
- }
-
- @Test
- public void testFirewallDisabled() throws Exception {
- // firewall isn't enabled by default
- // so, it shouldn't make any decision
-
- // add TCP rule
- FirewallRule rule = new FirewallRule();
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.priority = 1;
- firewall.addRule(rule);
-
- this.setPacketIn(tcpPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- assertEquals(1, firewall.rules.size());
-
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertNull(decision);
- }
-
- @Test
- public void testSimpleAllowRule() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
-
- // add TCP rule
- FirewallRule rule = new FirewallRule();
- rule.dl_type = Ethernet.TYPE_IPv4;
- rule.wildcard_dl_type = false;
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- // source is IP 192.168.1.2
- rule.nw_src_prefix = IPv4.toIPv4Address("192.168.1.2");
- rule.wildcard_nw_src = false;
- // dest is network 192.168.1.0/24
- rule.nw_dst_prefix = IPv4.toIPv4Address("192.168.1.0");
- rule.nw_dst_maskbits = 24;
- rule.wildcard_nw_dst = false;
- rule.priority = 1;
- firewall.addRule(rule);
-
- // simulate a packet-in events
-
- this.setPacketIn(tcpPacketReply);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.FORWARD_OR_FLOOD);
-
- // clear decision
- IRoutingDecision.rtStore.remove(cntx, IRoutingDecision.CONTEXT_DECISION);
-
- this.setPacketIn(tcpPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.DROP);
- }
-
- @Test
- public void testOverlappingRules() throws Exception {
- firewall.enableFirewall(true);
-
- // add TCP port 80 (destination only) allow rule
- FirewallRule rule = new FirewallRule();
- rule.dl_type = Ethernet.TYPE_IPv4;
- rule.wildcard_dl_type = false;
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.tp_dst = 80;
- rule.priority = 1;
- firewall.addRule(rule);
-
- // add block all rule
- rule = new FirewallRule();
- rule.action = FirewallRule.FirewallAction.DENY;
- rule.priority = 2;
- firewall.addRule(rule);
-
- assertEquals(2, firewall.rules.size());
-
- // packet destined to TCP port 80 - should be allowed
-
- this.setPacketIn(tcpPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.FORWARD_OR_FLOOD);
-
- // clear decision
- IRoutingDecision.rtStore.remove(cntx, IRoutingDecision.CONTEXT_DECISION);
-
- // packet destined for port 81 - should be denied
-
- this.setPacketIn(tcpPacketReply);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.DROP);
- }
-
- @Test
- public void testARP() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
-
- // no rules inserted so all traffic other than broadcast and ARP-request-broadcast should be blocked
-
- // simulate an ARP broadcast packet-in event
-
- this.setPacketIn(broadcastARPPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- // broadcast-ARP traffic should be allowed
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(IRoutingDecision.RoutingAction.MULTICAST, decision.getRoutingAction());
-
- // clear decision
- IRoutingDecision.rtStore.remove(cntx, IRoutingDecision.CONTEXT_DECISION);
-
- // simulate an ARP reply packet-in event
-
- this.setPacketIn(ARPReplyPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- // ARP reply traffic should be denied
- decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.DROP);
- }
-
- @Test
- public void testIPBroadcast() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
-
- // set subnet mask for IP broadcast
- firewall.setSubnetMask("255.255.255.0");
-
- // no rules inserted so all traffic other than broadcast and ARP-request-broadcast should be blocked
-
- // simulate a packet-in event
-
- this.setPacketIn(broadcastIPPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- // broadcast traffic should be allowed
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(IRoutingDecision.RoutingAction.MULTICAST, decision.getRoutingAction());
- }
-
- @Test
- public void testMalformedIPBroadcast() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
-
- // no rules inserted so all traffic other than broadcast and ARP-request-broadcast should be blocked
-
- // simulate a packet-in event
-
- this.setPacketIn(broadcastMalformedPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- // malformed broadcast traffic should NOT be allowed
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.DROP);
- }
-
- @Test
- public void testLayer2Rule() throws Exception {
- // enable firewall first
- firewall.enableFirewall(true);
-
- // add L2 rule
- FirewallRule rule = new FirewallRule();
- rule.dl_src = MACAddress.valueOf("00:44:33:22:11:00").toLong();
- rule.wildcard_dl_src = false;
- rule.dl_dst = MACAddress.valueOf("00:11:22:33:44:55").toLong();
- rule.wildcard_dl_dst = false;
- rule.priority = 1;
- firewall.addRule(rule);
-
- // add TCP deny all rule
- rule = new FirewallRule();
- rule.nw_proto = IPv4.PROTOCOL_TCP;
- rule.wildcard_nw_proto = false;
- rule.priority = 2;
- rule.action = FirewallRule.FirewallAction.DENY;
- firewall.addRule(rule);
-
- // simulate a packet-in event
-
- this.setPacketIn(tcpPacket);
- firewall.receive(sw, this.packetIn, cntx);
- verify(sw);
-
- IRoutingDecision decision = IRoutingDecision.rtStore.get(cntx, IRoutingDecision.CONTEXT_DECISION);
- assertEquals(decision.getRoutingAction(), IRoutingDecision.RoutingAction.FORWARD_OR_FLOOD);
- }
-}
diff --git a/src/test/java/net/floodlightcontroller/hub/HubTest.java b/src/test/java/net/floodlightcontroller/hub/HubTest.java
deleted file mode 100644
index b4a215c..0000000
--- a/src/test/java/net/floodlightcontroller/hub/HubTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.hub;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.easymock.EasyMock.capture;
-
-import java.util.Arrays;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.test.MockFloodlightProvider;
-import net.floodlightcontroller.packet.Data;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.packet.UDP;
-import net.floodlightcontroller.test.FloodlightTestCase;
-
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-import org.junit.Before;
-import org.junit.Test;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-
-/**
- *
- * @author David Erickson (daviderickson@cs.stanford.edu)
- */
-public class HubTest extends FloodlightTestCase {
- protected OFPacketIn packetIn;
- protected IPacket testPacket;
- protected byte[] testPacketSerialized;
- private MockFloodlightProvider mockFloodlightProvider;
- private Hub hub;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- mockFloodlightProvider = getMockFloodlightProvider();
- hub = new Hub();
- mockFloodlightProvider.addOFMessageListener(OFType.PACKET_IN, hub);
- hub.setFloodlightProvider(mockFloodlightProvider);
-
- // Build our test packet
- this.testPacket = new Ethernet()
- .setDestinationMACAddress("00:11:22:33:44:55")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
- this.testPacketSerialized = testPacket.serialize();
-
- // Build the PacketIn
- this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(this.testPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) this.testPacketSerialized.length);
- }
-
- @Test
- public void testFloodNoBufferId() throws Exception {
- // build our expected flooded packetOut
- OFPacketOut po = ((OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT))
- .setActions(Arrays.asList(new OFAction[] {new OFActionOutput().setPort(OFPort.OFPP_FLOOD.getValue())}))
- .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(this.testPacketSerialized);
- po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU()
- + this.testPacketSerialized.length);
-
- // Mock up our expected behavior
- IOFSwitch mockSwitch = createMock(IOFSwitch.class);
-
- Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
- Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
-
- mockSwitch.write(capture(wc1), capture(bc1));
-
- // Start recording the replay on the mocks
- replay(mockSwitch);
- // Get the listener and trigger the packet in
- IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
- OFType.PACKET_IN).get(0);
- listener.receive(mockSwitch, this.packetIn,
- parseAndAnnotate(this.packetIn));
-
- // Verify the replay matched our expectations
- verify(mockSwitch);
-
- assertTrue(wc1.hasCaptured());
- OFMessage m = wc1.getValue();
- assert(m.equals(po));
- }
-
- @Test
- public void testFloodBufferId() throws Exception {
- MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
- this.packetIn.setBufferId(10);
-
- // build our expected flooded packetOut
- OFPacketOut po = ((OFPacketOut) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_OUT))
- .setActions(Arrays.asList(new OFAction[] {new OFActionOutput().setPort(OFPort.OFPP_FLOOD.getValue())}))
- .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
- .setBufferId(10)
- .setInPort((short) 1);
- po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU());
-
- // Mock up our expected behavior
- IOFSwitch mockSwitch = createMock(IOFSwitch.class);
- Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
- Capture<FloodlightContext> bc1 = new Capture<FloodlightContext>(CaptureType.ALL);
-
- mockSwitch.write(capture(wc1), capture(bc1));
-
- // Start recording the replay on the mocks
- replay(mockSwitch);
- // Get the listener and trigger the packet in
- IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
- OFType.PACKET_IN).get(0);
- listener.receive(mockSwitch, this.packetIn,
- parseAndAnnotate(this.packetIn));
-
- // Verify the replay matched our expectations
- verify(mockSwitch);
-
- assertTrue(wc1.hasCaptured());
- OFMessage m = wc1.getValue();
- assert(m.equals(po));
- }
-}
diff --git a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java b/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java
deleted file mode 100644
index a68a1b8..0000000
--- a/src/test/java/net/floodlightcontroller/learningswitch/LearningSwitchTest.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
-
-package net.floodlightcontroller.learningswitch;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightTestModuleLoader;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.test.MockFloodlightProvider;
-import net.floodlightcontroller.packet.Data;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.packet.UDP;
-import net.floodlightcontroller.test.FloodlightTestCase;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-
-/**
- *
- * @author David Erickson (daviderickson@cs.stanford.edu)
- */
-public class LearningSwitchTest extends FloodlightTestCase {
- protected OFPacketIn packetIn;
- protected IPacket testPacket;
- protected byte[] testPacketSerialized;
- protected IPacket broadcastPacket;
- protected byte[] broadcastPacketSerialized;
- protected IPacket testPacketReply;
- protected byte[] testPacketReplySerialized;
- private LearningSwitch learningSwitch;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- FloodlightTestModuleLoader fml = new FloodlightTestModuleLoader();
- Collection<Class<? extends IFloodlightModule>> mods
- = new ArrayList<Class<? extends IFloodlightModule>>();
- mods.add(LearningSwitch.class);
- fml.setupModules(mods, null);
- learningSwitch = (LearningSwitch) fml.getModuleByName(LearningSwitch.class);
- mockFloodlightProvider =
- (MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);
-
- // Build our test packet
- this.testPacket = new Ethernet()
- .setDestinationMACAddress("00:11:22:33:44:55")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
- this.testPacketSerialized = testPacket.serialize();
- // Build a broadcast packet
- this.broadcastPacket = new Ethernet()
- .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
- .setSourceMACAddress("00:44:33:22:11:00")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.255.255")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
-
- this.broadcastPacketSerialized = broadcastPacket.serialize();
- this.testPacketReply = new Ethernet()
- .setDestinationMACAddress("00:44:33:22:11:00")
- .setSourceMACAddress("00:11:22:33:44:55")
- .setVlanID((short) 42)
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.2")
- .setDestinationAddress("192.168.1.1")
- .setPayload(new UDP()
- .setSourcePort((short) 5001)
- .setDestinationPort((short) 5000)
- .setPayload(new Data(new byte[] {0x02}))));
- this.testPacketReplySerialized = testPacketReply.serialize();
-
- // Build the PacketIn
- this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(this.testPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) this.testPacketSerialized.length);
- }
-
- @Test
- public void testFlood() throws Exception {
- // build our expected flooded packetOut
- OFPacketOut po = new OFPacketOut()
- .setActions(Arrays.asList(new OFAction[] {new OFActionOutput().setPort(OFPort.OFPP_FLOOD.getValue())}))
- .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH)
- .setBufferId(-1)
- .setInPort((short)1)
- .setPacketData(this.testPacketSerialized);
- po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLengthU()
- + this.testPacketSerialized.length);
-
- // Mock up our expected behavior
- IOFSwitch mockSwitch = createMock(IOFSwitch.class);
- expect(mockSwitch.getStringId()).andReturn("00:11:22:33:44:55:66:77").anyTimes();
- mockSwitch.write(po, null);
-
- // Start recording the replay on the mocks
- replay(mockSwitch);
- // Get the listener and trigger the packet in
- IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
- OFType.PACKET_IN).get(0);
- // Make sure it's the right listener
- listener.receive(mockSwitch, this.packetIn, parseAndAnnotate(this.packetIn));
-
- // Verify the replay matched our expectations
- short result = learningSwitch.getFromPortMap(mockSwitch, Ethernet.toLong(Ethernet.toMACAddress("00:44:33:22:11:00")), (short) 42).shortValue();
- verify(mockSwitch);
-
- // Verify the MAC table inside the switch
- assertEquals(1, result);
- }
-
- @Test
- public void testFlowMod() throws Exception {
- // tweak the test packet in since we need a bufferId
- this.packetIn.setBufferId(50);
-
- // build expected flow mods
- OFMessage fm1 = ((OFFlowMod) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD))
- .setActions(Arrays.asList(new OFAction[] {
- new OFActionOutput().setPort((short) 2).setMaxLength((short) -1)}))
- .setBufferId(50)
- .setCommand(OFFlowMod.OFPFC_ADD)
- .setIdleTimeout((short) 5)
- .setMatch(new OFMatch()
- .loadFromPacket(testPacketSerialized, (short) 1)
- .setWildcards(OFMatch.OFPFW_NW_PROTO | OFMatch.OFPFW_TP_SRC | OFMatch.OFPFW_TP_DST
- | OFMatch.OFPFW_NW_TOS))
- .setOutPort(OFPort.OFPP_NONE.getValue())
- .setCookie(1L << 52)
- .setPriority((short) 100)
- .setFlags((short)(1 << 0))
- .setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
- OFMessage fm2 = ((OFFlowMod) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD))
- .setActions(Arrays.asList(new OFAction[] {
- new OFActionOutput().setPort((short) 1).setMaxLength((short) -1)}))
- .setBufferId(-1)
- .setCommand(OFFlowMod.OFPFC_ADD)
- .setIdleTimeout((short) 5)
- .setMatch(new OFMatch()
- .loadFromPacket(testPacketReplySerialized, (short) 2)
- .setWildcards(OFMatch.OFPFW_NW_PROTO | OFMatch.OFPFW_TP_SRC | OFMatch.OFPFW_TP_DST
- | OFMatch.OFPFW_NW_TOS))
- .setOutPort(OFPort.OFPP_NONE.getValue())
- .setCookie(1L << 52)
- .setPriority((short) 100)
- .setFlags((short)(1 << 0))
- .setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
-
- // Mock up our expected behavior
- IOFSwitch mockSwitch = createMock(IOFSwitch.class);
- expect(mockSwitch.getId()).andReturn(1L).anyTimes();
- expect(mockSwitch.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).andReturn((Integer) (OFMatch.OFPFW_IN_PORT | OFMatch.OFPFW_NW_PROTO
- | OFMatch.OFPFW_TP_SRC | OFMatch.OFPFW_TP_DST | OFMatch.OFPFW_NW_SRC_ALL
- | OFMatch.OFPFW_NW_DST_ALL | OFMatch.OFPFW_NW_TOS));
- mockSwitch.write(fm1, null);
- mockSwitch.write(fm2, null);
-
- // Start recording the replay on the mocks
- replay(mockSwitch);
-
- // Populate the MAC table
- learningSwitch.addToPortMap(mockSwitch,
- Ethernet.toLong(Ethernet.toMACAddress("00:11:22:33:44:55")), (short) 42, (short) 2);
-
- // Get the listener and trigger the packet in
- IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
- OFType.PACKET_IN).get(0);
- listener.receive(mockSwitch, this.packetIn, parseAndAnnotate(this.packetIn));
-
- // Verify the replay matched our expectations
- short result = learningSwitch.getFromPortMap(mockSwitch, Ethernet.toLong(Ethernet.toMACAddress("00:44:33:22:11:00")), (short) 42).shortValue();
- verify(mockSwitch);
-
- // Verify the MAC table inside the switch
- assertEquals(1, result);
- }
-}
diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java
deleted file mode 100644
index 1e71138..0000000
--- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package net.floodlightcontroller.linkdiscovery.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-import java.util.List;
-
-import net.floodlightcontroller.core.INetMapStorage.DM_OPERATION;
-import net.floodlightcontroller.core.internal.TestDatabaseManager;
-import net.floodlightcontroller.linkdiscovery.ILinkStorage;
-import net.floodlightcontroller.routing.Link;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-
-public class LinkStorageImplTest {
- private static ILinkStorage linkStorage;
- private static TitanGraph titanGraph;
-
- //TODO Future ideas:
- //Test add links with CREATE and UPDATE
- //Test adding existing link again
-
- @Before
- public void setUp() throws Exception{
- titanGraph = TestDatabaseManager.getTestDatabase();
- TestDatabaseManager.populateTestData(titanGraph);
-
- linkStorage = new TestableLinkStorageImpl(titanGraph);
- }
-
- @After
- public void tearDown() throws Exception {
- titanGraph.shutdown();
- }
-
- /*
- * Add a link between port 1.102 and 2.104
- * i.e SEA switch port 3 to LAX switch port 1
- */
- @Test
- public void testAddSingleLink(){
- Link linkToAdd = new Link(Long.decode("0x0000000000000a01"), 3, Long.decode("0x0000000000000a02"), 1);
-
- //Use the link storage API to add the link
- linkStorage.update(linkToAdd, ILinkStorage.DM_OPERATION.INSERT);
-
- //Test if it was added correctly with the Gremlin API
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- Iterator<Vertex> it = titanGraph.getVertices("dpid", "00:00:00:00:00:00:0a:01").iterator();
-
- assertTrue(it.hasNext());
- Vertex sw1 = it.next();
- assertFalse(it.hasNext());
-
- pipe.start(sw1).out("on").has("number", (short)3).out("link").in("on");
-
- assertTrue(pipe.hasNext());
- Vertex sw2 = pipe.next();
- assertFalse(pipe.hasNext());
-
- //Check we ended up at the right vertex
- assertEquals((String)sw2.getProperty("dpid"), "00:00:00:00:00:00:0a:02");
- }
-
- //TODO enable once method is written
- @Ignore @Test
- public void testGetLinks(){
- //TODO Make sure this works when the implementation is written
- List<Link> list = linkStorage.getLinks(Long.decode("0x0000000000000a01"), (short)2);
-
- assertEquals(list.size(), 1);
-
- Link l = list.get(0);
- assertEquals(l.getSrc(), 2561L);
- assertEquals(l.getSrcPort(), (short)2);
- assertEquals(l.getDst(), 2563L);
- assertEquals(l.getDstPort(), (short)1);
- }
-
- //TODO enable once method is written
- @Ignore @Test
- public void testUpdateDelete(){
- Link linkToDelete = new Link(Long.decode("0x0000000000000a01"), 2, Long.decode("0x0000000000000a03"), 1);
-
- linkStorage.update(linkToDelete, DM_OPERATION.DELETE);
-
- //Test if it was deleted correctly with the Gremlin API
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- Iterator<Vertex> it = titanGraph.getVertices("dpid", "00:00:00:00:00:00:0a:01").iterator();
-
- assertTrue(it.hasNext());
- Vertex sw1 = it.next();
- assertFalse(it.hasNext());
-
- pipe.start(sw1).out("on").has("number", 2).out("link");
-
- assertFalse(pipe.hasNext());
- }
-
- //TODO enable once method is written
- @Ignore @Test
- public void testDeleteLinks(){
- //TODO Make sure this works when the implementation is written
-
- linkStorage.deleteLinksOnPort(Long.decode("0x0000000000000a01"), (short)2);
-
- //Test if it was deleted correctly with the Gremlin API
- GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
- Iterator<Vertex> it = titanGraph.getVertices("dpid", "00:00:00:00:00:00:0a:01").iterator();
-
- assertTrue(it.hasNext());
- Vertex sw1 = it.next();
- assertFalse(it.hasNext());
-
- pipe.start(sw1).out("on").has("number", 2).out("link");
-
- assertFalse(pipe.hasNext());
- }
-
-}
diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
index e72179d..8653625 100644
--- a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
+++ b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
@@ -11,11 +11,11 @@
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.topology.TopologyInstance;
import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
import org.junit.Before;
import org.junit.Test;
@@ -23,7 +23,7 @@
import org.slf4j.LoggerFactory;
public class TopologyInstanceTest {
- protected static Logger log = LoggerFactory.getLogger(TopologyInstanceTest.class);
+ protected final static Logger log = LoggerFactory.getLogger(TopologyInstanceTest.class);
protected TopologyManager topologyManager;
protected FloodlightModuleContext fmc;
protected MockFloodlightProvider mockFloodlightProvider;
diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
index 113cecb..06b48a2 100644
--- a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
+++ b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
@@ -4,10 +4,10 @@
import net.floodlightcontroller.core.IFloodlightProviderService.Role;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
import org.junit.Before;
import org.junit.Test;
@@ -15,7 +15,7 @@
import org.slf4j.LoggerFactory;
public class TopologyManagerTest extends FloodlightTestCase {
- protected static Logger log = LoggerFactory.getLogger(TopologyManagerTest.class);
+ protected final static Logger log = LoggerFactory.getLogger(TopologyManagerTest.class);
TopologyManager tm;
FloodlightModuleContext fmc;
diff --git a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
index ffabf6f..59e0a51 100644
--- a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
+++ b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
@@ -346,10 +346,4 @@
return 0;
}
- @Override
- public void setupRemoteSwitch(Long dpid) {
- // TODO Auto-generated method stub
-
- }
-
}
\ No newline at end of file
diff --git a/src/test/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilterTest.java b/src/test/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilterTest.java
deleted file mode 100644
index 32afe4e..0000000
--- a/src/test/java/net/floodlightcontroller/virtualnetwork/VirtualNetworkFilterTest.java
+++ /dev/null
@@ -1,375 +0,0 @@
-package net.floodlightcontroller.virtualnetwork;
-
-import static org.easymock.EasyMock.*;
-
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFType;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFMessageListener;
-import net.floodlightcontroller.core.IListener.Command;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.core.test.PacketFactory;
-import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.devicemanager.IEntityClassifierService;
-import net.floodlightcontroller.devicemanager.internal.DefaultEntityClassifier;
-import net.floodlightcontroller.devicemanager.test.MockDeviceManager;
-import net.floodlightcontroller.flowcache.FlowReconcileManager;
-import net.floodlightcontroller.flowcache.IFlowReconcileService;
-import net.floodlightcontroller.packet.Data;
-import net.floodlightcontroller.packet.Ethernet;
-import net.floodlightcontroller.packet.IPacket;
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.packet.UDP;
-import net.floodlightcontroller.restserver.IRestApiService;
-import net.floodlightcontroller.restserver.RestApiServer;
-import net.floodlightcontroller.test.FloodlightTestCase;
-import net.floodlightcontroller.threadpool.IThreadPoolService;
-import net.floodlightcontroller.topology.ITopologyService;
-import net.floodlightcontroller.util.MACAddress;
-import net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter;
-
-public class VirtualNetworkFilterTest extends FloodlightTestCase {
- protected VirtualNetworkFilter vns;
- protected MockDeviceManager deviceService;
-
- protected static String guid1 = "guid1";
- protected static String net1 = "net1";
- protected static String gw1 = "1.1.1.1";
- protected static String guid2 = "guid2";
- protected static String net2 = "net2";
- protected static String guid3 = "guid3";
- protected static String net3 = "net3";
- protected static String gw2 = "2.2.2.2";
-
- protected static MACAddress mac1 =
- new MACAddress(Ethernet.toMACAddress("00:11:22:33:44:55"));
- protected static MACAddress mac2 =
- new MACAddress(Ethernet.toMACAddress("00:11:22:33:44:66"));
- protected static MACAddress mac3 =
- new MACAddress(Ethernet.toMACAddress("00:11:22:33:44:77"));
- protected static MACAddress mac4 =
- new MACAddress(Ethernet.toMACAddress("00:11:22:33:44:88"));
- protected static String hostPort1 = "port1";
- protected static String hostPort2 = "port2";
- protected static String hostPort3 = "port3";
- protected static String hostPort4 = "port4";
-
- // For testing forwarding behavior
- protected IOFSwitch sw1;
- protected FloodlightContext cntx;
- protected OFPacketIn mac1ToMac2PacketIn;
- protected IPacket mac1ToMac2PacketIntestPacket;
- protected byte[] mac1ToMac2PacketIntestPacketSerialized;
- protected OFPacketIn mac1ToMac4PacketIn;
- protected IPacket mac1ToMac4PacketIntestPacket;
- protected byte[] mac1ToMac4PacketIntestPacketSerialized;
- protected OFPacketIn mac1ToGwPacketIn;
- protected IPacket mac1ToGwPacketIntestPacket;
- protected byte[] mac1ToGwPacketIntestPacketSerialized;
- protected OFPacketIn packetInDHCPDiscoveryRequest;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- // Module loading stuff
- FloodlightModuleContext fmc = new FloodlightModuleContext();
- RestApiServer restApi = new RestApiServer();
- deviceService = new MockDeviceManager();
- FlowReconcileManager frm = new FlowReconcileManager();
- MockThreadPoolService tps = new MockThreadPoolService();
- ITopologyService topology = createMock(ITopologyService.class);
- vns = new VirtualNetworkFilter();
- DefaultEntityClassifier entityClassifier = new DefaultEntityClassifier();
- fmc.addService(IRestApiService.class, restApi);
- fmc.addService(IFloodlightProviderService.class, getMockFloodlightProvider());
- fmc.addService(IDeviceService.class, deviceService);
- fmc.addService(IFlowReconcileService.class, frm);
- fmc.addService(IThreadPoolService.class, tps);
- fmc.addService(IEntityClassifierService.class, entityClassifier);
- fmc.addService(ITopologyService.class, topology);
- tps.init(fmc);
- frm.init(fmc);
- deviceService.init(fmc);
- restApi.init(fmc);
- getMockFloodlightProvider().init(fmc);
- entityClassifier.init(fmc);
- tps.startUp(fmc);
- vns.init(fmc);
- frm.startUp(fmc);
- deviceService.startUp(fmc);
- restApi.startUp(fmc);
- getMockFloodlightProvider().startUp(fmc);
- vns.startUp(fmc);
- entityClassifier.startUp(fmc);
-
- topology.addListener(deviceService);
- expectLastCall().times(1);
- replay(topology);
- // Mock switches
- //fastWilcards mocked as this constant
- int fastWildcards =
- OFMatch.OFPFW_IN_PORT |
- OFMatch.OFPFW_NW_PROTO |
- OFMatch.OFPFW_TP_SRC |
- OFMatch.OFPFW_TP_DST |
- OFMatch.OFPFW_NW_SRC_ALL |
- OFMatch.OFPFW_NW_DST_ALL |
- OFMatch.OFPFW_NW_TOS;
- sw1 = EasyMock.createNiceMock(IOFSwitch.class);
- expect(sw1.getId()).andReturn(1L).anyTimes();
- expect(sw1.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).andReturn((Integer)fastWildcards).anyTimes();
- expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
- replay(sw1);
-
- // Mock packets
- // Mock from MAC1 -> MAC2
- mac1ToMac2PacketIntestPacket = new Ethernet()
- .setDestinationMACAddress(mac2.toBytes())
- .setSourceMACAddress(mac1.toBytes())
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
- mac1ToMac2PacketIntestPacketSerialized = mac1ToMac2PacketIntestPacket.serialize();
- mac1ToMac2PacketIn =
- ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().
- getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(mac1ToMac2PacketIntestPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) mac1ToMac2PacketIntestPacketSerialized.length);
-
- // Mock from MAC1 -> MAC4
- mac1ToMac4PacketIntestPacket = new Ethernet()
- .setDestinationMACAddress(mac4.toBytes())
- .setSourceMACAddress(mac1.toBytes())
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress("192.168.1.2")
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
- mac1ToMac4PacketIntestPacketSerialized = mac1ToMac4PacketIntestPacket.serialize();
- mac1ToMac4PacketIn =
- ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().
- getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(mac1ToMac4PacketIntestPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) mac1ToMac4PacketIntestPacketSerialized.length);
-
- // Mock from MAC1 to gateway1
- mac1ToGwPacketIntestPacket = new Ethernet()
- .setDestinationMACAddress("00:11:33:33:44:55") // mac shouldn't matter, can't be other host
- .setSourceMACAddress(mac1.toBytes())
- .setEtherType(Ethernet.TYPE_IPv4)
- .setPayload(
- new IPv4()
- .setTtl((byte) 128)
- .setSourceAddress("192.168.1.1")
- .setDestinationAddress(gw1)
- .setPayload(new UDP()
- .setSourcePort((short) 5000)
- .setDestinationPort((short) 5001)
- .setPayload(new Data(new byte[] {0x01}))));
- mac1ToGwPacketIntestPacketSerialized = mac1ToGwPacketIntestPacket.serialize();
- mac1ToGwPacketIn =
- ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().
- getMessage(OFType.PACKET_IN))
- .setBufferId(-1)
- .setInPort((short) 1)
- .setPacketData(mac1ToGwPacketIntestPacketSerialized)
- .setReason(OFPacketInReason.NO_MATCH)
- .setTotalLength((short) mac1ToGwPacketIntestPacketSerialized.length);
- }
-
- @Test
- public void testCreateNetwork() {
- // Test creating a network with all parameters
- vns.createNetwork(guid1, net1, IPv4.toIPv4Address(gw1));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid1));
- assertTrue(vns.nameToGuid.get(net1).equals(guid1));
- assertTrue(vns.guidToGateway.get(guid1).equals(IPv4.toIPv4Address(gw1)));
- assertTrue(vns.vNetsByGuid.get(guid1).name.equals(net1));
- assertTrue(vns.vNetsByGuid.get(guid1).guid.equals(guid1));
- assertTrue(vns.vNetsByGuid.get(guid1).gateway.equals(gw1));
- assertTrue(vns.vNetsByGuid.get(guid1).hosts.size()==0);
-
- // Test creating network without a gateway
- vns.createNetwork(guid2, net2, null);
- assertTrue(vns.nameToGuid.get(net2).equals(guid2));
- assertTrue(vns.guidToGateway.get(guid2) == null);
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).size() == 1);
- assertTrue(vns.vNetsByGuid.get(guid2).name.equals(net2));
- assertTrue(vns.vNetsByGuid.get(guid2).guid.equals(guid2));
- assertTrue(vns.vNetsByGuid.get(guid2).gateway == null);
- assertTrue(vns.vNetsByGuid.get(guid2).hosts.size()==0);
-
- // Test creating a network that shares the gateway with net1
- vns.createNetwork(guid3, net3, IPv4.toIPv4Address(gw1));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid1));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid3));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).size() == 2);
- assertTrue(vns.nameToGuid.get(net3).equals(guid3));
- assertTrue(vns.guidToGateway.get(guid3).equals(IPv4.toIPv4Address(gw1)));
- assertTrue(vns.vNetsByGuid.get(guid3).name.equals(net3));
- assertTrue(vns.vNetsByGuid.get(guid3).guid.equals(guid3));
- assertTrue(vns.vNetsByGuid.get(guid3).gateway.equals(gw1));
- assertTrue(vns.vNetsByGuid.get(guid3).hosts.size()==0);
-
- }
-
- @Test
- public void testModifyNetwork() {
- // Create some networks
-
- testCreateNetwork();
- // Modify net2 to add a gateway
- vns.createNetwork(guid2, net2, IPv4.toIPv4Address(gw1));
- assertTrue(vns.nameToGuid.get(net2).equals(guid2));
- assertTrue(vns.guidToGateway.get(guid2).equals(IPv4.toIPv4Address(gw1)));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid1));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid2));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid3));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).size() == 3);
- // Modify net2 to change it's name
- vns.createNetwork(guid2, "newnet2", null);
- // Make sure the gateway is still there
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid2));
- assertTrue(vns.vNetsByGuid.get(guid2).gateway.equals(gw1));
- // make sure the new name mapping was learned
- assertTrue(vns.nameToGuid.get("newnet2").equals(guid2));
- assertTrue(vns.vNetsByGuid.get(guid2).name.equals("newnet2"));
- // and the old one was deleted
- assertFalse(vns.nameToGuid.containsKey(net2));
- }
-
- @Test
- public void testDeleteNetwork() {
- testModifyNetwork();
- // Delete newnet2
- vns.deleteNetwork(guid2);
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid1));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).contains(guid3));
- assertTrue(vns.gatewayToGuid.get(IPv4.toIPv4Address(gw1)).size() == 2);
- assertFalse(vns.nameToGuid.containsKey(net2));
- assertFalse(vns.guidToGateway.containsKey(net2));
- assertTrue(vns.vNetsByGuid.get(guid2)==null);
- }
-
- @Test
- public void testAddHost() {
- testModifyNetwork();
- vns.addHost(mac1, guid1, hostPort1);
- assertTrue(vns.macToGuid.get(mac1).equals(guid1));
- assertTrue(vns.portToMac.get(hostPort1).equals(mac1));
- assertTrue(vns.vNetsByGuid.get(guid1).hosts.contains(mac1));
- vns.addHost(mac2, guid1, hostPort2);
- assertTrue(vns.macToGuid.get(mac2).equals(guid1));
- assertTrue(vns.portToMac.get(hostPort2).equals(mac2));
- assertTrue(vns.vNetsByGuid.get(guid1).hosts.contains(mac2));
- vns.addHost(mac3, guid3, hostPort3);
- vns.addHost(mac4, guid3, hostPort4);
- assertTrue(vns.vNetsByGuid.get(guid3).hosts.contains(mac4));
- }
-
- @Test
- public void testDeleteHost() {
- testAddHost();
-
- String host1Guid = vns.macToGuid.get(mac1);
- vns.deleteHost(mac1, null);
- assertFalse(vns.macToGuid.containsKey(mac1));
- assertFalse(vns.portToMac.containsKey(hostPort1));
- assertFalse(vns.vNetsByGuid.get(host1Guid).hosts.contains(mac1));
-
- String host2Guid = vns.macToGuid.get(vns.portToMac.get(hostPort2));
- vns.deleteHost(null, hostPort2);
- assertFalse(vns.macToGuid.containsKey(mac2));
- assertFalse(vns.portToMac.containsKey(hostPort2));
- assertFalse(vns.vNetsByGuid.get(host2Guid).hosts.contains(mac2));
-
- String host3Guid = vns.macToGuid.get(mac3);
- vns.deleteHost(mac3, hostPort3);
- assertFalse(vns.macToGuid.containsKey(mac3));
- assertFalse(vns.portToMac.containsKey(hostPort3));
- assertFalse(vns.vNetsByGuid.get(host3Guid).hosts.contains(mac3));
-
- }
-
- @Test
- public void testForwarding() {
- testAddHost();
- // make sure mac1 can communicate with mac2
- IOFMessageListener listener = getVirtualNetworkListener();
- cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
- (Ethernet)mac1ToMac2PacketIntestPacket);
- Command ret = listener.receive(sw1, mac1ToMac2PacketIn, cntx);
- assertTrue(ret == Command.CONTINUE);
- // make sure mac1 can't communicate with mac4
- cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
- (Ethernet)mac1ToMac4PacketIntestPacket);
- ret = listener.receive(sw1, mac1ToMac4PacketIn, cntx);
- assertTrue(ret == Command.STOP);
- }
-
- @Test
- public void testDefaultGateway() {
- testAddHost();
- IOFMessageListener listener = getVirtualNetworkListener();
- cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
- (Ethernet)mac1ToGwPacketIntestPacket);
- deviceService.learnEntity(((Ethernet)mac1ToGwPacketIntestPacket).getDestinationMAC().toLong(),
- null, IPv4.toIPv4Address(gw1), null, null);
- Command ret = listener.receive(sw1, mac1ToGwPacketIn, cntx);
- assertTrue(ret == Command.CONTINUE);
- }
-
- @Test
- public void testDhcp() {
- IOFMessageListener listener = getVirtualNetworkListener();
- Ethernet dhcpPacket = PacketFactory.DhcpDiscoveryRequestEthernet(mac1);
- OFPacketIn dhcpPacketOf = PacketFactory.DhcpDiscoveryRequestOFPacketIn(mac1);
- cntx = new FloodlightContext();
- IFloodlightProviderService.bcStore.put(cntx,
- IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
- dhcpPacket);
- Command ret = listener.receive(sw1, dhcpPacketOf, cntx);
- assertTrue(ret == Command.CONTINUE);
- }
-
- protected IOFMessageListener getVirtualNetworkListener() {
- List<IOFMessageListener> listeners = mockFloodlightProvider.getListeners().get(OFType.PACKET_IN);
- return listeners.get(listeners.indexOf(vns));
- }
-}
diff --git a/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java b/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java
new file mode 100644
index 0000000..b50f889
--- /dev/null
+++ b/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java
@@ -0,0 +1,231 @@
+/**
+ *
+ */
+package net.onrc.onos.graph;
+
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.expect;
+import static org.powermock.api.easymock.PowerMock.*;
+
+import java.util.*;
+
+import net.onrc.onos.graph.GraphDBOperation;
+
+import org.easymock.IAnswer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.blueprints.util.wrappers.event.EventTransactionalGraph;
+import com.tinkerpop.frames.FramedGraph;
+
+/**
+ * @author Toshio Koide
+ *
+ */
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({
+ GraphDBConnection.class,
+ GraphDBOperation.class,
+ TitanFactory.class,
+ EventTransactionalGraph.class})
+public class GraphDBConnectionTest {
+ private static TitanGraph graph = null;
+ private static EventTransactionalGraph<TitanGraph> eg = null;
+ private static Boolean isGraphOpen = false;
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void expectDBConnectionAvailable() throws Exception {
+ isGraphOpen = false;
+
+ // create mock objects
+ mockStatic(TitanFactory.class);
+ mockStatic(EventTransactionalGraph.class);
+ graph = createMock(TitanGraph.class);
+ eg = (EventTransactionalGraph<TitanGraph>)createMock(EventTransactionalGraph.class);
+
+ // setup expectations
+ expect(graph.isOpen()).andAnswer(new IAnswer<Boolean>() {
+ @Override
+ public Boolean answer() throws Throwable {
+ return isGraphOpen;
+ }
+ }).anyTimes();
+ expect(TitanFactory.open("/path/to/dummy")).andAnswer(new IAnswer<TitanGraph>() {
+ @Override
+ public TitanGraph answer() throws Throwable {
+ isGraphOpen = true;
+ return graph;
+ }
+ }).anyTimes();
+ expect(graph.getIndexedKeys(Vertex.class)).andReturn(new TreeSet<String>());
+ graph.createKeyIndex("dpid", Vertex.class);
+ graph.createKeyIndex("port_id", Vertex.class);
+ graph.createKeyIndex("type", Vertex.class);
+ graph.createKeyIndex("dl_addr", Vertex.class);
+ graph.createKeyIndex("flow_id", Vertex.class);
+ graph.createKeyIndex("flow_entry_id", Vertex.class);
+ graph.createKeyIndex("switch_state", Vertex.class);
+ graph.createKeyIndex("ipv4_address", Vertex.class);
+ graph.commit();
+ expectNew(EventTransactionalGraph.class, graph).andReturn(eg);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#getInstance(java.lang.String)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetInstance() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+
+ // verify the test
+ verifyAll();
+ assertNotNull(conn);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#getFramedGraph()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetFramedGraph() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+
+ // verify the test
+ verifyAll();
+ assertNotNull(fg);
+ assertEquals(graph, fg.getBaseGraph());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#addEventListener(net.onrc.onos.graph.LocalGraphChangedListener)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testAddEventListener() throws Exception {
+ // instantiate required objects
+ LocalGraphChangedListener listener = new LocalTopologyEventListener(null);
+
+ // setup expectations
+ expectDBConnectionAvailable();
+ eg.addListener(listener);
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ conn.addEventListener(listener);
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#isValid()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testIsValid() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ Boolean result = conn.isValid();
+
+ // verify the test
+ verifyAll();
+ assertTrue(result);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#commit()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testCommit() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+ graph.commit();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ conn.commit();
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#rollback()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testRollback() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+ graph.rollback();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ conn.rollback();
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBConnection#close()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testClose() throws Exception {
+ // setup expectations
+ expectDBConnectionAvailable();
+ graph.commit();
+
+ // start the test
+ replayAll();
+ GraphDBConnection conn = GraphDBConnection.getInstance("/path/to/dummy");
+ conn.close();
+
+ // verify the test
+ verifyAll();
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java b/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java
new file mode 100644
index 0000000..b40d2af
--- /dev/null
+++ b/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java
@@ -0,0 +1,648 @@
+/**
+ *
+ */
+package net.onrc.onos.graph;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.google.common.net.InetAddresses;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.Vertex;
+
+/**
+ * @author Toshio Koide
+ *
+ */
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class})
+public class GraphDBOperationTest extends TestCase {
+ private static TitanGraph testdb;
+ private static GraphDBOperation op;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ TestDatabaseManager.deleteTestDatabase();
+ testdb = TestDatabaseManager.getTestDatabase();
+// TestDatabaseManager.populateTestData(titanGraph);
+
+ String dummyPath = "/dummy/to/conf";
+ // replace return value of TitanFactory.open() to dummy DB created above
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open(dummyPath)).andReturn(testdb);
+ PowerMock.replay(TitanFactory.class);
+
+ op = new GraphDBOperation(dummyPath);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ op.close();
+ testdb.shutdown();
+ PowerMock.verifyAll();
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newSwitch(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testNewSwitch() {
+ assertNull(op.searchSwitch("123"));
+
+ ISwitchObject sw = op.newSwitch("123");
+ assertEquals(sw.getDPID(), "123");
+ op.commit();
+
+ sw = op.searchSwitch("123");
+ assertNotNull(sw);
+ assertEquals("123", sw.getDPID());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchSwitch(net.onrc.onos.graph.GraphDBConnection, java.lang.String)}.
+ */
+ @Test
+ public final void testSearchSwitch() {
+ op.newSwitch("123");
+ op.newSwitch("456");
+ op.commit();
+
+ ISwitchObject sw = op.searchSwitch("123");
+ assertNotNull(sw);
+ assertEquals("123", sw.getDPID());
+
+ sw = op.searchSwitch("789");
+ assertNull(sw);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchActiveSwitch(net.onrc.onos.graph.GraphDBConnection, java.lang.String)}.
+ */
+ @Test
+ public final void testSearchActiveSwitch() {
+ op.newSwitch("111").setState(SwitchState.ACTIVE.toString());
+ op.newSwitch("222").setState(SwitchState.INACTIVE.toString());
+ op.commit();
+
+ ISwitchObject sw = op.searchActiveSwitch("111");
+ assertNotNull(sw);
+ assertEquals("111", sw.getDPID());
+
+ sw = op.searchActiveSwitch("222");
+ assertNull(sw);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getActiveSwitches(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetActiveSwitches() {
+ op.newSwitch("111").setState(SwitchState.ACTIVE.toString());
+ op.newSwitch("222").setState(SwitchState.INACTIVE.toString());
+ op.commit();
+
+ Iterator<ISwitchObject> i = op.getActiveSwitches().iterator();
+
+ assertTrue(i.hasNext());
+ assertEquals("111", i.next().getDPID());
+ assertFalse(i.hasNext());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getAllSwitches(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetAllSwitches() {
+ List<String> dpids = Arrays.asList("111", "222", "333");
+ Collections.sort(dpids);
+
+ for (String dpid: dpids) op.newSwitch(dpid);
+ op.commit();
+
+ List<String> actual_ids = new ArrayList<String>();
+ for (ISwitchObject switchObj: op.getAllSwitches()) actual_ids.add(switchObj.getDPID());
+ Collections.sort(actual_ids);
+
+ assertArrayEquals(dpids.toArray(), actual_ids.toArray());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getInactiveSwitches(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetInactiveSwitches() {
+ op.newSwitch("111").setState(SwitchState.ACTIVE.toString());
+ op.newSwitch("222").setState(SwitchState.INACTIVE.toString());
+ op.commit();
+
+ Iterator<ISwitchObject> i = op.getInactiveSwitches().iterator();
+
+ assertTrue(i.hasNext());
+ assertEquals("222", i.next().getDPID());
+ assertFalse(i.hasNext());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getAllSwitchNotUpdatedFlowEntries(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetAllSwitchNotUpdatedFlowEntries() {
+ FlowEntryId flowEntryId10 = new FlowEntryId(10);
+ FlowEntryId flowEntryId20 = new FlowEntryId(20);
+ IFlowEntry flowEntry10 = op.newFlowEntry();
+ IFlowEntry flowEntry20 = op.newFlowEntry();
+ flowEntry10.setFlowEntryId(flowEntryId10.toString());
+ flowEntry20.setFlowEntryId(flowEntryId20.toString());
+ flowEntry10.setSwitchState("FE_SWITCH_NOT_UPDATED");
+ flowEntry20.setSwitchState("FE_SWITCH_UPDATED");
+ op.commit();
+
+ Iterator<IFlowEntry> flowEntries = op.getAllSwitchNotUpdatedFlowEntries().iterator();
+ assertNotNull(flowEntries);
+ assertTrue(flowEntries.hasNext());
+ assertEquals(flowEntryId10.toString(), flowEntries.next().getFlowEntryId());
+ assertFalse(flowEntries.hasNext());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#removeSwitch(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject)}.
+ */
+ @Test
+ public final void testRemoveSwitch() {
+ ISwitchObject sw = op.newSwitch("123");
+ op.commit();
+ sw = op.searchSwitch("123");
+ assertNotNull(sw);
+
+ op.removeSwitch(sw);
+ op.commit();
+
+ assertNull(op.searchSwitch("123"));
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newPort(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testNewPort() {
+ assertFalse(testdb.getVertices("type", "port").iterator().hasNext());
+
+ IPortObject port = op.newPort("1", (short) 10);
+ assertTrue(port.getNumber() == 10);
+ op.commit();
+
+ Iterator<Vertex> vertices = testdb.getVertices("type", "port").iterator();
+ assertTrue(vertices.hasNext());
+ assertEquals(vertices.next().getProperty("number").toString(), "10");
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchPort(net.onrc.onos.graph.GraphDBConnection, java.lang.String, short)}.
+ */
+ @Test
+ public final void testSearchPort() {
+ ISwitchObject sw;
+ IPortObject port;
+
+ sw = op.newSwitch("1");
+ sw.addPort(op.newPort("1", (short) 1));
+ sw.addPort(op.newPort("1", (short) 2));
+
+ sw = op.newSwitch("2");
+ sw.addPort(op.newPort("2", (short) 1));
+ sw.addPort(op.newPort("2", (short) 2));
+
+ op.commit();
+
+ assertNull(op.searchPort("3", (short) 1));
+ assertNull(op.searchPort("1", (short) 3));
+
+ port = op.searchPort("1", (short) 1);
+ assertNotNull(port);
+ assertTrue(port.getNumber() == 1);
+ sw = port.getSwitch();
+ assertNotNull(sw);
+ assertEquals("1", sw.getDPID());
+
+ port = op.searchPort("1", (short) 2);
+ assertNotNull(port);
+ assertTrue(port.getNumber() == 2);
+ sw = port.getSwitch();
+ assertNotNull(sw);
+ assertEquals("1", sw.getDPID());
+
+ port = op.searchPort("2", (short) 1);
+ assertNotNull(port);
+ assertTrue(port.getNumber() == 1);
+ sw = port.getSwitch();
+ assertNotNull(sw);
+ assertEquals("2", sw.getDPID());
+
+ port = op.searchPort("2", (short) 2);
+ assertNotNull(port);
+ assertTrue(port.getNumber() == 2);
+ sw = port.getSwitch();
+ assertNotNull(sw);
+ assertEquals("2", sw.getDPID());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#removePort(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject)}.
+ */
+ @Test
+ public final void testRemovePort() {
+ ISwitchObject sw;
+ IPortObject port;
+
+ sw = op.newSwitch("1");
+ sw.addPort(op.newPort("1", (short) 1));
+ sw.addPort(op.newPort("1", (short) 2));
+
+ op.commit();
+
+ port = op.searchPort("1", (short) 1);
+ assertNotNull(port);
+ assertNotNull(op.searchPort("1", (short) 2));
+ assertNull(op.searchPort("1", (short) 3));
+
+ op.removePort(port);
+ op.commit();
+
+ assertNull(op.searchPort("1", (short) 1));
+ port = op.searchPort("1", (short) 2);
+ assertNotNull(port);
+
+ op.removePort(port);
+ op.commit();
+
+ assertNull(op.searchPort("1", (short) 1));
+ assertNull(op.searchPort("1", (short) 2));
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newDevice(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testNewDevice() {
+ assertFalse(testdb.getVertices("type", "device").iterator().hasNext());
+
+ IDeviceObject device = op.newDevice();
+ device.setMACAddress("11:22:33:44:55:66");
+ //device.setIPAddress("192.168.1.1");
+ op.commit();
+
+ Iterator<Vertex> vertices = testdb.getVertices("type", "device").iterator();
+ assertTrue(vertices.hasNext());
+ Vertex v = vertices.next();
+ assertEquals("11:22:33:44:55:66", v.getProperty("dl_addr").toString());
+ //assertEquals("192.168.1.1", v.getProperty("nw_addr").toString());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchDevice(net.onrc.onos.graph.GraphDBConnection, java.lang.String)}.
+ */
+ @Test
+ public final void testSearchDevice() {
+ assertNull(op.searchDevice("11:22:33:44:55:66"));
+ assertNull(op.searchDevice("66:55:44:33:22:11"));
+
+ op.newDevice().setMACAddress("11:22:33:44:55:66");
+ op.commit();
+
+ IDeviceObject device = op.searchDevice("11:22:33:44:55:66");
+ assertNotNull(device);
+ assertEquals("11:22:33:44:55:66", device.getMACAddress());
+
+ assertNull(op.searchDevice("66:55:44:33:22:11"));
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getDevices(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetDevices() {
+ List<String> original_macs = Arrays.asList(
+ "11:11:11:11:11:11",
+ "22:22:22:22:22:22",
+ "33:33:33:33:33:33"
+ );
+
+ for (String mac: original_macs) op.newDevice().setMACAddress(mac);
+ op.commit();
+
+ Iterable<IDeviceObject> devices = op.getDevices();
+ List<String> macs = new ArrayList<String>();
+ for (IDeviceObject device: devices) macs.add(device.getMACAddress());
+ Collections.sort(macs);
+ assertArrayEquals(original_macs.toArray(), macs.toArray());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#removeDevice(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject)}.
+ */
+ @Test
+ public final void testRemoveDevice() {
+ op.newDevice().setMACAddress("11:22:33:44:55:66");
+ op.commit();
+
+ op.removeDevice(op.searchDevice("11:22:33:44:55:66"));
+ op.commit();
+ assertNull(op.searchDevice("11:22:33:44:55:66"));
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newIpv4Address(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IIpv4Address)}.
+ */
+ @Test
+ public final void testNewIpv4Address() {
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.10.1"));
+
+ assertFalse(testdb.getVertices("type", "ipv4Address").iterator().hasNext());
+
+ IIpv4Address ipv4Address = op.newIpv4Address();
+ ipv4Address.setIpv4Address(intIpv4Address);
+ //device.setIPAddress("192.168.1.1");
+ op.commit();
+
+ Iterator<Vertex> vertices = testdb.getVertices("type", "ipv4Address").iterator();
+ assertTrue(vertices.hasNext());
+ Vertex v = vertices.next();
+ assertEquals(intIpv4Address, ((Integer) v.getProperty("ipv4_address")).intValue());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchIpv4Address(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IIpv4Address)}.
+ */
+ @Test
+ public final void testSearchIpv4Address() {
+ int addr1 = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.20.1"));
+ int addr2 = InetAddresses.coerceToInteger(InetAddresses.forString("59.203.2.15"));
+
+ assertNull(op.searchIpv4Address(addr1));
+ assertNull(op.searchIpv4Address(addr2));
+
+ op.newIpv4Address().setIpv4Address(addr1);
+ op.commit();
+
+ IIpv4Address ipv4Address = op.searchIpv4Address(addr1);
+ assertNotNull(ipv4Address);
+ assertEquals(addr1, ipv4Address.getIpv4Address());
+
+ assertNull(op.searchIpv4Address(addr2));
+ }
+
+ @Ignore
+ @Test
+ public final void testEnsureIpv4Address() {
+ // TODO not yet implemented
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newFlowPath(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testNewFlowPath() {
+ FlowId flowId = new FlowId(10);
+ IFlowPath flowPath = op.newFlowPath();
+ flowPath.setFlowId(flowId.toString());
+ op.commit();
+
+ Iterator<IFlowPath> flows = op.getAllFlowPaths().iterator();
+ assertTrue(flows.hasNext());
+ assertEquals(flowId.toString(), flows.next().getFlowId());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchFlowPath(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.util.FlowId)}.
+ */
+ @Test
+ public final void testSearchFlowPath() {
+ FlowId flowId = new FlowId(20);
+ assertNull(op.searchFlowPath(flowId));
+
+ op.newFlowPath().setFlowId(flowId.toString());
+ op.commit();
+
+ IFlowPath flowPath = op.searchFlowPath(flowId);
+ assertNotNull(flowPath);
+ assertEquals(flowId.toString(), flowPath.getFlowId());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getFlowPathByFlowEntry(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry)}.
+ */
+ @Test
+ public final void testGetFlowPathByFlowEntry() {
+ FlowId flowId10 = new FlowId(10);
+ FlowId flowId20 = new FlowId(20);
+ IFlowPath flowPath10 = op.newFlowPath();
+ IFlowPath flowPath20 = op.newFlowPath();
+ IFlowEntry flowEntry10 = op.newFlowEntry();
+ IFlowEntry flowEntry20 = op.newFlowEntry();
+ IFlowEntry flowEntry30 = op.newFlowEntry();
+ FlowEntryId flowEntryId10 = new FlowEntryId(10);
+ FlowEntryId flowEntryId20 = new FlowEntryId(20);
+ FlowEntryId flowEntryId30 = new FlowEntryId(30);
+ flowEntry10.setFlowEntryId(flowEntryId10.toString());
+ flowEntry20.setFlowEntryId(flowEntryId20.toString());
+ flowEntry30.setFlowEntryId(flowEntryId30.toString());
+ flowPath10.setFlowId(flowId10.toString());
+ flowPath10.addFlowEntry(flowEntry10);
+ flowPath20.setFlowId(flowId20.toString());
+ flowPath20.addFlowEntry(flowEntry20);
+ op.commit();
+
+ flowEntry10 = op.searchFlowEntry(flowEntryId10);
+ IFlowPath obtainedFlowPath = op.getFlowPathByFlowEntry(flowEntry10);
+ assertNotNull(obtainedFlowPath);
+ assertEquals(flowId10.toString(), obtainedFlowPath.getFlowId());
+
+ flowEntry20 = op.searchFlowEntry(flowEntryId20);
+ obtainedFlowPath = op.getFlowPathByFlowEntry(flowEntry20);
+ assertNotNull(obtainedFlowPath);
+ assertEquals(flowId20.toString(), obtainedFlowPath.getFlowId());
+
+ flowEntry30 = op.searchFlowEntry(flowEntryId30);
+ obtainedFlowPath = op.getFlowPathByFlowEntry(flowEntry30);
+ assertNull(obtainedFlowPath);
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getAllFlowPaths(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetAllFlowPaths() {
+ List<FlowId> flowids = Arrays.asList(
+ new FlowId(10), new FlowId(20), new FlowId(30)
+ );
+
+ for (FlowId flowId: flowids)
+ op.newFlowPath().setFlowId(flowId.toString());
+ op.commit();
+
+ List<String> actual_ids = new ArrayList<String>();
+ for (IFlowPath flowPath: op.getAllFlowPaths()) actual_ids.add(flowPath.getFlowId());
+ Collections.sort(actual_ids);
+
+ List<String> expected_ids = new ArrayList<String>();
+ for (FlowId flowid: flowids) expected_ids.add(flowid.toString());
+ Collections.sort(expected_ids);
+
+ assertArrayEquals(expected_ids.toArray(), actual_ids.toArray());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#removeFlowPath(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath)}.
+ */
+ @Test
+ public final void testRemoveFlowPath() {
+ FlowId flowId10 = new FlowId(10);
+ FlowId flowId20 = new FlowId(20);
+ op.newFlowPath().setFlowId(flowId10.toString());
+ op.newFlowPath().setFlowId(flowId20.toString());
+ op.commit();
+
+ IFlowPath flowPath = op.searchFlowPath(flowId10);
+ assertNotNull(flowPath);
+ op.removeFlowPath(flowPath);
+ op.commit();
+
+ assertNull(op.searchFlowPath(flowId10));
+ assertNotNull(op.searchFlowPath(flowId20));
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newFlowEntry(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testNewFlowEntry() {
+ IFlowEntry flowEntry = op.newFlowEntry();
+ FlowEntryId flowEntryId = new FlowEntryId();
+ flowEntryId.setValue(12345);
+ flowEntry.setFlowEntryId(flowEntryId.toString());
+ op.commit();
+
+ flowEntry = op.searchFlowEntry(flowEntryId);
+ assertNotNull(flowEntry);
+ assertEquals(flowEntry.getFlowEntryId(), flowEntryId.toString());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchFlowEntry(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.util.FlowEntryId)}.
+ */
+ @Test
+ public final void testSearchFlowEntry() {
+ FlowEntryId flowEntryId10 = new FlowEntryId();
+ flowEntryId10.setValue(10);
+ FlowEntryId flowEntryId20 = new FlowEntryId();
+ flowEntryId20.setValue(20);
+ FlowEntryId flowEntryId30 = new FlowEntryId();
+ flowEntryId30.setValue(30);
+
+ op.newFlowEntry().setFlowEntryId(flowEntryId10.toString());
+ op.newFlowEntry().setFlowEntryId(flowEntryId20.toString());
+ op.commit();
+
+ assertNull(op.searchFlowEntry(flowEntryId30));
+ IFlowEntry flowEntry = op.searchFlowEntry(flowEntryId10);
+ assertEquals(flowEntry.getFlowEntryId(), flowEntryId10.toString());
+ flowEntry = op.searchFlowEntry(flowEntryId20);
+ assertEquals(flowEntry.getFlowEntryId(), flowEntryId20.toString());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#getAllFlowEntries(net.onrc.onos.graph.GraphDBConnection)}.
+ */
+ @Test
+ public final void testGetAllFlowEntries() {
+ List<FlowEntryId> flowEntryIds = Arrays.asList(
+ new FlowEntryId(10), new FlowEntryId(20), new FlowEntryId(30)
+ );
+
+ for (FlowEntryId flowEntryId: flowEntryIds)
+ op.newFlowEntry().setFlowEntryId(flowEntryId.toString());
+ op.commit();
+
+ List<String> actual_ids = new ArrayList<String>();
+ for (IFlowEntry flowEntry: op.getAllFlowEntries()) actual_ids.add(flowEntry.getFlowEntryId());
+ Collections.sort(actual_ids);
+
+ List<String> expected_ids = new ArrayList<String>();
+ for (FlowEntryId flowEntryId: flowEntryIds) expected_ids.add(flowEntryId.toString());
+ Collections.sort(expected_ids);
+
+ assertArrayEquals(expected_ids.toArray(), actual_ids.toArray());
+ }
+
+ /**
+ * Test method for {@link net.onrc.onos.graph.GraphDBOperation#removeFlowEntry(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IFlowEntry)}.
+ */
+ @Test
+ public final void testRemoveFlowEntry() {
+ FlowEntryId flowEntryId10 = new FlowEntryId(10);
+ FlowEntryId flowEntryId20 = new FlowEntryId(20);
+ op.newFlowEntry().setFlowEntryId(flowEntryId10.toString());
+ op.newFlowEntry().setFlowEntryId(flowEntryId20.toString());
+ op.commit();
+
+ IFlowEntry flowEntry = op.searchFlowEntry(flowEntryId10);
+ assertNotNull(flowEntry);
+ op.removeFlowEntry(flowEntry);
+ op.commit();
+
+ assertNull(op.searchFlowEntry(flowEntryId10));
+ assertNotNull(op.searchFlowEntry(flowEntryId20));
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrieTest.java b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrieTest.java
new file mode 100644
index 0000000..571d37d
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PatriciaTrieTest.java
@@ -0,0 +1,204 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PatriciaTrieTest {
+
+ IPatriciaTrie<RibEntry> ptrie;
+ Prefix[] prefixes;
+ Map<Prefix, RibEntry> mappings;
+
+ @Before
+ public void setUp() throws Exception {
+ ptrie = new PatriciaTrie<RibEntry>(32);
+ mappings = new HashMap<Prefix, RibEntry>();
+
+ prefixes = new Prefix[] {
+ new Prefix("192.168.10.0", 24),
+ new Prefix("192.168.8.0", 23),
+ new Prefix("192.168.8.0", 22),
+ new Prefix("192.0.0.0", 7),
+ new Prefix("192.168.11.0", 24),
+ new Prefix("10.0.23.128", 25),
+ new Prefix("206.17.144.0", 20),
+ new Prefix("9.17.0.0", 12),
+ new Prefix("192.168.0.0", 16)
+ };
+
+ for (int i = 0; i < prefixes.length; i++) {
+ mappings.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
+ ptrie.put(prefixes[i], new RibEntry("192.168.10.101", "192.168.20." + i));
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testPut() {
+ IPatriciaTrie<RibEntry> ptrie = new PatriciaTrie<RibEntry>(32);
+
+ Prefix p1 = new Prefix("192.168.240.0", 20);
+ RibEntry r1 = new RibEntry("192.168.10.101", "192.168.60.2");
+ RibEntry retval = ptrie.put(p1, r1);
+ assertNull(retval);
+ retval = ptrie.lookup(p1);
+ assertTrue(r1 == retval); //should be the same object
+
+ Prefix p2 = new Prefix("192.160.0.0", 12);
+ RibEntry r2 = new RibEntry("192.168.10.101", "192.168.20.1");
+ retval = ptrie.put(p2, r2);
+ assertNull(retval);
+
+ Prefix p3 = new Prefix("192.168.208.0", 20);
+ RibEntry r3 = new RibEntry("192.168.10.101", "192.168.30.1");
+ retval = ptrie.put(p3, r3);
+ assertNull(retval);
+
+ //Insert a new RibEntry entry over a previous one
+ RibEntry r3new = new RibEntry("192.168.10.101", "192.168.60.2");
+ retval = ptrie.put(p3, r3new);
+ assertNotNull(retval);
+ assertTrue(retval.equals(r3));
+ assertTrue(retval == r3); //should be the same object
+
+ //Now we have an aggregate node with prefix 192.168.192.0/18.
+ //We will insert a RibEntry at this prefix
+ Prefix p4 = new Prefix("192.168.192.0", 18);
+ RibEntry r4 = new RibEntry("192.168.10.101", "192.168.40.1");
+ retval = ptrie.put(p4, r4);
+ assertNull(retval);
+ retval = ptrie.lookup(p4);
+ assertTrue(retval == r4); //should be the same object
+ }
+
+ @Test
+ public void testLookup() {
+ for (Map.Entry<Prefix, RibEntry> entry : mappings.entrySet()) {
+ RibEntry r = ptrie.lookup(entry.getKey());
+ assertTrue(entry.getValue().equals(r));
+ }
+
+ //These are aggregate nodes in the tree. Shouldn't be returned by lookup
+ Prefix p1 = new Prefix("0.0.0.0", 0);
+ RibEntry retval = ptrie.lookup(p1);
+ assertNull(retval);
+
+ //We'll put a RibEntry at an aggregate node and check if lookup returns correctly
+ Prefix p2 = new Prefix("192.0.0.0", 4);
+ RibEntry r2 = new RibEntry("192.168.10.101", "192.168.60.1");
+ retval = ptrie.put(p2, r2);
+ assertNull(retval);
+ retval = ptrie.lookup(p2);
+ assertTrue(retval.equals(r2));
+ }
+
+ //@Ignore
+ @Test
+ public void testMatch() {
+ Prefix p1 = new Prefix("192.168.10.30", 32);
+ Prefix p2 = new Prefix("192.168.10.30", 31);
+ Prefix p3 = new Prefix("192.168.8.241", 32);
+ Prefix p4 = new Prefix("1.0.0.0", 32);
+ Prefix p5 = new Prefix("192.168.8.0", 22);
+ Prefix p6 = new Prefix("192.168.8.0", 21);
+
+ assertTrue(ptrie.match(p1).equals(mappings.get(prefixes[0])));
+ assertTrue(ptrie.match(p2).equals(mappings.get(prefixes[0])));
+ assertTrue(ptrie.match(p3).equals(mappings.get(prefixes[1])));
+ assertNull(ptrie.match(p4));
+ assertTrue(ptrie.match(p5).equals(mappings.get(prefixes[2])));
+ //System.out.println(ptrie.match(p6).getNextHop().getHostAddress());
+ assertTrue(ptrie.match(p6).equals(mappings.get(prefixes[8])));
+
+
+ //TODO more extensive tests
+ //fail("Not yet implemented");
+ }
+
+ @Test
+ public void testRemove() {
+ Prefix p1 = new Prefix("192.168.8.0", 23);
+ RibEntry retval = ptrie.lookup(p1);
+ assertNotNull(retval);
+ boolean success = ptrie.remove(p1, retval);
+ assertTrue(success);
+
+ Prefix p2 = new Prefix("192.168.8.0", 22);
+ Prefix p3 = new Prefix("192.168.10.0", 24);
+
+ //Test it does the right thing with null arguments
+ success = ptrie.remove(null, null);
+ assertFalse(success);
+ success = ptrie.remove(p2, null);
+ assertFalse(success);
+
+ //Check other prefixes are still there
+ retval = ptrie.lookup(p2);
+ assertNotNull(retval);
+ retval = ptrie.lookup(p3);
+ assertNotNull(retval);
+
+ Prefix p4 = new Prefix("9.17.0.0", 12);
+ retval = ptrie.lookup(p4);
+ assertNotNull(retval);
+ success = ptrie.remove(p4, retval);
+ assertTrue(success);
+ success = ptrie.remove(p4, retval);
+ assertFalse(success);
+
+ //Check other prefixes are still there
+ retval = ptrie.lookup(p2);
+ assertNotNull(retval);
+ retval = ptrie.lookup(p3);
+ assertNotNull(retval);
+
+ Prefix p5 = new Prefix("192.0.0.0", 7);
+ retval = ptrie.lookup(p5);
+ assertNotNull(retval);
+ success = ptrie.remove(p5, retval);
+ assertTrue(success);
+
+ //Check other prefixes are still there
+ retval = ptrie.lookup(p2);
+ assertNotNull(retval);
+ retval = ptrie.lookup(p3);
+ assertNotNull(retval);
+
+
+ }
+
+ @Test(expected=java.util.NoSuchElementException.class)
+ public void testIterator() {
+ int[] order = new int[] {7, 5, 3, 8, 2, 1, 0, 4, 6};
+
+ Iterator<IPatriciaTrie.Entry<RibEntry>> it = ptrie.iterator();
+ int i = 0;
+ assertTrue(it.hasNext());
+ while (it.hasNext()) {
+ IPatriciaTrie.Entry<RibEntry> entry = it.next();
+ assertTrue(entry.getPrefix().equals(prefixes[order[i]]));
+ i++;
+ }
+ assertFalse(it.hasNext());
+ assertTrue(i == order.length);
+
+ IPatriciaTrie<RibEntry> pt = new PatriciaTrie<RibEntry>(32);
+ Iterator<IPatriciaTrie.Entry<RibEntry>> it2 = pt.iterator();
+ assertFalse(it2.hasNext());
+ it.next(); //throws NoSuchElementException
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/bgproute/PrefixTest.java b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PrefixTest.java
new file mode 100644
index 0000000..6ebaf0f
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PrefixTest.java
@@ -0,0 +1,101 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PrefixTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testPrefixByteArray() {
+ byte[] b1 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0x00, (byte)0x00};
+ byte[] b2 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0xff, (byte)0xff};
+ byte[] b3 = new byte[] {(byte)0x8f, (byte)0xac, (byte)0x00, (byte)0x00};
+ byte[] b4 = new byte[] {(byte)0x8f, (byte)0xa0, (byte)0x00, (byte)0x00};
+
+ Prefix p1 = new Prefix(b1, 12);
+ Prefix p2 = new Prefix(b2, 12);
+ Prefix p3 = new Prefix(b3, 12);
+ Prefix p4 = new Prefix(b4, 11);
+
+ //Have different byte arrays, but should be equal after construction
+ assertTrue(p1.equals(p2));
+ assertTrue(p2.equals(p3));
+
+ //Same byte array, but should be false
+ assertFalse(p1.equals(p4));
+
+ assertTrue(Arrays.equals(p1.getAddress(), p3.getAddress()));
+ assertTrue(p1.toString().equals(p2.toString()));
+ assertTrue(Arrays.equals(p1.getAddress(), p4.getAddress()));
+ assertFalse(p1.toString().equals(p4.toString()));
+ }
+
+ @Test
+ public void testPrefixString() {
+ Prefix p1 = new Prefix("192.168.166.0", 24);
+ Prefix p2 = new Prefix("192.168.166.0", 23);
+ Prefix p3 = new Prefix("192.168.166.128", 24);
+ Prefix p4 = new Prefix("192.168.166.128", 25);
+
+ assertFalse(p1.equals(p2));
+ assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
+
+ assertTrue(p1.equals(p3));
+ assertTrue(Arrays.equals(p1.getAddress(), p2.getAddress()));
+
+ assertFalse(p3.equals(p4));
+ assertFalse(Arrays.equals(p3.getAddress(), p4.getAddress()));
+
+ assertTrue(p1.toString().equals(p3.toString()));
+ assertEquals(p1.hashCode(), p3.hashCode());
+ }
+
+ @Test
+ public void testPrefixReturnsSame() {
+ //Create a prefix of all 1s for each prefix length.
+ //Check that Prefix doesn't mangle it
+ int MAX_PREFIX_LENGTH = 32;
+ for (int prefixLength = 1; prefixLength <= MAX_PREFIX_LENGTH; prefixLength++) {
+ byte address[] = new byte[MAX_PREFIX_LENGTH/Byte.SIZE];
+
+ int lastByte = (prefixLength - 1) / Byte.SIZE;
+ int lastBit = (prefixLength - 1) % Byte.SIZE;
+
+ for (int j = 0; j < address.length; j++) {
+ if (j < lastByte) {
+ address[j] = (byte)0xff;
+ }
+ else if (j == lastByte) {
+ byte b = 0;
+ byte msb = (byte) 0x80;
+ for (int k = 0; k < Byte.SIZE; k++) {
+ if (k <= lastBit) {
+ b |= (msb >> k);
+ }
+ }
+ address[j] = b;
+ }
+ else {
+ address[j] = 0;
+ }
+ }
+
+ Prefix p = new Prefix(address, prefixLength);
+ System.out.println(p.printAsBits());
+ assertTrue(Arrays.equals(address, p.getAddress()));
+ }
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/bgproute/PtreeTest.java b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PtreeTest.java
new file mode 100644
index 0000000..1135407
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/bgproute/PtreeTest.java
@@ -0,0 +1,228 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
+
+public class PtreeTest {
+
+ private Logger log = LoggerFactory.getLogger(PtreeTest.class);
+
+ private Ptree ptree;
+ private PatriciaTrie<RibEntry> ooptrie;
+
+ private Map<String, byte[]> byteAddresses;
+
+ @Before
+ public void setUp() throws Exception {
+ ptree = new Ptree(32);
+ ooptrie = new PatriciaTrie<RibEntry>(32);
+
+ String[] strPrefixes = {
+ "192.168.10.0/24",
+ "192.168.10.0/23",
+ "192.168.10.0/22",
+ "192.0.0.0/7",
+ "192.168.11.0/24",
+ "10.0.23.128/25",
+ "206.17.144.0/20",
+ "9.17.0.0/12",
+ "192.168.0.0/16"
+ };
+
+ byteAddresses = new HashMap<String, byte[]>(strPrefixes.length+10);
+ for (String prefix : strPrefixes) {
+ String address = prefix.split("/")[0];
+ int prefixLength = Integer.parseInt(prefix.split("/")[1]);
+ byteAddresses.put(prefix, InetAddresses.forString(address).getAddress());
+
+ PtreeNode node = ptree.acquire(byteAddresses.get(prefix), prefixLength);
+ node.rib = new RibEntry("192.168.10.101", "192.168.60.1");
+ ooptrie.put(new Prefix(byteAddresses.get(prefix), prefixLength),
+ new RibEntry("192.168.10.101", "192.168.60.1"));
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Ignore
+ @Test
+ public void testAcquireByteArray() {
+ fail("Not yet implemented");
+ }
+
+ @Ignore
+ @Test
+ public void testAcquireByteArrayInt() {
+ //First let's test an empty Ptree
+ Ptree localPtree = new Ptree(32);
+ PtreeNode node = localPtree.acquire(new byte[] {0x00, 0x00, 0x00, 0x00});
+ assertTrue(node != null && node.rib == null);
+
+ //Now let's look at the prepopulated tree
+ String testPrefix = "206.17.144.0/20";
+ PtreeNode existingNode = ptree.acquire(byteAddresses.get(testPrefix), 20);
+ printByteArray(existingNode.key);
+ printByteArray(byteAddresses.get(testPrefix));
+ assertTrue(existingNode != null && existingNode.rib == null);
+
+ assertTrue(Arrays.equals(existingNode.key, byteAddresses.get(testPrefix)));
+ }
+
+ @Test
+ public void testLookup() {
+ String prefix1 = "192.168.10.12";
+ int length1 = 29;
+ PtreeNode node1 = ptree.lookup(InetAddresses.forString(prefix1).getAddress(), length1);
+
+ //There should be no direct match
+ assertTrue(node1 == null);
+
+ log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
+
+ String prefix2 = "206.17.144.0";
+ int length2 = 20;
+ PtreeNode node2 = ptree.lookup(InetAddresses.forString(prefix2).getAddress(), length2);
+
+ assertTrue(node2 != null);
+ assertTrue(Arrays.equals(node2.key, byteAddresses.get(prefix2 + "/" + length2)));
+
+ log.debug("{} null: {}", "node2", node2 == null ? "true" : "false");
+ if (node2 != null) {
+ log.debug("{} key: {}, keybits: {}", new Object[] {"node2", node2.key, node2.keyBits});
+ }
+
+ String prefix3 = "192.0.0.0";
+ int length3 = 7;
+ PtreeNode node3 = ptree.lookup(InetAddresses.forString(prefix3).getAddress(), length3);
+ assertTrue(node3 != null);
+ }
+
+ @Test
+ public void testMatch() {
+ String prefix1 = "192.168.10.12";
+ int length1 = 29;
+ PtreeNode node1 = ptree.match(InetAddresses.forString(prefix1).getAddress(), length1);
+
+ //There should be no direct match, but we should get the covering prefix
+ assertTrue(node1 != null);
+ assertTrue(Arrays.equals(node1.key, byteAddresses.get("192.168.10.0/24")));
+
+ log.debug("{} null: {}", "node1", node1 == null ? "true" : "false");
+ if (node1 != null) {
+ log.debug("{} key: {}, keybits: {}", new Object[] {"node1", node1.key, node1.keyBits});
+ }
+ }
+
+ @Ignore
+ @Test
+ public void testTraverse() {
+
+ String expected = "[0, 0, 0, 0]/0\n";
+ expected += "[8, 0, 0, 0]/6\n";
+ expected += "[9, 17, 0, 0]/12\n";
+ expected += "[10, 0, 23, -128]/25\n";
+ expected += "[-64, 0, 0, 0]/4\n";
+ expected += "[-64, -88, 0, 0]/16\n";
+ expected += "[-64, -88, 8, 0]/22\n";
+ expected += "[-64, -88, 10, 0]/23\n";
+ expected += "[-64, -88, 10, 0]/24\n";
+ expected += "[-64, -88, 11, 0]/24\n";
+ expected += "[-50, 17, -112, 0]/20\n";
+
+ PtreeNode node;
+ String result = "";
+
+ for (node = ptree.begin(); node != null; node = ptree.next(node)) {
+ result += printByteArray(node.key) + "/" + node.keyBits + "\n";
+ }
+
+ assertEquals(expected, result);
+ }
+
+ @Ignore
+ @Test
+ public void testBegin() {
+ fail("Not yet implemented");
+ }
+
+ @Ignore
+ @Test
+ public void testNext() {
+ fail("Not yet implemented");
+ }
+
+ @Ignore
+ @Test
+ public void testDelReference() {
+ fail("Not yet implemented");
+ }
+
+ @Ignore
+ @Test
+ public void testMisc() {
+ int bitIndex = -1;
+ int index = (int)(bitIndex / Byte.SIZE);
+ int bit = (int)(bitIndex % Byte.SIZE);
+
+ log.debug("index {} bit {}", index, bit);
+ log.debug("percent {}", 1%8);
+
+ //PtreeNode node1 = new PtreeNode(new byte[] {0x0, 0x0, 0x0, 0x0}, 0, 4);
+ PtreeNode node1 = new PtreeNode(null, 0, 4);
+ log.debug("node1: key {}, keybits {}", printByteArray(node1.key), node1.keyBits);
+
+ //PtreeNode node2 = new PtreeNode(new byte[] {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff},
+ PtreeNode node2 = new PtreeNode(null,
+ 32, 4);
+ log.debug("node2: key {}, keybits {}", printByteArray(node2.key), node2.keyBits);
+ }
+
+ @Test
+ public void testIteration() {
+ Iterator<IPatriciaTrie.Entry<RibEntry>> it = ooptrie.iterator();
+
+ while (it.hasNext()) {
+ IPatriciaTrie.Entry<RibEntry> entry = it.next();
+ log.debug("PatriciaTrie prefix {} \t {}", entry.getPrefix(), entry.getPrefix().printAsBits());
+ }
+
+ try {
+ PtreeNode node;
+ for (node = ptree.begin(); node != null; node = ptree.next(node)) {
+ log.debug("Ptree prefix {}/{}", InetAddress.getByAddress(node.key).getHostAddress(), node.keyBits);
+ }
+ } catch (UnknownHostException e) {
+
+ }
+ }
+
+ private String printByteArray(byte[] array) {
+ String result = "[";
+ for (byte b : array) {
+ result += b + ", ";
+ }
+ result = result.substring(0, result.length() - 2);
+ result += "]";
+ return result;
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
new file mode 100644
index 0000000..7bd75d2
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
@@ -0,0 +1,206 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIDeviceObjectTest {
+
+ //The test network is ./titan/schema/test-network.xml
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ TestDatabaseManager.deleteTestDatabase();
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ //TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set MacAddress method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the mac address.
+ * 2. Should get the mac address.
+ */
+ @Test
+ public void testSetGetMacAddress() {
+ String macaddr = "00:00:00:00:00:00:0a:07";
+ IDeviceObject devObj = ope.newDevice();
+ devObj.setMACAddress(macaddr);
+ assertEquals(devObj.getMACAddress(), macaddr);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set IPAddress method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the ip address.
+ * 2. Should get the ip address.
+ */
+ @Test
+ public void testSetGetIPAddress() {
+ int ipaddr = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.0.1"));
+ IDeviceObject devObj = ope.newDevice();
+ IIpv4Address ipv4Address = ope.newIpv4Address();
+ ipv4Address.setIpv4Address(ipaddr);
+ devObj.addIpv4Address(ipv4Address);
+ assertEquals(devObj.getIpv4Address(ipaddr), ipv4Address);
+ }
+
+ /**
+ * Desc:
+ * Test method for get attached port.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the attached ports.
+ */
+ @Test
+ public void testGetAttachedPort() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short number = 1;
+ Short number2 = 2;
+ IPortObject portObj = ope.newPort(dpid, number);
+ IPortObject portObj2 = ope.newPort(dpid, number2);
+
+ IDeviceObject devObj = ope.newDevice();
+
+ portObj.setDevice(devObj);
+ portObj2.setDevice(devObj);
+
+ HashMap<Short, IPortObject> portObjectList = new HashMap<Short, IPortObject>();
+ for(IPortObject port : devObj.getAttachedPorts())
+ {
+ portObjectList.put(port.getNumber(), port);
+ }
+
+ assertTrue(portObjectList.containsValue(portObj));
+ assertTrue(portObjectList.containsValue(portObj2));
+
+ }
+
+ /**
+ * Desc:
+ * Test method for set and remove host port method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set host port from the device.
+ * 2. Should remove host port from the device.
+ */
+ @Test
+ public void testSetRemoveHostPort() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short number = 1;
+ IPortObject portObj = ope.newPort(dpid, number);
+
+ IDeviceObject devObj = ope.newDevice();
+
+ devObj.setHostPort(portObj);
+
+ HashMap<String, IDeviceObject> portObjectList = new HashMap<String, IDeviceObject>();
+ for(IDeviceObject dev : portObj.getDevices())
+ {
+ portObjectList.put(dev.getMACAddress(), dev);
+ }
+ assertTrue(portObjectList.containsValue(devObj));
+
+ devObj.removeHostPort(portObj);
+
+ HashMap<String, IDeviceObject> portObjectList2 = new HashMap<String, IDeviceObject>();
+ for(IDeviceObject dev : portObj.getDevices())
+ {
+ portObjectList2.put(dev.getMACAddress(), dev);
+ }
+ assertTrue(!portObjectList2.containsValue(devObj));
+ }
+
+ /**
+ * Desc:
+ * Test method for getSwitch method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the switch connected to the device.
+ */
+ @Test
+ public void testGetSwitches() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String dpid2 = "00:00:00:00:00:00:0a:08";
+ Short number = 1;
+ Short number2 = 2;
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ ISwitchObject swObj2 = ope.newSwitch(dpid2);
+ IPortObject portObj = ope.newPort(dpid, number);
+ IPortObject portObj2 = ope.newPort(dpid2, number2);
+ swObj.addPort(portObj);
+ swObj2.addPort(portObj2);
+ IDeviceObject devObj = ope.newDevice();
+ portObj.setDevice(devObj);
+ portObj2.setDevice(devObj);
+
+ HashMap<String, ISwitchObject> switchObjectList = new HashMap<String, ISwitchObject>();
+ for(ISwitchObject sw : devObj.getSwitch())
+ {
+ switchObjectList.put(sw.getDPID(), sw);
+ }
+ assertTrue(switchObjectList.containsValue(swObj));
+ assertTrue(switchObjectList.containsValue(swObj2));
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
new file mode 100644
index 0000000..06d8522
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
@@ -0,0 +1,444 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIFlowEntryTest {
+
+ //The test network is ./titan/schema/test-network.xml
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+ private IFlowEntry flowEntry = null;
+
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ TestDatabaseManager.deleteTestDatabase();
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ //TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+
+ flowEntry = ope.newFlowEntry();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get FlowEntryId.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set FlowEntryId.
+ * 2. Should get FlowEntryId.
+ */
+ @Test
+ public void testSetGetFlowEntryId() {
+ String flowEntryId = "xx";
+ flowEntry.setFlowEntryId(flowEntryId);
+ assertEquals(flowEntry.getFlowEntryId(), flowEntryId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get SwitchDpid.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set SwitchDpid.
+ * 2. Should get SwitchDpid.
+ */
+ @Test
+ public void testSetGetSwitchDpid() {
+ String switchDpid = "00:00:00:00:00:11";
+ flowEntry.setSwitchDpid(switchDpid);
+ assertEquals(flowEntry.getSwitchDpid(), switchDpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get UserState.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set UserState.
+ * 2. Should get UserState.
+ */
+ @Test
+ public void testSetGetUserState() {
+ String userStete = "good";
+ flowEntry.setUserState(userStete);
+ assertEquals(flowEntry.getUserState(), userStete);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get SwitchState.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set SwitchState.
+ * 2. Should get SwitchState.
+ */
+ @Test
+ public void testSetGetSwitchState() {
+ String switchStete = "ACTIVE";
+ flowEntry.setSwitchState(switchStete);
+ assertEquals(flowEntry.getSwitchState(), switchStete);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get ErrorStateType.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set ErrorStateType.
+ * 2. Should get ErrorStateType.
+ */
+ @Test
+ public void testSetGetErrorStateType() {
+ String errorSteteType = "error";
+ flowEntry.setErrorStateType(errorSteteType);
+ assertEquals(flowEntry.getErrorStateType(), errorSteteType);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get ErrorStateCode.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set ErrorStateCode.
+ * 2. Should get ErrorStateCode.
+ */
+ @Test
+ public void testSetGetErrorStateCode() {
+ String errorSteteCode = "error";
+ flowEntry.setErrorStateCode(errorSteteCode);
+ assertEquals(flowEntry.getErrorStateCode(), errorSteteCode);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchInPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchInPort.
+ * 2. Should get MatchInPort.
+ */
+ @Test
+ public void testSetGetMatchInPort() {
+ Short inPort = 1;
+ flowEntry.setMatchInPort(inPort);
+ assertEquals(flowEntry.getMatchInPort(), inPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcMac.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcMac.
+ * 2. Should get MatchSrcMac.
+ */
+ @Test
+ public void testSetGetMatchSrcMac() {
+ String matchSrcMac = "00:00:00:00:00:11";
+ flowEntry.setMatchSrcMac(matchSrcMac);
+ assertEquals(flowEntry.getMatchSrcMac(), matchSrcMac);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstMac.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstMac.
+ * 2. Should get MatchDstMac.
+ */
+ @Test
+ public void testSetGetMatchDstMac() {
+ String matchDstMac = "00:00:00:00:00:11";
+ flowEntry.setMatchDstMac(matchDstMac);
+ assertEquals(flowEntry.getMatchDstMac(), matchDstMac);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchEthernetFrameType.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchEthernetFrameType.
+ * 2. Should get MatchEthernetFrameType.
+ */
+ @Test
+ public void testSetGetMatchEthernetFrameType() {
+ Short matchEthernetFrameType = 1;
+ flowEntry.setMatchEthernetFrameType(matchEthernetFrameType);
+ assertEquals(flowEntry.getMatchEthernetFrameType(), matchEthernetFrameType);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanId.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanId.
+ * 2. Should get MatchVlanId.
+ */
+ @Test
+ public void testSetGetMatchVlanId() {
+ Short matchVlanId = 10;
+ flowEntry.setMatchVlanId(matchVlanId);
+ assertEquals(flowEntry.getMatchVlanId(), matchVlanId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanPriority.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanPriority.
+ * 2. Should get MatchVlanPriority.
+ */
+ @Test
+ public void testSetGetMatchVlanPriority() {
+ Byte matchVlanPriority = 10;
+ flowEntry.setMatchVlanPriority(matchVlanPriority);
+ assertEquals(flowEntry.getMatchVlanPriority(), matchVlanPriority);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get SrcIPv4Net.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set SrcIPv4Net.
+ * 2. Should get SrcIPv4Net.
+ */
+ @Test
+ public void testSetGetMatchSrcIPv4Net() {
+ String srcIPv4Net = "192.168.0.1";
+ flowEntry.setMatchSrcIPv4Net(srcIPv4Net);
+ assertEquals(flowEntry.getMatchSrcIPv4Net(), srcIPv4Net);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstIPv4Net.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstIPv4Net.
+ * 2. Should get MatchDstIPv4Net.
+ */
+ @Test
+ public void testSetGetMatchDstIPv4Net() {
+ String dstIPv4Net = "192.168.0.1";
+ flowEntry.setMatchDstIPv4Net(dstIPv4Net);
+ assertEquals(flowEntry.getMatchDstIPv4Net(), dstIPv4Net);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpProto.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpProto.
+ * 2. Should get MatchIpProto.
+ */
+ @Test
+ public void testSetGetMatchIpProto() {
+ Byte matchIpProto = 20;
+ flowEntry.setMatchIpProto(matchIpProto);
+ assertEquals(flowEntry.getMatchIpProto(), matchIpProto);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpToS.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpToS.
+ * 2. Should get MatchIpToS.
+ */
+ @Test
+ public void testSetGetMatchIpToS() {
+ Byte matchIpToS = 20;
+ flowEntry.setMatchIpToS(matchIpToS);
+ assertEquals(flowEntry.getMatchIpToS(), matchIpToS);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcTcpUdpPort.
+ * 2. Should get MatchSrcTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchSrcTcpUdpPort() {
+ Short srcTcpUdpPort = (short)65535;
+ flowEntry.setMatchSrcTcpUdpPort(srcTcpUdpPort);
+ assertEquals(flowEntry.getMatchSrcTcpUdpPort(), srcTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstTcpUdpPort.
+ * 2. Should get MatchDstTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchDstTcpUdpPort() {
+ Short dstTcpUdpPort = (short)65535;
+ flowEntry.setMatchDstTcpUdpPort(dstTcpUdpPort);
+ assertEquals(flowEntry.getMatchDstTcpUdpPort(), dstTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get ActionOutputPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set ActionOutputPort.
+ * 2. Should get ActionOutputPort.
+ */
+ @Test
+ public void testSetGetActionOutputPort() {
+ Short actionOutputPort = 1;
+ flowEntry.setActionOutputPort(actionOutputPort);
+ assertEquals(flowEntry.getActionOutputPort(), actionOutputPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get FlowPath.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set FlowPath.
+ * 2. Should get FlowPath.
+ */
+ @Test
+ public void testSetGetFlowPath() {
+ IFlowPath fp = ope.newFlowPath();
+ String flowId = "xx";
+ fp.setFlowId(flowId);
+ flowEntry.setFlow(fp);
+ IFlowPath fp2 = flowEntry.getFlow();
+ assertEquals(fp2.getFlowId(), flowId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get Switch.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set Switch.
+ * 2. Should get Switch.
+ */
+ @Test
+ public void testSetGetSwitch() {
+ String dpid = "00:00:00:00:00:22";
+ ISwitchObject sw1 = ope.newSwitch(dpid);
+ flowEntry.setSwitch(sw1);
+ ISwitchObject sw2 = flowEntry.getSwitch();
+ assertEquals(sw2, sw1);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get InPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set InPort.
+ * 2. Should get InPort.
+ */
+ @Test
+ public void testSetGetInPort() {
+ String dpid = "00:00:00:00:00:22";
+ Short portNum = 4;
+ IPortObject port1 = ope.newPort(dpid, portNum);
+ flowEntry.setInPort(port1);
+ IPortObject port2 = flowEntry.getInPort();
+ assertEquals(port2, port1);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get OutPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set OutPort.
+ * 2. Should get OutPort.
+ */
+ @Test
+ public void testSetGetOutPort() {
+ String dpid = "00:00:00:00:00:22";
+ Short portNum = 4;
+ IPortObject port1 = ope.newPort(dpid, portNum);
+ flowEntry.setOutPort(port1);
+ IPortObject port2 = flowEntry.getOutPort();
+ assertEquals(port2, port1);
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
new file mode 100644
index 0000000..9a1e34a
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
@@ -0,0 +1,527 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIFlowPathTest {
+
+ //The test network is ./titan/schema/test-network.xml
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+ private IFlowPath flowPath = null;
+ private IFlowEntry flowEntry = null;
+
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ TestDatabaseManager.deleteTestDatabase();
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ //TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+
+ flowPath = ope.newFlowPath();
+ flowEntry = ope.newFlowEntry();
+ flowEntry.setState("zz");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set FlowId method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the flow id.
+ * 2. Should get the flow id.
+ */
+ @Test
+ public void testSetGetFlowId() {
+ String flowId = "xx";
+ flowPath.setFlowId(flowId);
+ assertEquals(flowPath.getFlowId(), flowId);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set InstallerId method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the installer id.
+ * 2. Should get the installer id.
+ */
+ @Test
+ public void testSetGetInstallerId() {
+ String flowId = "xx";
+ String installerId = "yy";
+ flowPath.setFlowId(flowId);
+ flowPath.setInstallerId(installerId);
+ assertEquals(flowPath.getInstallerId(), installerId);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set FlowPathType method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Flow Path Type.
+ * 2. Should get the Flow Path Type.
+ */
+ @Test
+ public void testSetGetFlowPathType() {
+ String flowId = "xx";
+ String flowPathType = "FP_TYPE_SHORTEST_PATH";
+ flowPath.setFlowId(flowId);
+ flowPath.setFlowPathType(flowPathType);
+ assertEquals(flowPath.getFlowPathType(), flowPathType);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set FlowPathUserState method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Flow Path User State.
+ * 2. Should get the Flow Path User State.
+ */
+ @Test
+ public void testSetGetFlowPathUserState() {
+ String flowId = "xx";
+ String flowPathUserState = "FP_USER_ADD";
+ flowPath.setFlowId(flowId);
+ flowPath.setFlowPathUserState(flowPathUserState);
+ assertEquals(flowPath.getFlowPathUserState(), flowPathUserState);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set FlowPathFlags method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Flow Path Flags.
+ * 2. Should get the Flow Path Flags.
+ */
+ @Test
+ public void testSetGetFlowPathFlags() {
+ String flowId = "xx";
+ Long flowPathFlags = new Long(0x3);
+ flowPath.setFlowId(flowId);
+ flowPath.setFlowPathFlags(flowPathFlags);
+ assertEquals(flowPath.getFlowPathFlags(), flowPathFlags);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set SourceSwitch method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the source switch.
+ * 2. Should get the source switch.
+ */
+ @Test
+ public void testSetGetSourceSwitch() {
+ String flowId = "xx";
+ String sourceSwitch = "aa";
+ flowPath.setFlowId(flowId);
+ flowPath.setSrcSwitch(sourceSwitch);
+ assertEquals(flowPath.getSrcSwitch(), sourceSwitch);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set SourcePort method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the source port.
+ * 2. Should get the source port.
+ */
+ @Test
+ public void testSetGetSourcePort() {
+ String flowId = "xx";
+ Short sourcePort = 1;
+ flowPath.setFlowId(flowId);
+ flowPath.setSrcPort(sourcePort);
+ assertEquals(flowPath.getSrcPort(), sourcePort);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set DestSwitch method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the dest switch.
+ * 2. Should get the dest switch.
+ */
+ @Test
+ public void testSetGetDestSwitch() {
+ String flowId = "xx";
+ String destSwitch = "bb";
+ flowPath.setFlowId(flowId);
+ flowPath.setDstSwitch(destSwitch);
+ assertEquals(flowPath.getDstSwitch(), destSwitch);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set DestPort method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the source dest port.
+ * 2. Should get the source dest port.
+ */
+ @Test
+ public void testSetGetDstPort() {
+ String flowId = "xx";
+ Short dstPort = 2;
+ flowPath.setFlowId(flowId);
+ flowPath.setDstPort(dstPort);
+ assertEquals(flowPath.getDstPort(), dstPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set DataPathSummary method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the data path summary.
+ * 2. Should get the data path summary.
+ */
+ @Test
+ public void testSetGetDataPathSummary() {
+ String flowId = "xx";
+ String dataPathSummary = "yy";
+ flowPath.setFlowId(flowId);
+ flowPath.setInstallerId(dataPathSummary);
+ assertEquals(flowPath.getInstallerId(), dataPathSummary);
+ }
+
+ public boolean testIFlowEntry(IFlowPath fp, IFlowEntry fe)
+ {
+ ArrayList<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
+ for(IFlowEntry inFlowEntry : fp.getFlowEntries())
+ {
+ flowEntryList.add(inFlowEntry);
+ }
+ return flowEntryList.contains(fe);
+ }
+
+ /**
+ * Desc:
+ * Test method for addFlowEntry and getFlorEntries method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should add the FlowEntry.
+ * 2. Should get the FlowEntries. It is tested in the testIFlowEntry method.
+ */
+ @Test
+ public void testAddFlowEntryAndGetFlowEntries() {
+ String flowId = "xx";
+ flowPath.setFlowId(flowId);
+ flowPath.addFlowEntry(flowEntry);
+ IFlowEntry flowEntry2 = ope.newFlowEntry();
+ flowPath.addFlowEntry(flowEntry2);
+ assertTrue(testIFlowEntry(flowPath, flowEntry));
+ assertTrue(testIFlowEntry(flowPath, flowEntry2));
+ }
+
+ /**
+ * Desc:
+ * Test method for remove FlowEntry.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should remove FlowEntry.
+ */
+ @Test
+ public void testRemoveFlowEntry() {
+ String flowId = "xx";
+ flowPath.setFlowId(flowId);
+ flowPath.addFlowEntry(flowEntry);
+ flowPath.removeFlowEntry(flowEntry);
+ assertTrue(!testIFlowEntry(flowPath, flowEntry));
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcMac
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcMac.
+ * 2. Should get MatchSrcMac.
+ */
+ @Test
+ public void testSetGetMatchSrcMac() {
+ String flowId = "xx";
+ String matchSrcMac = "00:00:00:00:00:11";
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchSrcMac(matchSrcMac);
+ assertEquals(flowPath.getMatchSrcMac(), matchSrcMac);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstMac.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstMac.
+ * 2. Should get MatchDstMac.
+ */
+ @Test
+ public void testSetGetMatchDstMac() {
+ String flowId = "xx";
+ String matchDstMac = "00:00:00:00:00:11";
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchDstMac(matchDstMac);
+ assertEquals(flowPath.getMatchDstMac(), matchDstMac);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchEthernetFrameType
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchEthernetFrameType.
+ * 2. Should get MatchEthernetFrameType.
+ */
+ @Test
+ public void testSetGetMatchEthernetFrameType() {
+ String flowId = "xx";
+ Short matchEthernetFrameType = 1;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchEthernetFrameType(matchEthernetFrameType);
+ assertEquals(flowPath.getMatchEthernetFrameType(), matchEthernetFrameType);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanId
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanId.
+ * 2. Should get MatchVlanId.
+ */
+ @Test
+ public void testSetGetMatchVlanId() {
+ String flowId = "xx";
+ Short matchVlanId = 10;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchVlanId(matchVlanId);
+ assertEquals(flowPath.getMatchVlanId(), matchVlanId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanPriority
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanPriority.
+ * 2. Should get MatchVlanPriority.
+ */
+ @Test
+ public void testSetGetMatchVlanPriority() {
+ String flowId = "xx";
+ Byte matchVlanPriority = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchVlanPriority(matchVlanPriority);
+ assertEquals(flowPath.getMatchVlanPriority(), matchVlanPriority);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcIPv4Net.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcIPv4Net.
+ * 2. Should get MatchSrcIPv4Net.
+ */
+ @Test
+ public void testSetGetMatchSrcIPv4Net() {
+ String flowId = "xx";
+ String ip = "192.168.0.1";
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchSrcIPv4Net(ip);
+ assertEquals(flowPath.getMatchSrcIPv4Net(), ip);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstIPv4Net.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstIPv4Net.
+ * 2. Should get MatchDstIPv4Net.
+ */
+ @Test
+ public void testSetGetMatchDstIPv4Net() {
+ String flowId = "xx";
+ String ip = "192.168.0.1";
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchDstIPv4Net(ip);
+ assertEquals(flowPath.getMatchDstIPv4Net(), ip);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpProto
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpProto.
+ * 2. Should get MatchIpProto.
+ */
+ @Test
+ public void testSetGetMatchIpProto() {
+ String flowId = "xx";
+ Byte matchIpProto = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchIpProto(matchIpProto);
+ assertEquals(flowPath.getMatchIpProto(), matchIpProto);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpToS
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpToS.
+ * 2. Should get MatchIpToS.
+ */
+ @Test
+ public void testSetGetMatchIpToS() {
+ String flowId = "xx";
+ Byte matchIpToS = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchIpToS(matchIpToS);
+ assertEquals(flowPath.getMatchIpToS(), matchIpToS);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcTcpUdpPort.
+ * 2. Should get MatchSrcTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchSrcTcpUdpPort() {
+ String flowId = "xx";
+ Short srcTcpUdpPort = (short)65535;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchSrcTcpUdpPort(srcTcpUdpPort);
+ assertEquals(flowPath.getMatchSrcTcpUdpPort(), srcTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstTcpUdpPort.
+ * 2. Should get MatchDstTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchDstTcpUdpPort() {
+ String flowId = "xx";
+ Short dstTcpUdpPort = (short)65535;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchDstTcpUdpPort(dstTcpUdpPort);
+ assertEquals(flowPath.getMatchDstTcpUdpPort(), dstTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for get Switches.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get switches.
+ */
+ @Test
+ public void testGetSwitches() {
+ String flowId = "xx";
+ String dpid = "1";
+ flowPath.setFlowId(flowId);
+ ISwitchObject sw = ope.newSwitch(dpid);
+ flowEntry.setSwitch(sw);
+ flowPath.addFlowEntry(flowEntry);
+
+ HashMap<String, ISwitchObject> swList = new HashMap<String, ISwitchObject>();
+ for(ISwitchObject insw : flowPath.getSwitches()){
+ swList.put(sw.getDPID(), insw);
+ }
+
+ assertTrue(swList.containsKey(dpid));
+ }
+
+ //TODO Dont know how to set the state property.
+ @Test
+ public void testGetState() {
+ String status = null;
+ assertEquals(flowPath.getState(), status);
+ }
+
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java
new file mode 100644
index 0000000..74f9758
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java
@@ -0,0 +1,355 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIPortObjectTest {
+
+ //The test network is ./titan/schema/test-network.xml
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+
+ private ISwitchObject swObj;
+ private IPortObject portObj;
+ private IPortObject portObj2;
+ String dpid;
+ Short number;
+ Short number2;
+
+ private ISwitchObject swObjParty;
+ private IPortObject portObjParty1;
+ private IPortObject portObjParty2;
+ String dpidParty;
+ Short numberParty1;
+ Short numberParty2;
+
+
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ TestDatabaseManager.deleteTestDatabase();
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ //TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+
+ dpid = "00:00:00:00:00:00:0a:07";
+ number = 1;
+ number2 = 2;
+ swObj = ope.newSwitch(dpid);
+ portObj = ope.newPort(dpid, number);
+ portObj2 = ope.newPort(dpid, number2);
+
+ swObj.addPort(portObj);
+ swObj.addPort(portObj2);
+
+ dpidParty = "00:00:00:00:00:00:0a:08";
+ numberParty1 = 1;
+ numberParty2 = 2;
+ swObjParty = ope.newSwitch(dpidParty);
+ portObjParty1 = ope.newPort(dpidParty, numberParty1);
+ portObjParty2 = ope.newPort(dpidParty, numberParty2);
+ swObjParty.addPort(portObjParty1);
+ swObjParty.addPort(portObjParty2);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get port number property.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the port number.
+ * 2. Should get the port number.
+ */
+ @Test
+ public void testSetGetNumber() {
+ assertEquals(portObj.getNumber(), number);
+ Short testedNumber = 4;
+ portObj.setNumber(testedNumber);
+ assertEquals(portObj.getNumber(), testedNumber);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get port id property.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the port id.
+ * 2. Should get the port id.
+ */
+ @Test
+ public void testSetGetPortId() {
+ String portId = "test1";
+ portObj.setPortId(portId);
+ assertEquals(portObj.getPortId(), portId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get port desc property.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the port desc.
+ * 2. Should get the port desc.
+ */
+ @Test
+ public void testSetGetDesc() {
+ String testedDesc = "port 4 at ATL Switch";
+ portObj.setDesc(testedDesc);
+ assertEquals(portObj.getDesc(), testedDesc);
+ }
+
+
+ /**
+ * Desc:
+ * Test method for set and get port status property.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the port status.
+ * 2. Should get the port status.
+ */
+ @Test
+ public void testSetGetPortState() {
+ Integer portState = OFPortState.OFPPS_STP_FORWARD.getValue();
+ portObj.setPortState(portState);
+ assertEquals(portObj.getPortState(), portState);
+ }
+
+ /**
+ * Desc:
+ * Test method for get switch object.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the switch status.
+ */
+ @Test
+ public void testGetSwitch() {
+ ISwitchObject sw = portObj.getSwitch();
+ assertEquals(sw.getDPID(), dpid);
+ }
+
+ private boolean checkIDeviceObject(IPortObject IportObj, String mac)
+ {
+ HashMap<String, IDeviceObject> devList = new HashMap<String, IDeviceObject>();
+ for(IDeviceObject IdevObj : IportObj.getDevices())
+ {
+ devList.put(IdevObj.getMACAddress(), IdevObj);
+ }
+ return devList.containsKey(mac);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and remove device object.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the device object.
+ * 2. SHould remove the device object.
+ */
+ @Test
+ public void testSetAndRemoveDevice() {
+ IDeviceObject devObj = ope.newDevice();
+ String devMac = "00:00:00:00:00:11";
+ devObj.setMACAddress(devMac);
+
+ boolean b = checkIDeviceObject(portObj, devMac);
+ assertTrue(!b);
+ portObj.setDevice(devObj);
+ boolean b2 = checkIDeviceObject(portObj, devMac);
+ assertTrue(b2);
+
+ portObj.removeDevice(devObj);
+ boolean b3 = checkIDeviceObject(portObj, devMac);
+ assertTrue(!b3);
+
+ }
+
+ /**
+ * Desc:
+ * Test method for get devices object.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the device objects.
+ */
+ @Test
+ public void testGetDevices() {
+ IDeviceObject devObj = ope.newDevice();
+ String devMac = "58:55:ca:c4:1b:a0";
+ devObj.setMACAddress(devMac);
+
+ portObj.setDevice(devObj);
+ boolean b = checkIDeviceObject(portObj, devMac);
+ assertTrue(b);
+ }
+
+ /**
+ * Desc:
+ * Test method for set, get and remove linked port.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the linked objects.
+ * 2. Should get the linked objects.
+ * 3. SHould remove the liked objects.
+ */
+ @Test
+ public void testSetGetRemoveLinkedPorts() {
+ String dpidParty = "00:00:00:00:00:00:00:08";
+ ISwitchObject swParty = ope.newSwitch(dpidParty);
+ Short poShort = 1;
+ IPortObject poParty = ope.newPort(dpidParty, poShort);
+ swParty.addPort(poParty);
+
+ portObj.setLinkPort(poParty);
+
+ ArrayList<IPortObject> iPortList = new ArrayList<IPortObject>();
+ for(IPortObject port : portObj.getLinkedPorts()) {
+ iPortList.add(port);
+ }
+ assertTrue(iPortList.contains(poParty));
+
+ portObj.removeLink(poParty);
+
+ ArrayList<IPortObject> iPortList2 = new ArrayList<IPortObject>();
+ for(IPortObject port : portObj.getLinkedPorts()) {
+ iPortList2.add(port);
+ }
+
+ assertTrue(!iPortList2.contains(poParty));
+ }
+
+ /**
+ * Desc:
+ * Test method for get inbound flowEntry
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the inbound flowEntry.
+ */
+ @Test
+ public void testGetInFlowEntries() {
+
+ portObj.setLinkPort(portObj2);
+
+ IFlowPath flowPathObj = ope.newFlowPath();
+
+ String flowEId = "1";
+ IFlowEntry flowEntryObj = ope.newFlowEntry();
+ flowEntryObj.setFlowEntryId(flowEId);
+ flowEntryObj.setInPort(portObj);
+ flowEntryObj.setOutPort(portObj2);
+ flowEntryObj.setSwitch(swObj);
+ flowEntryObj.setFlow(flowPathObj);
+
+ String flowEId2 = "2";
+ IFlowEntry flowEntryObj2 = ope.newFlowEntry();
+ flowEntryObj2.setFlowEntryId(flowEId2);
+ flowEntryObj2.setInPort(portObjParty1);
+ flowEntryObj2.setOutPort(portObjParty2);
+ flowEntryObj.setSwitch(swObjParty);
+ flowEntryObj2.setFlow(flowPathObj);
+
+ HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+ for(IFlowEntry flowEnt : portObj.getInFlowEntries())
+ {
+ flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+ }
+
+ assertTrue(flowEntryList.containsValue(flowEntryObj));
+
+ }
+
+ /**
+ * Desc:
+ * Test method for get outbound flowEntry
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the outbound flowEntry.
+ */
+ @Test
+ public void testGetOutFlowEntries() {
+
+ portObj.setLinkPort(portObj2);
+
+ IFlowPath flowPathObj = ope.newFlowPath();
+
+ String flowEId = "1";
+ IFlowEntry flowEntryObj = ope.newFlowEntry();
+ flowEntryObj.setFlowEntryId(flowEId);
+ flowEntryObj.setInPort(portObj);
+ flowEntryObj.setOutPort(portObj2);
+ flowEntryObj.setSwitch(swObj);
+ flowEntryObj.setFlow(flowPathObj);
+
+ String flowEId2 = "2";
+ IFlowEntry flowEntryObj2 = ope.newFlowEntry();
+ flowEntryObj2.setFlowEntryId(flowEId2);
+ flowEntryObj2.setInPort(portObjParty1);
+ flowEntryObj2.setOutPort(portObjParty2);
+ flowEntryObj.setSwitch(swObjParty);
+ flowEntryObj2.setFlow(flowPathObj);
+
+ HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+ for(IFlowEntry flowEnt : portObj2.getOutFlowEntries())
+ {
+ flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+ }
+
+ assertTrue(flowEntryList.containsValue(flowEntryObj));
+
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
new file mode 100644
index 0000000..dacfdb5
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
@@ -0,0 +1,286 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsISwitchObjectTest {
+
+ //The test network is ./titan/schema/test-network.xml
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ TestDatabaseManager.deleteTestDatabase();
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ //TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set state method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the status of the switch.
+ * 2. Should get the status of the switch.
+ */
+ @Test
+ public void testSetGetState() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ swObj.setState(state);
+ assertEquals(swObj.getState(), state);
+ }
+
+ /**
+ * Desc:
+ * Test method for get and set Type method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Type of the switch.
+ * 2. Should get the Type of the switch.
+ */
+ @Test
+ public void testSetGetType() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String type = "Switch";
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ swObj.setType("Switch");
+ assertEquals(swObj.getType(), type);
+ }
+
+ /**
+ * Desc:
+ * Test method for getDPID method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get the dpid of the switch.
+ */
+ @Test
+ public void testGetDPID() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ ISwitchObject swObj = ope.newSwitch(dpid);
+
+ assertEquals(swObj.getDPID(), dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for setDPID method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the dpid of the switch.
+ */
+ @Test
+ public void testSetDPID() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String dpid2 = "00:00:00:00:00:00:0a:08";
+ ISwitchObject obj = ope.newSwitch(dpid);
+ assertEquals(obj.getDPID(), dpid);
+
+ obj.setDPID(dpid2);
+ assertEquals(obj.getDPID(), dpid2);
+ }
+
+ /**
+ * Desc:
+ * Test method for getPorts method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get all of ports taken by the switch.
+ */
+ @Test
+ public void testGetPorts() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short portNumber = 1;
+ final int testSwitchPortNumber = 1;
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ IPortObject portObj = ope.newPort(dpid, portNumber);
+
+ swObj.addPort(portObj);
+ int i = 0;
+ for(@SuppressWarnings("unused") IPortObject port : swObj.getPorts()){
+ i++;
+ }
+ assertEquals(testSwitchPortNumber, i);
+ }
+
+ /**
+ * Desc:
+ * Test method for add and getPort method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should add the port.
+ * 1. Should get the port.
+ */
+ @Test
+ public void testGetPort() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short portNumber = 1;
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ IPortObject portObj = ope.newPort(dpid, portNumber);
+
+ swObj.addPort(portObj);
+ IPortObject portObj2 = swObj.getPort(portNumber);
+ assertEquals(portObj, portObj2);
+ }
+
+ /**
+ * Desc:
+ * Test method for add and removePort method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should add a port to the switch.
+ * 1. Should remove a port from the switch.
+ */
+ @Test
+ public void testAddRemovePorts() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short portNum = 1;
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ IPortObject portObj = ope.newPort(dpid, portNum);
+ swObj.addPort(portObj);
+
+ IPortObject portObj2 = swObj.getPort(portNum);
+ assertEquals(portObj2, portObj);
+ swObj.removePort(portObj);
+ assertNull(swObj.getPort(portNum));
+ }
+
+ /**
+ * Desc:
+ * Test method for getDevices method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get all devices attached to the switch.
+ */
+ @Test
+ public void testGetDevices() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short portNum = 1;
+ String devMac = "00:00:00:00:00:11";
+ int numOfDev = 1;
+
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ IPortObject portObj = ope.newPort(dpid, portNum);
+ IDeviceObject devObj = ope.newDevice();
+ devObj.setMACAddress(devMac);
+ swObj.addPort(portObj);
+ portObj.setDevice(devObj);
+
+ int i = 0;
+ for(@SuppressWarnings("unused") IDeviceObject dev : swObj.getDevices()){
+ i++;
+ }
+ assertEquals(i, numOfDev);
+ }
+
+ /**
+ * Desc:
+ * Test method for getFlowEntries method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should get all flowEntries attached to the switch.
+ */
+ @Test
+ public void testGetFlowEntries() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ Short number = 1;
+ Short number2 = 2;
+ Short number3 = 3;
+ ISwitchObject swObj = ope.newSwitch(dpid);
+ IPortObject portObj = ope.newPort(dpid, number);
+ IPortObject portObj2 = ope.newPort(dpid, number2);
+ IPortObject portObj3 = ope.newPort(dpid, number3);
+
+ swObj.addPort(portObj);
+ swObj.addPort(portObj2);
+ swObj.addPort(portObj3);
+
+ IFlowPath flowPathObj = ope.newFlowPath();
+
+ String flowEId = "1";
+ IFlowEntry flowEntryObj = ope.newFlowEntry();
+ flowEntryObj.setFlowEntryId(flowEId);
+ flowEntryObj.setInPort(portObj);
+ flowEntryObj.setOutPort(portObj2);
+ flowEntryObj.setSwitch(swObj);
+ flowEntryObj.setFlow(flowPathObj);
+
+ String flowEId2 = "2";
+ IFlowEntry flowEntryObj2 = ope.newFlowEntry();
+ flowEntryObj2.setFlowEntryId(flowEId2);
+ flowEntryObj2.setInPort(portObj);
+ flowEntryObj2.setOutPort(portObj3);
+ flowEntryObj2.setSwitch(swObj);
+ flowEntryObj2.setFlow(flowPathObj);
+
+ HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+ for(IFlowEntry flowEnt : swObj.getFlowEntries())
+ {
+ flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+ }
+
+ assertTrue(flowEntryList.containsValue(flowEntryObj));
+ assertTrue(flowEntryList.containsValue(flowEntryObj2));
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java
new file mode 100644
index 0000000..4aea22a
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java
@@ -0,0 +1,775 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
+import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+
+import org.easymock.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.util.HexString;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Unit test for {@link LinkStorageImpl}.
+ * @author Naoki Shiota
+ *
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LinkStorageImpl.class, GraphDBConnection.class, GraphDBOperation.class})
+public class LinkStorageImplTest {
+ protected final static Logger log = LoggerFactory.getLogger(LinkStorageImplTest.class);
+
+ private static ILinkStorage linkStorage;
+
+ // Mock GraphDBConnection (do nothing)
+ private static GraphDBConnection conn;
+
+ // Mock GraphDBOperation (mocks port-related methods only)
+ private static GraphDBOperation ope;
+
+ // Uncommitted actions executed in LinkStorageImpl
+ private static ArrayList<LinkEvent> actions;
+
+ // Dictionary of mock IPortObject to information of port
+ // -> Used to refer DPID from IPortObject
+ private static Map<IPortObject,PortInfo> mockToPortInfoMap;
+
+
+ // Links existing in virtual graph
+ private List<Link> links;
+
+ //================ Utility classes for logging actions in LinkStorageImpl ===========
+ private enum LinkEventType {
+ ADD, DELETE
+ }
+
+ private class LinkEvent {
+ private Long src_dpid = null;
+ private Long dst_dpid = null;
+ private Short src_port = null;
+ private Short dst_port = null;
+
+ public LinkEventType type;
+
+ public LinkEvent(Link link, LinkEventType type) {
+ this.src_dpid = link.getSrc();
+ this.src_port = link.getSrcPort();
+ this.dst_dpid = link.getDst();
+ this.dst_port = link.getDstPort();
+
+ this.type = type;
+ }
+
+ public Long getSrcDpid() { return src_dpid; }
+ public Short getSrcPort() { return src_port; }
+ public Long getDstDpid() { return dst_dpid; }
+ public Short getDstPort() { return dst_port; }
+ public LinkEventType getType() { return type; }
+ }
+
+ private class PortInfo {
+ public Long dpid = null;
+ public Short port = null;
+
+ public PortInfo(Long dpid, Short port) { this.dpid = dpid; this.port = port; }
+ }
+
+ /**
+ * Setup code called before each tests.
+ * Read test graph data and replace DB access by test graph data.
+ * @throws Exception
+ */
+ @Before
+ public void setUp() throws Exception{
+ // Create mock GraphDBConnection (replace Singleton object to mock one)
+ PowerMock.mockStatic(GraphDBConnection.class);
+ PowerMock.suppress(PowerMock.constructor(GraphDBConnection.class));
+ conn = PowerMock.createMock(GraphDBConnection.class);
+ EasyMock.expect(GraphDBConnection.getInstance((String)EasyMock.anyObject())).andReturn(conn).anyTimes();
+ PowerMock.replay(GraphDBConnection.class);
+
+ // Create mock GraphDBOperation
+ ope = createMockGraphDBOperation();
+ PowerMock.expectNew(GraphDBOperation.class, new Class<?>[] {GraphDBConnection.class}, EasyMock.anyObject(GraphDBConnection.class)).andReturn(ope).anyTimes();
+ PowerMock.replay(GraphDBOperation.class);
+
+ actions = new ArrayList<LinkEvent>();
+ mockToPortInfoMap = new HashMap<IPortObject,PortInfo>();
+
+ linkStorage = new LinkStorageImpl();
+ linkStorage.init("/dummy/path/to/conf");
+
+ initLinks();
+ }
+
+ /**
+ * Closing code called after each tests.
+ * @throws Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ linkStorage.close();
+ }
+
+
+ /**
+ * Test if {@link LinkStorageImpl#addLink(Link)} can correctly creates a Link.
+ */
+ @Test
+ public void testAddLink() {
+ Link linkToCreate = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.addLink(linkToCreate);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#update(List, DM_OPERATION)} can correctly creates multiple Links.
+ */
+ @Test
+ public void testAddLinks() {
+ List<Link> linksToCreate = createFeasibleLinks();
+ List<Link> linksToVerify = createFeasibleLinks();
+
+ // Test creation of new links
+ linkStorage.addLinks(linksToCreate);
+ for(Link l : linksToVerify) {
+ doTestLinkExist(l);
+ }
+ }
+
+ // TODO: remove @Ignore after UPDATE method is implemented
+ /**
+ * Test if {@link LinkStorageImpl#updateLinkInfo(Link, LinkInfo, DM_OPERATION)} can correctly updates LinkInfo for a Link.
+ */
+ @Ignore @Test
+ public void testUpdate_Update() {
+ Link linkToUpdate= createExistingLink();
+ long currentTime = System.currentTimeMillis();
+ LinkInfo infoToUpdate = createFeasibleLinkInfo(currentTime);
+ LinkInfo infoToVerify = createFeasibleLinkInfo(currentTime);
+
+ linkStorage.update(linkToUpdate, infoToUpdate, ILinkStorage.DM_OPERATION.UPDATE);
+
+ doTestLinkHasStateOf(linkToUpdate, infoToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#update(Link, DM_OPERATION)} can correctly creates a Link.
+ */
+ @Test
+ public void testUpdate_Create() {
+ Link linkToCreate = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.update(linkToCreate, null, ILinkStorage.DM_OPERATION.CREATE);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#update(Link, DM_OPERATION)}can correctly inserts a Link.
+ */
+ @Test
+ public void testUpdate_Insert(){
+ Link linkToInsert = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.update(linkToInsert, null, ILinkStorage.DM_OPERATION.INSERT);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#update(Link, DM_OPERATION)} can correctly deletes a Link.
+ */
+ @Test
+ public void testUpdate_Delete(){
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ // Test deletion of existing link
+ linkStorage.update(linkToDelete, null, DM_OPERATION.DELETE);
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#getLinks(Long, short)} can correctly return Links connected to specific DPID and port.
+ */
+ @Test
+ public void testGetLinks_ByDpidPort(){
+ Link linkToVerify = createExistingLink();
+ Long dpid = linkToVerify.getSrc();
+ short port = (short)linkToVerify.getSrcPort();
+
+ List<Link> list = linkStorage.getLinks(dpid, port);
+
+ assertEquals(1, list.size());
+
+ Link l = list.get(0);
+ assertEquals(l.getSrc(), linkToVerify.getSrc());
+ assertEquals(l.getSrcPort(), linkToVerify.getSrcPort());
+ assertEquals(l.getDst(), linkToVerify.getDst());
+ assertEquals(l.getDstPort(), linkToVerify.getDstPort());
+
+ Link linkToVerifyNot = createFeasibleLink();
+
+ List<Link> list2 = linkStorage.getLinks(linkToVerifyNot.getSrc(), (short)linkToVerifyNot.getSrcPort());
+
+ assertEquals(0, list2.size());
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#getLinks(String)} can correctly return Links connected to specific MAC address.
+ */
+ @Test
+ public void testGetLinks_ByString() {
+ Link linkToVeryfy = createExistingLink();
+ String dpid = HexString.toHexString(linkToVeryfy.getSrc());
+
+ List<Link> links = linkStorage.getLinks(dpid);
+ assertTrue(links.contains(linkToVeryfy));
+
+ Link linkToVerifyNot = createFeasibleLink();
+ assertFalse(links.contains(linkToVerifyNot));
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#getReverseLinks(String)} can correctly return Links connected to specific MAC address.
+ */
+ @Test
+ public void testGetReverseLinks_ByString() {
+ Link linkToVeryfy = createExistingLink();
+ String dpid = HexString.toHexString(linkToVeryfy.getDst());
+
+ List<Link> links = linkStorage.getReverseLinks(dpid);
+ assertTrue(links.contains(linkToVeryfy));
+
+ Link linkToVerifyNot = createFeasibleLink();
+ assertFalse(links.contains(linkToVerifyNot));
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#deleteLink(Link)} can correctly delete a Link.
+ */
+ @Test
+ public void testDeleteLink() {
+ // Deletion of existing link
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ linkStorage.deleteLink(linkToDelete);
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#deleteLinks(List)} can correctly delete Links.
+ */
+ @Test
+ public void testDeleteLinks(){
+ List<Link> linksToDelete = createExistingLinks();
+ List<Link> linksToVerify = createExistingLinks();
+
+ linkStorage.deleteLinks(linksToDelete);
+ for(Link l : linksToVerify) {
+ doTestLinkNotExist(l);
+ }
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#getActiveLinks()} can correctly return active Links.
+ */
+ @Test
+ public void testGetActiveLinks() {
+ Link existingLink = createExistingLink();
+ Link notExistingLink = createFeasibleLink();
+
+ List<Link> links = linkStorage.getActiveLinks();
+
+ assertTrue(links.contains(existingLink));
+ assertFalse(links.contains(notExistingLink));
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#deleteLinksOnPort(Long, short)} can delete Links.
+ */
+ @Test
+ public void testDeleteLinksOnPort() {
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ linkStorage.deleteLinksOnPort(linkToDelete.getSrc(), linkToDelete.getSrcPort());
+
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if {@link LinkStorageImpl#getLinkInfo(Link)} can delete Links.
+ */
+ @Ignore @Test
+ public void testGetLinkInfo() {
+ fail("not yet implemented");
+ }
+
+ /**
+ * Test if specific link exists
+ * @param link
+ */
+ private void doTestLinkExist(Link link) {
+ int count = 0;
+ for(Link lt : links) {
+ if(lt.equals(link)) {
+ ++count;
+ }
+ }
+
+ assertTrue(count == 1);
+ }
+
+ /**
+ * Test if specific link doesn't exist
+ * @param link
+ */
+ private void doTestLinkNotExist(Link link) {
+ assertFalse(links.contains(link));
+ }
+
+ /**
+ * Test if titanGraph has specific Link with specific LinkInfo
+ * @param link
+ */
+ // TODO: Fix me
+ private void doTestLinkHasStateOf(Link link, LinkInfo info) {
+ }
+
+ /**
+ * Class defines a function called back when {@link IPortObject#removeLink(IPortObject)} is called.
+ * @author Naoki Shiota
+ *
+ */
+ private class RemoveLinkCallback implements IAnswer<Object> {
+ private long dpid;
+ private short port;
+ public RemoveLinkCallback(long dpid, short port) {
+ this.dpid = dpid; this.port = port;
+ }
+
+ @Override
+ public Object answer() throws Throwable {
+ IPortObject dstPort = (IPortObject) EasyMock.getCurrentArguments()[0];
+ PortInfo dst = mockToPortInfoMap.get(dstPort);
+
+ Link linkToRemove = new Link(this.dpid,this.port,dst.dpid,dst.port);
+ actions.add(new LinkEvent(linkToRemove,LinkEventType.DELETE));
+
+ return null;
+ }
+ }
+
+ /**
+ * Class defines a function called back when {@link IPortObject#setLinkPort(IPortObject)} is called.
+ * @author Naoki Shiota
+ */
+ private class SetLinkPortCallback implements IAnswer<Object> {
+ private long dpid;
+ private short port;
+ public SetLinkPortCallback(long dpid, short port) {
+ this.dpid = dpid; this.port = port;
+ }
+
+ @Override
+ public Object answer() throws Throwable {
+ IPortObject dstPort = (IPortObject) EasyMock.getCurrentArguments()[0];
+ PortInfo dst = mockToPortInfoMap.get(dstPort);
+
+ Link linkToAdd = new Link(this.dpid,this.port,dst.dpid,dst.port);
+ actions.add(new LinkEvent(linkToAdd,LinkEventType.ADD));
+
+ return null;
+ }
+
+ }
+
+ /**
+ * Class defines a function called back when {@link IPortObject#getSwitch()} is called.
+ * @author Naoki Shiota
+ *
+ */
+ private class GetSwitchCallback implements IAnswer<ISwitchObject> {
+ private long dpid;
+
+ public GetSwitchCallback(long dpid) {
+ this.dpid = dpid;
+ }
+
+ @Override
+ public ISwitchObject answer() throws Throwable {
+ ISwitchObject sw = createMockSwitch(dpid);
+ return sw;
+ }
+ }
+
+ /**
+ * Class defines a function called back when {@link IPortObject#getLinkedPorts()} is called.
+ * @author Naoki Shiota
+ *
+ */
+ private class GetLinkedPortsCallback implements IAnswer< Iterable<IPortObject> > {
+ private long dpid;
+ private short port;
+
+ public GetLinkedPortsCallback(long dpid, short port) {
+ this.dpid = dpid;
+ this.port = port;
+ }
+
+ @Override
+ public Iterable<IPortObject> answer() throws Throwable {
+ List<IPortObject> ports = new ArrayList<IPortObject>();
+
+ for(Link lk : links) {
+ if(lk.getSrc() == dpid && lk.getSrcPort() == port) {
+ ports.add(createMockPort(lk.getDst(), lk.getDstPort()));
+ }
+ }
+
+ return ports;
+ }
+
+ }
+
+ /**
+ * Class defines a function called back when {@link IPortObject#getReverseLinkedPorts()} is called.
+ * @author Naoki Shiota
+ *
+ */
+ private class GetReverseLinkedPortsCallback implements IAnswer< Iterable<IPortObject> > {
+ private long dpid;
+ private short port;
+
+ public GetReverseLinkedPortsCallback(long dpid, short port) {
+ this.dpid = dpid;
+ this.port = port;
+ }
+
+ @Override
+ public Iterable<IPortObject> answer() throws Throwable {
+ List<IPortObject> ports = new ArrayList<IPortObject>();
+
+ for(Link lk : links) {
+ if(lk.getDst() == dpid && lk.getDstPort() == port) {
+ ports.add(createMockPort(lk.getSrc(), lk.getSrcPort()));
+ }
+ }
+
+ return ports;
+ }
+
+ }
+
+ /**
+ * Class defines a function called back when {@link LinkStorageImplTest} is called.
+ * @author Naoki Shiota
+ *
+ */
+ private class GetPortsCallback implements IAnswer< Iterable <IPortObject> > {
+ private long dpid;
+
+ public GetPortsCallback(long dpid) {
+ this.dpid = dpid;
+ }
+
+ @Override
+ public Iterable<IPortObject> answer() throws Throwable {
+ List<IPortObject> ports = new ArrayList<IPortObject>();
+
+ for(Short number : getPorts(dpid)) {
+ ports.add(createMockPort(dpid, number));
+ }
+
+ return ports;
+ }
+ }
+
+ // ------------------------Creation of Mock-----------------------------
+ /**
+ * Create a mock {@link GraphDBOperation} which hooks port-related methods.
+ * @return EasyMock-wrapped GraphDBOperation object.
+ */
+ @SuppressWarnings("serial")
+ private GraphDBOperation createMockGraphDBOperation() {
+ GraphDBOperation mockDBOpe = EasyMock.createNiceMock(GraphDBOperation.class);
+
+ // Mock searchPort() method to create new mock IPortObject.
+ EasyMock.expect(mockDBOpe.searchPort((String)EasyMock.anyObject(), EasyMock.anyShort())).
+ andAnswer(new IAnswer<IPortObject>() {
+ @Override
+ public IPortObject answer() throws Throwable {
+ long dpid = HexString.toLong((String)EasyMock.getCurrentArguments()[0]);
+ short port = (Short) EasyMock.getCurrentArguments()[1];
+ IPortObject ret = createMockPort(dpid,port);
+
+ return ret;
+ }
+ }).anyTimes();
+
+ // Mock searchSwitch() method to create new mock ISwitchObject.
+ EasyMock.expect(mockDBOpe.searchSwitch((String)EasyMock.anyObject())).
+ andAnswer(new IAnswer<ISwitchObject>() {
+ @Override
+ public ISwitchObject answer() throws Throwable {
+ long dpid = HexString.toLong((String)EasyMock.getCurrentArguments()[0]);
+ ISwitchObject ret = createMockSwitch(dpid);
+
+ return ret;
+ }
+ }).anyTimes();
+
+ // Mock getActiveSwitches() method to create list of mock ISwitchObject.
+ EasyMock.expect(mockDBOpe.getActiveSwitches()).andReturn(new ArrayList<ISwitchObject> () {{
+ for(Long dpid : getDpids()) {
+ add(createMockSwitch(dpid));
+ }
+ }}).anyTimes();
+
+ // Mock commit() method to commit change of link information
+ mockDBOpe.commit();
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ for(LinkEvent action : actions) {
+ if(action.getType().equals(LinkEventType.ADD)) {
+ Link linkToAdd = new Link(
+ action.getSrcDpid(),
+ action.getSrcPort(),
+ action.getDstDpid(),
+ action.getDstPort());
+ links.add(linkToAdd);
+ } else if(action.getType().equals(LinkEventType.DELETE)) {
+ Link linkToRemove = new Link(
+ action.getSrcDpid(),
+ action.getSrcPort(),
+ action.getDstDpid(),
+ action.getDstPort());
+ links.remove(linkToRemove);
+ } else {
+ log.error("mock commit(): unexpected action {}", new Object[]{action.getType()});
+ }
+ }
+ actions.clear();
+ return null;
+ }
+ }).atLeastOnce();
+
+ EasyMock.replay(mockDBOpe);
+ return mockDBOpe;
+ }
+
+ /**
+ * Create a mock {@link IPortObject} using given DPID and port number.
+ * {@link IPortObject} can't store DPID, so DPID is stored to mockToPortInfoMap for later use.
+ * Duplication is not checked.
+ * @param dpid DPID of a port
+ * @param number Port Number
+ * @return EasyMock-wrapped IPortObject
+ */
+ private IPortObject createMockPort(long dpid, short number) {
+ IPortObject mockPort = EasyMock.createNiceMock(IPortObject.class);
+
+ EasyMock.expect(mockPort.getNumber()).andReturn(number);
+
+ // Mock removeLink() method
+ mockPort.removeLink((IPortObject) EasyMock.anyObject());
+ EasyMock.expectLastCall().andAnswer(new RemoveLinkCallback(dpid, number)).anyTimes();
+
+ // Mock setLinkPort() method
+ mockPort.setLinkPort((IPortObject) EasyMock.anyObject());
+ EasyMock.expectLastCall().andAnswer(new SetLinkPortCallback(dpid, number)).anyTimes();
+
+ // Mock getLinkPorts() method
+ EasyMock.expect(mockPort.getLinkedPorts()).andAnswer(new GetLinkedPortsCallback(dpid, number)).anyTimes();
+
+ // Mock getReverseLinkPorts() method
+ EasyMock.expect(mockPort.getReverseLinkedPorts()).andAnswer(new GetReverseLinkedPortsCallback(dpid, number)).anyTimes();
+
+ // Mock getSwitch() method
+ EasyMock.expect(mockPort.getSwitch()).andAnswer(new GetSwitchCallback(dpid)).anyTimes();
+
+ mockToPortInfoMap.put(mockPort, new PortInfo(dpid,number));
+ EasyMock.replay(mockPort);
+
+ return mockPort;
+ }
+
+ /**
+ * Create a mock {@link ISwitchObject} using given DPID number.
+ * Duplication is not checked.
+ * @param dpid DPID of a switch
+ * @return EasyMock-wrapped ISwitchObject
+ */
+ private ISwitchObject createMockSwitch(long dpid) {
+ ISwitchObject mockSw = EasyMock.createNiceMock(ISwitchObject.class);
+
+ EasyMock.expect(mockSw.getPorts()).andAnswer(new GetPortsCallback(dpid)).anyTimes();
+ EasyMock.expect(mockSw.getDPID()).andReturn(HexString.toHexString(dpid)).anyTimes();
+ EasyMock.expect(mockSw.getState()).andReturn("ACTIVE").anyTimes();
+
+ EasyMock.replay(mockSw);
+ return mockSw;
+ }
+
+
+ //----------------- Creation of test data -----------------------
+ // Assume a network shown below.
+ //
+ // [dpid1]--+--[port:1]----[port:1]--+--[dpid2]
+ // | |
+ // +--[port:2] [port:2]--+
+ // |
+ // +--[port:3] [port:1]--+--[dpid3]
+ // | |
+ // +--[port:4]----[port:2]--+
+ //
+ // dpid1 : 00:00:00:00:0a:01
+ // dpid2 : 00:00:00:00:0a:02
+ // dpid3 : 00:00:00:00:0a:03
+
+ /**
+ * Initialize links member to represent test topology above.
+ */
+ private void initLinks() {
+ links = new ArrayList<Link>();
+
+ links.add(new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a02"), 1));
+ links.add(new Link(Long.decode("0x0000000000000a01"), 4, Long.decode("0x0000000000000a03"), 2));
+ }
+
+ /**
+ * Returns list of port number attached to the switch specified by given DPID.
+ * @param dpid DPID of the switch
+ * @return List of port number
+ */
+ @SuppressWarnings("serial")
+ private List<Short> getPorts(long dpid) {
+ List<Short> ports;
+
+ if(dpid == Long.decode("0x0000000000000a01")) {
+ ports = new ArrayList<Short>() {{
+ add((short)1);
+ add((short)2);
+ add((short)3);
+ add((short)4);
+ }};
+ } else if(dpid == Long.decode("0x0000000000000a02") || dpid == Long.decode("0x0000000000000a03")) {
+ ports = new ArrayList<Short>() {{
+ add((short)1);
+ add((short)2);
+ }};
+ } else {
+ ports = new ArrayList<Short>();
+ }
+
+ return ports;
+ }
+
+ /**
+ * Returns list of DPIDs in test topology.
+ * @return List of DPIDs
+ */
+ @SuppressWarnings("serial")
+ private List<Long> getDpids() {
+ List<Long> dpids = new ArrayList<Long>() {{
+ add(Long.decode("0x0000000000000a01"));
+ add(Long.decode("0x0000000000000a02"));
+ add(Long.decode("0x0000000000000a03"));
+ }};
+
+ return dpids;
+ }
+
+ /**
+ * Returns new {@link Link} object of an existing link
+ * @return new Link object
+ */
+ private Link createExistingLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a02"), 1);
+ }
+
+ /**
+ * Returns new {@link Link} object of a not-existing but feasible link
+ * @return new Link object
+ */
+ private Link createFeasibleLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 3, Long.decode("0x0000000000000a03"), 1);
+ }
+
+ // make NO sense while test-network data doesn't define physical network (i.e. any link is feasible)
+ @SuppressWarnings("unused")
+ private Link createInfeasibleLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a03"), 3);
+ }
+
+ /**
+ * Returns list of existing {@link Link} objects
+ * @return ArrayList of new Link objects
+ */
+ private List<Link> createExistingLinks() {
+ List<Link> links = new ArrayList<Link>();
+ links.add(new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a02"), 1));
+ links.add(new Link(Long.decode("0x0000000000000a01"), 4, Long.decode("0x0000000000000a03"), 2));
+ return links;
+ }
+
+ /**
+ * Returns list of {@link Link} objects that are all not-existing but feasible
+ * @return ArrayList of new Link objects
+ */
+ private List<Link> createFeasibleLinks() {
+ List<Link> links = new ArrayList<Link>();
+ links.add(new Link(Long.decode("0x0000000000000a01"), 2, Long.decode("0x0000000000000a02"), 2));
+ links.add(new Link(Long.decode("0x0000000000000a01"), 3, Long.decode("0x0000000000000a03"), 1));
+ return links;
+ }
+
+ /**
+ * Returns new {@link LinkInfo} object with convenient values.
+ * @return LinkInfo object
+ */
+ private LinkInfo createFeasibleLinkInfo(long time) {
+ long time_first = time;
+ long time_last_lldp = time + 50;
+ long time_last_bddp = time + 100;
+ int state_src = OFPhysicalPort.OFPortState.OFPPS_STP_FORWARD.getValue();
+ int state_dst = OFPhysicalPort.OFPortState.OFPPS_STP_LISTEN.getValue();
+
+ return new LinkInfo(time_first,
+ time_last_lldp,
+ time_last_bddp,
+ state_src,
+ state_dst);
+ }
+ //---------------------------------------------------------------
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
new file mode 100644
index 0000000..6f4f850
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
@@ -0,0 +1,786 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import static org.easymock.EasyMock.*;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.LoggerFactory;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+
+//Add Powermock preparation
+@Ignore //TODO broken 11/19/13, should fix
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class SwitchStorageImplTest {
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection mockConn = null;
+ private GraphDBOperation mockOpe = null;
+ ISwitchStorage swSt = null;
+
+ @Before
+ public void setUp() throws Exception {
+
+ swSt = new SwitchStorageImpl();
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+
+ PowerMock.mockStatic(GraphDBConnection.class);
+ mockConn = createMock(GraphDBConnection.class);
+ PowerMock.suppress(PowerMock.constructor(GraphDBConnection.class));
+ EasyMock.expect(GraphDBConnection.getInstance((String)EasyMock.anyObject())).andReturn(mockConn);
+ PowerMock.replay(GraphDBConnection.class);
+
+ PowerMock.mockStatic(GraphDBOperation.class);
+ mockOpe = PowerMock.createStrictMock(GraphDBOperation.class);
+ PowerMock.expectNew(GraphDBOperation.class, mockConn).andReturn(mockOpe);
+ PowerMock.replay(GraphDBOperation.class);
+ // Replace the conf to dummy conf
+ // String conf = "/tmp/cassandra.titan";
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ swSt.close();
+ swSt = null;
+
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * Normal
+ * Expect:
+ * Call SwitchStorageImpl.addSwitch func with proper properties.
+ */
+ @Test
+ public void testAddSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * The switch is already existing.
+ * Expect:
+ * Call SwitchStorageImpl.addSwitch func with proper properties.
+ */
+ //@Ignore
+ @Test
+ public void testAddSwitchExisting() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ mockISw.setState(state);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addSwitch(dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * The switch construction is fail and return null
+ * Expect:
+ * Write the status as info log.
+ */
+ @Test
+ public void testAddSwitchAbnormal() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(null);
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * Throw runtimeException.
+ * Expect:
+ * The rollback method is called.
+ */
+ //@Ignore
+ @Test
+ public void testAddSwitchException() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expectLastCall().andThrow(new RuntimeException());
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for updateSwitch method.
+ * Condition:
+ * SwitchState : INACTIVE
+ * DMOPERATION : UPDATE
+ * Expect:
+ * Should call addSwitch function and commit.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateUPDATE() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ SwitchState stateINACTIVE = SwitchState.INACTIVE;
+ DM_OPERATION opUPDATE = DM_OPERATION.UPDATE;
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(stateINACTIVE.toString());
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.updateSwitch(dpid, stateINACTIVE, opUPDATE);
+ }
+
+ /**
+ * Desc:
+ * Test method for updateSwitch method.
+ * Condition:
+ * SwitchState : INACTIVE
+ * DMOPERATION : CREATE
+ * Expect:
+ * Should call addSwitch function and commit.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateCREATE() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ SwitchState stateINACTIVE = SwitchState.INACTIVE;
+ DM_OPERATION opCREATE = DM_OPERATION.CREATE;
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState("ACTIVE");
+ mockISw.setState(stateINACTIVE.toString());
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.updateSwitch(dpid, stateINACTIVE, opCREATE);
+ }
+
+ /**
+ * Desc:
+ * Test method for updateSwitch method.
+ * Condition:
+ * SwitchState : INACTIVE
+ * DMOPERATION : INSERT
+ * Expect:
+ * Should call addSwitch function and commit.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateINSERT() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ SwitchState stateINACTIVE = SwitchState.INACTIVE;
+ DM_OPERATION opINSERT = DM_OPERATION.INSERT;
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState("ACTIVE");
+ mockISw.setState(stateINACTIVE.toString());
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.updateSwitch(dpid, stateINACTIVE, opINSERT);
+ }
+
+ /**
+ * Desc:
+ * Test method for updateSwitch method.
+ * Condition:
+ * SwitchState : ACTIVE
+ * DMOPERATION : DELETE
+ * Expect:
+ * Should call removeSwitch function and commit.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateDELETE() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ SwitchState stateACTIVE = SwitchState.ACTIVE;
+ DM_OPERATION opDELETE = DM_OPERATION.DELETE;
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(stateACTIVE.toString());
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+ mockOpe.removeSwitch(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.updateSwitch(dpid, stateACTIVE, opDELETE);
+ }
+
+ /**
+ * Desc:
+ * Test method for deleteSwitch method.
+ * Condition:
+ * The switch is existing.
+ * Expect:
+ * Should call removeSwitch function and commit.
+ */
+ //@Ignore
+ @Test
+ public void testDeleteSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+ mockOpe.removeSwitch(mockISw);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.deleteSwitch(dpid);
+
+ //Iterator<Vertex> it = titanGraph.getVertices("dpid", dpid).iterator();
+ //assertFalse(it.hasNext());
+ }
+
+ /**
+ * Desc:
+ * Test method for deleteSwitch method.
+ * Condition:
+ * The commit func throw exception.
+ * Expect:
+ * Should call rollback.
+ */
+ @Test
+ public void testDeleteSwitchException() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ String state = "ACTIVE";
+
+ //Mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+ mockOpe.removeSwitch(mockISw);
+ mockOpe.commit();
+ expectLastCall().andThrow(new RuntimeException());
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.deleteSwitch(dpid);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * port is existing.
+ * Expect:
+ * Should call addPort and commit.
+ */
+ //@Ignore
+ @Test
+ public void testAddPort() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String state = "ACTIVE";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ mockIPort.setState(state);
+ mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+ mockIPort.setDesc(name);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ mockISw.addPort(mockIPort);
+ expect(mockISw.getPort(anyShort())).andReturn(null);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(null);
+ expect(mockOpe.newPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * Port status is down.
+ * Expect:
+ * Should call removePort and commit.
+ */
+ //@Ignore
+ @Test
+ public void testAddPortWithPortLinkDown() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String swState = "ACTIVE";
+// String portState = "INACTIVE";
+ String portId = "5";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_LINK_DOWN.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ expect(mockIPort.getPortId()).andReturn(portId);
+// mockIPort.setState(portState);
+// mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+// mockIPort.setDesc(name);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(swState);
+// mockISw.removePort(mockIPort);
+ expect(mockISw.getPort(anyShort())).andReturn(mockIPort);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.removePort(mockIPort);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * The switch is not existing.
+ * Expect:
+ * Nothing happens.
+ */
+ @Test
+ public void testAddPortAbnormalNoSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createStrictMock(IPortObject.class);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createStrictMock(ISwitchObject.class);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addPort(dpid, portToAdd);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * port is not existing.
+ * Expect:
+ * Should call addPort and commit.
+ */
+ //@Ignore
+ @Test
+ public void testAddPortAbnormalNoPort() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String state = "ACTIVE";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ mockIPort.setState(state);
+ mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+ mockIPort.setDesc(name);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ mockISw.addPort(mockIPort);
+ expect(mockISw.getPort(portNumber)).andReturn(null);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(null);
+ expect(mockOpe.newPort(dpid, portNumber)).andReturn(null);
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * commit throw the exception.
+ * Expect:
+ * Should call rollback.
+ */
+ //@Ignore
+ @Test
+ public void testAddPortWithException() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String state = "ACTIVE";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ mockIPort.setState(state);
+ mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+ mockIPort.setDesc(name);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(state);
+ mockISw.addPort(mockIPort);
+ expect(mockISw.getPort(portNumber)).andReturn(null);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(null);
+ expect(mockOpe.newPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.commit();
+ expectLastCall().andThrow(new RuntimeException());
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ }
+
+ /**
+ * Desc:
+ * Test method for deletePort method.
+ * Condition:
+ * port is existing.
+ * Expect:
+ * Should call removePort and commit.
+ */
+ //@Ignore
+ @Test
+ public void testDeletePort() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String portState = "INACTIVE";
+ String swState = "ACTIVE";
+ String portId = "5";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ mockIPort.setState(swState);
+// mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+ mockIPort.setDesc(name);
+ mockIPort.setState(portState);
+ expect(mockIPort.getPortId()).andReturn(portId);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(swState);
+// mockISw.removePort(mockIPort);
+ expect(mockISw.getPort(portNumber)).andReturn(null);
+ mockISw.addPort(mockIPort);
+ expect(mockISw.getPort(portNumber)).andReturn(mockIPort);
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(null);
+ expect(mockOpe.newPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.removePort(mockIPort);
+ mockOpe.commit();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ swSt.deletePort(dpid, portNumber);
+ }
+
+ /**
+ * Desc:
+ * Test method for addPort method.
+ * Condition:
+ * commit throws the exception.
+ * Expect:
+ * Should call rollback.
+ */
+ //@Ignore
+ @Test
+ public void testDeletePortException() {
+ String dpid = "00:00:00:00:00:00:0a:01";
+ short portNumber = 5;
+ String swState = "ACTIVE";
+ String portState = "INACTIVE";
+ String portId = "5";
+ String name = "port 5 at SEA switch";
+
+ OFPhysicalPort portToAdd = new OFPhysicalPort();
+ portToAdd.setName(name);
+ portToAdd.setCurrentFeatures(OFPhysicalPort.OFPortFeatures.OFPPF_100MB_FD.getValue());
+ portToAdd.setPortNumber(portNumber);
+ portToAdd.setState(OFPortState.OFPPS_STP_FORWARD.getValue());
+
+ //Expectation of mock Port
+ IPortObject mockIPort = createMock(IPortObject.class);
+ mockIPort.setState(swState);
+ mockIPort.setPortState(OFPortState.OFPPS_STP_FORWARD.getValue());
+ mockIPort.setDesc(name);
+ mockIPort.setState(portState);
+ expect(mockIPort.getPortId()).andReturn(portId);
+ replay(mockIPort);
+
+ //Expectation of mock Switch
+ ISwitchObject mockISw = createMock(ISwitchObject.class);
+ mockISw.setState(swState);
+ mockISw.addPort(mockIPort);
+ expect(mockISw.getPort(portNumber)).andReturn(null);
+ expect(mockISw.getPort(portNumber)).andReturn(mockIPort).anyTimes();
+// mockISw.removePort(mockIPort);
+
+ expect(mockISw.getDPID()).andReturn(dpid).anyTimes();
+ replay(mockISw);
+
+ //Expectation of mock operation.
+ expect(mockOpe.searchSwitch(dpid)).andReturn(null);
+ expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(null);
+ expect(mockOpe.newPort(dpid, portNumber)).andReturn(mockIPort);
+ mockOpe.commit();
+ expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
+// expect(mockOpe.searchPort(dpid, portNumber)).andReturn(mockIPort);
+// mockOpe.commit(); // Cannot generate exception..need to revisit this test
+ mockOpe.removePort(mockIPort);
+ expectLastCall().andThrow(new RuntimeException());
+ mockOpe.rollback();
+ mockOpe.close();
+ replay(mockOpe);
+
+ swSt.init(conf);
+ swSt.addSwitch(dpid);
+ swSt.addPort(dpid, portToAdd);
+ swSt.deletePort(dpid, portNumber);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTestBB.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTestBB.java
new file mode 100644
index 0000000..7edc1c5
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTestBB.java
@@ -0,0 +1,347 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import net.floodlightcontroller.core.internal.TestDatabaseManager;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapStorage;
+import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage;
+import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.LoggerFactory;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+/*
+ * Jono, 11/4/2013
+ * These tests are being ignored because they don't work because they
+ * rely on test functionality that was written ages ago and hasn't been
+ * updated as the database schema has evolved.
+ * These tests work by getting an in-memory Titan database and testing
+ * the SwitchStorageImpl on top of that. In this regard they're not really
+ * unit tests as they test the entire DB stack (i.e. GraphDBOperation and
+ * GraphDBConnection), not just SwitchStorageImpl.
+ * I've left them here as we may wish to resurrect this kind of
+ * integration testing of the DB layers in the future.
+ */
+@Ignore
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class SwitchStorageImplTestBB {
+
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+ ISwitchStorage swSt = null;
+
+ @Before
+ public void setUp() throws Exception {
+
+ swSt = new SwitchStorageImpl();
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+
+ swSt.init(conf);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+
+ swSt.close();
+ swSt = null;
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * Normal
+ * Expect:
+ * 1. Switch should be generated.
+ * 2. The status of switch should be ACTIVE
+ */
+ //@Ignore
+ @Test
+ public void testAddSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw == null);
+ swSt.addSwitch(dpid);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 != null);
+ assertEquals(sw2.getState(), "ACTIVE");
+ }
+
+ /**
+ * Desc:
+ * Test method for addSwitch method.
+ * Condition:
+ * The existing switch status is INACTIVE.
+ * The switch is already existing.
+ * Expect:
+ * 1. After add the same switch, the status of switch should be ACTIVE
+ */
+ //@Ignore
+ @Test
+ public void testAddSwitchExisting() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+
+ swSt.updateSwitch(dpid, SwitchState.INACTIVE, DM_OPERATION.UPDATE);
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ assertEquals(sw.getState(), SwitchState.INACTIVE.toString());
+ swSt.addSwitch(dpid);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 != null);
+ assertEquals(sw2.getState(), SwitchState.ACTIVE.toString());
+ }
+
+ /**
+ * Desc:
+ * Test method for testUpdate method.
+ * Condition:
+ * The switch is not existing.
+ * The status of added switch is INACTIVE.
+ * DM_OPERATION is CREATE.
+ * Expect:
+ * 1. Switch should be created.
+ * 2. The status of switch should be INACTIVE.
+ */
+ //@Ignore
+ @Test
+ public void testUpdate() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+ SwitchState state = ISwitchStorage.SwitchState.INACTIVE;
+ DM_OPERATION dmope = INetMapStorage.DM_OPERATION.CREATE;
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw == null);
+ swSt.updateSwitch(dpid, state, dmope);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 != null);
+ assertEquals(sw2.getState(), state.toString());
+ }
+
+ /**
+ * Desc:
+ * Test method for testUpdate method.
+ * Condition:
+ * The switch is existing.
+ * The status of added switch is ACTIVE.
+ * DM_OPERATION is DELETE.
+ * Expect:
+ * 1. Switch should be deleted.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateWithDELETE() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ SwitchState state = ISwitchStorage.SwitchState.ACTIVE;
+ DM_OPERATION dmope = INetMapStorage.DM_OPERATION.DELETE;
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ swSt.updateSwitch(dpid, state, dmope);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 == null);
+ }
+
+ /**
+ * Desc:
+ * Test method for delete switch method.
+ * Condition:
+ * The switch is existing.
+ * Expect:
+ * 1. Switch should be deleted.
+ */
+ //@Ignore
+ @Test
+ public void testDeleteSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ swSt.deleteSwitch(dpid);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 == null);
+ }
+
+ /**
+ * Desc:
+ * Test method for delete switch method.
+ * Condition:
+ * The switch is not existing.
+ * Expect:
+ * Nothing happens.
+ */
+ //@Ignore
+ @Test
+ public void testDeleteNonExistingSwitch() {
+ String dpid = "00:00:00:00:00:00:0a:07";
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw == null);
+ swSt.deleteSwitch(dpid);
+ ISwitchObject sw2 = ope.searchSwitch(dpid);
+ assertTrue(sw2 == null);
+ }
+
+ /**
+ * Desc:
+ * Test method for delete port method.
+ * Condition:
+ * The port is existing.
+ * Expect:
+ * Deleted the port.
+ */
+ //@Ignore
+ @Test
+ public void testDeletePort() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ short portNumber = 3;
+
+ IPortObject portObj1 = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj1 != null);
+ swSt.deletePort(dpid, portNumber);
+ IPortObject portObj2 = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj2 == null);
+ }
+
+ /**
+ * Desc:
+ * Test method for delete port method.
+ * Condition:
+ * The port is not existing.
+ * Expect:
+ * Nothing happens.
+ */
+ //@Ignore
+ @Test
+ public void testDeleteNonExistingPort() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ short portNumber = 4;
+
+ IPortObject portObj1 = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj1 == null);
+ swSt.deletePort(dpid, portNumber);
+ IPortObject portObj2 = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj2 == null);
+ }
+
+ /**
+ * Desc:
+ * Test method for add port method.
+ * Condition:
+ * The port is not existing.
+ * Expect:
+ * The port should be added.
+ * The desc of IPortObject is the same as the name of OFPhysicalPort.
+ */
+ //@Ignore
+ @Test
+ public void testAddPort() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ short portNumber = 4;
+ String name = "port 4 at ATL Switch";
+ int state = OFPortState.OFPPS_STP_FORWARD.getValue();
+ OFPhysicalPort port = new OFPhysicalPort();
+ port.setPortNumber(portNumber);
+ port.setName(name);
+ port.setState(state);
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ swSt.addPort(dpid, port);
+ IPortObject portObj = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj != null);
+ assertEquals(portObj.getDesc(), name);
+ }
+
+ /**
+ * Desc:
+ * Test method for add method.
+ * Condition:
+ * The port is existing.
+ * Expect:
+ * Nothing happens.
+ */
+ //@Ignore
+ @Test
+ public void testAddExistingPort() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ short portNumber = 3;
+ String name = "xxx";
+ int state = OFPortState.OFPPS_STP_FORWARD.getValue();
+ OFPhysicalPort port = new OFPhysicalPort();
+ port.setPortNumber(portNumber);
+ port.setName(name);
+ port.setState(state);
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ swSt.addPort(dpid, port);
+ IPortObject portObj = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj != null);
+ }
+
+ /**
+ * Desc:
+ * Test method for add method.
+ * Condition:
+ * The port status is down.
+ * Expect:
+ * Delete the port.
+ */
+ //@Ignore
+ @Test
+ public void testAddDownPort() {
+ String dpid = "00:00:00:00:00:00:0a:06";
+ short portNumber = 3;
+ String name = "port 3 at ATL Switch";
+ int state = OFPortState.OFPPS_LINK_DOWN.getValue();
+ OFPhysicalPort port = new OFPhysicalPort();
+ port.setPortNumber(portNumber);
+ port.setName(name);
+ port.setState(state);
+
+ ISwitchObject sw = ope.searchSwitch(dpid);
+ assertTrue(sw != null);
+ swSt.addPort(dpid, port);
+ IPortObject portObj = ope.searchPort(dpid, portNumber);
+ assertTrue(portObj == null);
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
new file mode 100644
index 0000000..2fe5951
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
@@ -0,0 +1,87 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader;
+
+@SuppressWarnings("deprecation")
+public class TestDatabaseManager {
+ private static final String testDbLocation = "/tmp/onos-testdb";
+
+ //private static final String testDbGraphML = "<?xml version=\"1.0\" ?><graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"> <key id=\"id\" for=\"node\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"type\" for=\"node\" attr.name=\"type\" attr.type=\"string\"></key> <key id=\"dpid\" for=\"node\" attr.name=\"dpid\" attr.type=\"string\"></key> <key id=\"desc\" for=\"node\" attr.name=\"desc\" attr.type=\"string\"></key> <key id=\"number\" for=\"node\" attr.name=\"number\" attr.type=\"int\"></key> <key id=\"dl_addr\" for=\"node\" attr.name=\"dl_addr\" attr.type=\"string\"></key> <key id=\"nw_addr\" for=\"node\" attr.name=\"nw_addr\" attr.type=\"string\"></key> <key id=\"id\" for=\"edge\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"source\" for=\"edge\" attr.name=\"source\" attr.type=\"string\"></key> <key id=\"target\" for=\"edge\" attr.name=\"target\" attr.type=\"string\"></key> <key id=\"label\" for=\"edge\" attr.name=\"label\" attr.type=\"string\"></key> <graph id=\"G\" edgedefault=\"directed\"> <node id=\"1\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:01</data> <data key=\"desc\">OpenFlow Switch at SEA</data> </node> <node id=\"2\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:02</data> <data key=\"desc\">OpenFlow Switch at LAX</data> </node> <node id=\"3\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:03</data> <data key=\"desc\">OpenFlow Switch at CHI</data> </node> <node id=\"4\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:04</data> <data key=\"desc\">OpenFlow Switch at IAH</data> </node> <node id=\"5\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:05</data> <data key=\"desc\">OpenFlow Switch at NYC</data> </node> <node id=\"6\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:06</data> <data key=\"desc\">OpenFlow Switch at ATL</data> </node> <node id=\"100\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at SEA Switch</data> </node> <node id=\"101\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at SEA Switch</data> </node> <node id=\"102\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at SEA Switch</data> </node> <node id=\"103\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at SEA Switch</data> </node> <node id=\"104\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at LAX Switch</data> </node> <node id=\"105\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at LAX Switch</data> </node> <node id=\"106\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at LAX Switch</data> </node> <node id=\"107\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at CHI Switch</data> </node> <node id=\"108\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at CHI Switch</data> </node> <node id=\"109\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at CHI Switch</data> </node> <node id=\"110\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at CHI Switch</data> </node> <node id=\"111\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at IAH Switch</data> </node> <node id=\"112\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at IAH Switch</data> </node> <node id=\"113\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at IAH Switch</data> </node> <node id=\"114\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at NYC Switch</data> </node> <node id=\"115\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at NYC Switch</data> </node> <node id=\"116\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at NYC Switch</data> </node> <node id=\"117\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at ATL Switch</data> </node> <node id=\"118\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at ATL Switch</data> </node> <node id=\"119\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at ATL Switch</data> </node> <node id=\"1000\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:73</data> <data key=\"nw_addr\">192.168.10.101</data> </node> <node id=\"1001\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:62</data> <data key=\"nw_addr\">192.168.20.101</data> </node> <node id=\"1002\"> <data key=\"type\">device</data> <data key=\"dl_addr\">10:40:f3:e6:8d:55</data> <data key=\"nw_addr\">192.168.10.1</data> </node> <node id=\"1003\"> <data key=\"type\">device</data> <data key=\"dl_addr\">a0:b3:cc:9c:c6:88</data> <data key=\"nw_addr\">192.168.20.1</data> </node> <node id=\"1004\"> <data key=\"type\">device</data> <data key=\"dl_addr\">00:04:20:e2:50:a2</data> <data key=\"nw_addr\">192.168.30.1</data> </node> <node id=\"1005\"> <data key=\"type\">device</data> <data key=\"dl_addr\">58:55:ca:c4:1b:a0</data> <data key=\"nw_addr\">192.168.40.1</data> </node> <edge id=\"10000\" source=\"1\" target=\"101\" label=\"on\"></edge> <edge id=\"10001\" source=\"1\" target=\"102\" label=\"on\"></edge> <edge id=\"10002\" source=\"1\" target=\"103\" label=\"on\"></edge> <edge id=\"10003\" source=\"2\" target=\"104\" label=\"on\"></edge> <edge id=\"10004\" source=\"2\" target=\"105\" label=\"on\"></edge> <edge id=\"10005\" source=\"2\" target=\"106\" label=\"on\"></edge> <edge id=\"10006\" source=\"3\" target=\"107\" label=\"on\"></edge> <edge id=\"10007\" source=\"3\" target=\"108\" label=\"on\"></edge> <edge id=\"10008\" source=\"3\" target=\"109\" label=\"on\"></edge> <edge id=\"10009\" source=\"3\" target=\"110\" label=\"on\"></edge> <edge id=\"10010\" source=\"4\" target=\"111\" label=\"on\"></edge> <edge id=\"10011\" source=\"4\" target=\"112\" label=\"on\"></edge> <edge id=\"10012\" source=\"4\" target=\"113\" label=\"on\"></edge> <edge id=\"10013\" source=\"5\" target=\"114\" label=\"on\"></edge> <edge id=\"10014\" source=\"5\" target=\"115\" label=\"on\"></edge> <edge id=\"10015\" source=\"5\" target=\"116\" label=\"on\"></edge> <edge id=\"10016\" source=\"6\" target=\"117\" label=\"on\"></edge> <edge id=\"10017\" source=\"6\" target=\"118\" label=\"on\"></edge> <edge id=\"10018\" source=\"6\" target=\"119\" label=\"on\"></edge> <edge id=\"11000\" source=\"101\" target=\"107\" label=\"link\"></edge> <edge id=\"11003\" source=\"105\" target=\"111\" label=\"link\"></edge> <edge id=\"11004\" source=\"107\" target=\"101\" label=\"link\"></edge> <edge id=\"11005\" source=\"108\" target=\"112\" label=\"link\"></edge> <edge id=\"11006\" source=\"109\" target=\"114\" label=\"link\"></edge> <edge id=\"11007\" source=\"111\" target=\"105\" label=\"link\"></edge> <edge id=\"11008\" source=\"112\" target=\"108\" label=\"link\"></edge> <edge id=\"11009\" source=\"113\" target=\"117\" label=\"link\"></edge> <edge id=\"11010\" source=\"114\" target=\"109\" label=\"link\"></edge> <edge id=\"11011\" source=\"115\" target=\"118\" label=\"link\"></edge> <edge id=\"11012\" source=\"117\" target=\"113\" label=\"link\"></edge> <edge id=\"11013\" source=\"118\" target=\"115\" label=\"link\"></edge> <edge id=\"12000\" source=\"103\" target=\"1000\" label=\"host\"></edge> <edge id=\"12001\" source=\"103\" target=\"1001\" label=\"host\"></edge> <edge id=\"12002\" source=\"110\" target=\"1002\" label=\"host\"></edge> <edge id=\"12003\" source=\"116\" target=\"1003\" label=\"host\"></edge> <edge id=\"12004\" source=\"106\" target=\"1004\" label=\"host\"></edge> <edge id=\"12005\" source=\"119\" target=\"1005\" label=\"host\"></edge> </graph> </graphml>";
+
+ private static final String testDataLocation = "titan/schema/test-network.xml";
+
+ public static TitanGraph getTestDatabase(){
+ //return TitanFactory.open(testDbLocation);
+// return TitanFactory.openInMemoryGraph();
+ return TitanFactory.open(testDbLocation);
+ }
+
+ public static void populateTestData(TitanGraph titanGraph){
+ Set<String> s = titanGraph.getIndexedKeys(Vertex.class);
+ if (!s.contains("dpid")) {
+ titanGraph.createKeyIndex("dpid", Vertex.class);
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+ if (!s.contains("type")) {
+ titanGraph.createKeyIndex("type", Vertex.class);
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+
+ //InputStream graphMLStream = new ByteArrayInputStream(testDbGraphML.getBytes());
+
+ try {
+ InputStream graphMLStream = new FileInputStream(testDataLocation);
+ GraphMLReader.inputGraph(titanGraph, graphMLStream);
+ } catch (FileNotFoundException e) {
+ Assert.fail("Test data file not found: " + testDataLocation);
+ } catch (IOException e) {
+ e.printStackTrace();
+ Assert.fail("IOException thrown");
+ }
+
+ //Change the type of all port numbers to short in the database
+ Iterator<Vertex> it = titanGraph.getVertices("type", "port").iterator();
+
+ while (it.hasNext()){
+ Vertex port = it.next();
+
+ if(port.getProperty("number") instanceof Short)
+ {
+ Short portNum = (Short) port.getProperty("number");
+ port.setProperty("number", portNum.shortValue());
+ }
+ else{
+ Integer portNum = (Integer) port.getProperty("number");
+ port.setProperty("number", portNum.shortValue());
+ }
+
+ }
+
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+
+ public static void deleteTestDatabase(){
+ try {
+ FileUtils.deleteDirectory(new File(testDbLocation));
+ } catch (IOException e) {
+ System.out.println("delete failed");
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
new file mode 100644
index 0000000..d7724ae
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
@@ -0,0 +1,1575 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.easymock.EasyMock;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.frames.Property;
+import com.tinkerpop.frames.annotations.gremlin.GremlinParam;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.IDBConnection;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
+/**
+ * Mock class of GraphDBOperation which provides additional setter to construct a graph for test.
+ * This object simply caches parameters set up by override interfaces and reflect them when commit().
+ * *ForTest() methods are exempt from cache, parameters through those methods are reflected soon.
+ * @author Naoki Shiota
+ *
+ */
+public class TestableGraphDBOperation extends GraphDBOperation {
+ protected final static Logger log = LoggerFactory.getLogger(TestableGraphDBOperation.class);
+
+ protected List<TestSwitchObject> switches;
+ protected List<TestPortObject> ports;
+ protected List<TestDeviceObject> devices;
+ protected List<TestFlowPath> paths;
+ protected List<TestFlowEntry> entries;
+
+ protected List<TestSwitchObject> switchesToAdd;
+ protected List<TestPortObject> portsToAdd;
+ protected List<TestDeviceObject> devicesToAdd;
+ protected List<TestFlowPath> pathsToAdd;
+ protected List<TestFlowEntry> entriesToAdd;
+
+ protected List<TestSwitchObject> switchesToRemove;
+ protected List<TestPortObject> portsToRemove;
+ protected List<TestDeviceObject> devicesToRemove;
+ protected List<TestFlowPath> pathsToRemove;
+ protected List<TestFlowEntry> entriesToRemove;
+
+ // Testable implementations of INetMapTopologyObject interfaces
+
+ public static class TestSwitchObject implements ISwitchObject {
+ private String state,type,dpid;
+ private List<IPortObject> ports;
+ private List<IDeviceObject> devices;
+ private List<IFlowEntry> entries;
+
+ private String stateToUpdate, typeToUpdate, dpidToUpdate;
+ private List<IPortObject> portsToAdd;
+ private List<IPortObject> portsToRemove;
+
+ public TestSwitchObject() {
+ type = "switch";
+
+ ports = new ArrayList<IPortObject>();
+ portsToAdd = new ArrayList<IPortObject>();
+ portsToRemove = new ArrayList<IPortObject>();
+ devices = new ArrayList<IDeviceObject>();
+ entries = new ArrayList<IFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(IPortObject port : portsToRemove) {
+ ports.remove(port);
+ }
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(dpidToUpdate != null) { dpid = dpidToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ portsToAdd.clear();
+ portsToRemove.clear();
+ stateToUpdate = typeToUpdate = dpidToUpdate = null;
+ }
+
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setDpidForTest(String dpid) { this.dpid = dpid; }
+ public void addPortForTest(TestPortObject port) { ports.add(port); }
+ public void addDeviceForTest(TestDeviceObject dev) { devices.add(dev); }
+ public void addEntryForTest(TestFlowEntry entry) { entries.add(entry); }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { this.stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type ; }
+
+ @Override
+ public void setType(String type) { this.typeToUpdate = type; }
+
+ // Not support for test
+ @Override
+ public Vertex asVertex() { return null; }
+
+ @Override
+ public String getDPID() { return dpid; }
+
+ @Override
+ public void setDPID(String dpid) { this.dpidToUpdate = dpid; }
+
+ @Override
+ public Iterable<IPortObject> getPorts() { return ports; }
+
+ @Override
+ public IPortObject getPort(@GremlinParam("port_num") short port_num) {
+ for(IPortObject port : ports) {
+ if(port.getNumber() == port_num) {
+ return port;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void addPort(IPortObject port) { portsToAdd.add(port); }
+
+ @Override
+ public void removePort(IPortObject port) { portsToRemove.add(port); }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() { return devices; }
+
+ @Override
+ public Iterable<IFlowEntry> getFlowEntries() { return entries; }
+ }
+
+ public static class TestPortObject implements IPortObject {
+ private String state,type,desc;
+ private Short number;
+ private Integer port_state;
+ private ISwitchObject sw;
+
+ private List<IPortObject> linkedPorts;
+ private List<IPortObject> reverseLinkedPorts;
+ private List<IDeviceObject> devices;
+ private List<IFlowEntry> inflows,outflows;
+
+ private String stateToUpdate,typeToUpdate,descToUpdate;
+ private Short numberToUpdate;
+ private Integer port_stateToUpdate;
+
+ private List<IPortObject> linkedPortsToAdd;
+ private List<IPortObject> linkedPortsToRemove;
+ private List<IDeviceObject> devicesToAdd;
+ private List<IDeviceObject> devicesToRemove;
+
+
+ public TestPortObject() {
+ type = "port";
+
+ linkedPorts = new ArrayList<IPortObject>();
+ reverseLinkedPorts = new ArrayList<IPortObject>();
+ linkedPortsToAdd = new ArrayList<IPortObject>();
+ linkedPortsToRemove = new ArrayList<IPortObject>();
+ devices = new ArrayList<IDeviceObject>();
+ devicesToAdd = new ArrayList<IDeviceObject>();
+ devicesToRemove = new ArrayList<IDeviceObject>();
+ inflows = new ArrayList<IFlowEntry>();
+ outflows = new ArrayList<IFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : linkedPortsToAdd) { linkedPorts.add(port); }
+ for(IPortObject port : linkedPortsToRemove) { linkedPorts.remove(port); }
+ for(IDeviceObject dev : devicesToAdd) { devices.add(dev); }
+ for(IDeviceObject dev : devicesToRemove) { devices.remove(dev); }
+
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(descToUpdate != null) { desc = descToUpdate; }
+ if(numberToUpdate != null) { number = numberToUpdate; }
+ if(port_stateToUpdate != null) { port_state = port_stateToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ linkedPortsToAdd.clear();
+ linkedPortsToRemove.clear();
+ devicesToAdd.clear();
+ devicesToRemove.clear();
+ stateToUpdate = typeToUpdate = descToUpdate = null;
+ port_stateToUpdate = null;
+ numberToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setDescForTest(String desc) { this.desc = desc; }
+ public void setNumberForTest(Short number) { this.number = number; }
+ public void setPortStateForTest(Integer state) { this.port_state = state; }
+ public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
+ public void addLinkedPortForTest(TestPortObject port) { this.linkedPorts.add(port); }
+ public void addInflowForTest(TestFlowEntry entry) { inflows.add(entry); }
+ public void addOutflowForTest(TestFlowEntry entry) { outflows.add(entry); }
+
+ // Override methods for mock IPortObject
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { this.stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { this.typeToUpdate = type; }
+
+ // not support for test
+ @Override
+ public Vertex asVertex() {
+ return null;
+ }
+
+ @Override
+ public Short getNumber() { return number; }
+
+ @Override
+ public void setNumber(Short n) { this.numberToUpdate = n; }
+
+ @Override
+ public String getDesc() { return desc; }
+
+ @Override
+ public void setDesc(String s) { this.descToUpdate = s; }
+
+ @Override
+ public Integer getPortState() { return port_state; }
+
+ @Override
+ public void setPortState(Integer s) { this.port_stateToUpdate = s; }
+
+ @Override
+ public ISwitchObject getSwitch() { return sw; }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() { return devices; }
+
+ @Override
+ public void setDevice(IDeviceObject device) { devicesToAdd.add(device); }
+
+ @Override
+ public void removeDevice(IDeviceObject device) { devicesToRemove.add(device); }
+
+ @Override
+ public Iterable<IFlowEntry> getInFlowEntries() { return inflows; }
+
+ @Override
+ public Iterable<IFlowEntry> getOutFlowEntries() { return outflows; }
+
+ @Override
+ public Iterable<IPortObject> getLinkedPorts() { return linkedPorts; }
+
+ @Override
+ public Iterable<IPortObject> getReverseLinkedPorts() { return reverseLinkedPorts; }
+
+ @Override
+ public void removeLink(IPortObject dest_port) { linkedPortsToRemove.add(dest_port); }
+
+ @Override
+ public void setLinkPort(IPortObject dest_port) { linkedPortsToAdd.add(dest_port); }
+
+ @Override
+ @JsonIgnore
+ @Property("port_id")
+ public void setPortId(String id) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ @JsonIgnore
+ @Property("port_id")
+ public String getPortId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+ /*
+ * Note by Jono, 11/4/2013
+ * I changed the interface of IDeviceObject but I didn't spend the
+ * time to update this class, because I can't see where this is used.
+ * I think this whole file is a candidate for deletion if it is not
+ * used anywhere - the graphDB objects are tested elsewhere by the
+ * tests in net.onrc.onos.ofcontroller.core.*
+ */
+ public static class TestDeviceObject implements IDeviceObject {
+ private String state,type,mac,ipaddr;
+ private List<IPortObject> ports;
+ private List<ISwitchObject> switches;
+
+ private String stateToUpdate,typeToUpdate,macToUpdate,ipaddrToUpdate;
+ private List<IPortObject> portsToAdd;
+ private List<IPortObject> portsToRemove;
+
+ public TestDeviceObject() {
+ type = "device";
+
+ ports = new ArrayList<IPortObject>();
+ portsToAdd = new ArrayList<IPortObject>();
+ portsToRemove = new ArrayList<IPortObject>();
+ switches = new ArrayList<ISwitchObject>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(IPortObject port : portsToRemove) {
+ ports.remove(port);
+ }
+
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(macToUpdate != null) { mac = macToUpdate; }
+ if(ipaddrToUpdate != null) { ipaddr = ipaddrToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ ports.clear();
+ portsToAdd.clear();
+ portsToRemove.clear();
+
+ stateToUpdate = typeToUpdate = macToUpdate = ipaddrToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setMacForTest(String mac) { this.mac = mac; }
+ public void setIpaddrForTest(String ipaddr) { this.ipaddr = ipaddr; }
+ public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+ public void addPortForTest(IPortObject port) { ports.add(port); }
+
+
+ // Override methods
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getMACAddress() { return mac; }
+
+ @Override
+ public void setMACAddress(String macaddr) { macToUpdate = macaddr; }
+
+ //@Override
+ //public String getIPAddress() { return ipaddr; }
+
+ //@Override
+ //public void setIPAddress(String ipaddr) { ipaddrToUpdate = ipaddr; }
+
+ @Override
+ public Iterable<IPortObject> getAttachedPorts() {
+ return ports; }
+
+ @Override
+ public void setHostPort(IPortObject port) { portsToAdd.add(port); }
+
+ @Override
+ public void removeHostPort(IPortObject port) { portsToRemove.add(port); }
+
+ @Override
+ public Iterable<ISwitchObject> getSwitch() { return switches; }
+
+ @Override
+ public Iterable<IIpv4Address> getIpv4Addresses() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public IIpv4Address getIpv4Address(int ipv4Address) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addIpv4Address(IIpv4Address ipv4Address) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeIpv4Address(IIpv4Address ipv4Address) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ public static class TestFlowPath implements IFlowPath {
+ private String state,type,flowId,installerId,srcSw,dstSw;
+ private String flowPathType;
+ private String flowPathUserState;
+ private Long flowPathFlags;
+ private String dataPathSummary;
+ private Short srcPort,dstPort;
+ private String matchSrcMac,matchDstMac;
+ private Short matchEthernetFrameType;
+ private Short matchVlanId;
+ private Byte matchVlanPriority;
+ private String matchSrcIpaddr,matchDstIpaddr;
+ private Byte matchIpProto, matchIpToS;
+ private Short matchSrcTcpUdpPort, matchDstTcpUdpPort;
+ private String actions;
+
+ private List<IFlowEntry> entries;
+ private List<ISwitchObject> switches;
+
+ private String stateToUpdate,typeToUpdate,flowIdToUpdate,installerIdToUpdate,srcSwToUpdate,dstSwToUpdate;
+ private String flowPathTypeToUpdate;
+ private String flowPathUserStateToUpdate;
+ private Long flowPathFlagsToUpdate;
+ private String dataPathSummaryToUpdate;
+ private Short srcPortToUpdate,dstPortToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate;
+ private Short matchEthernetFrameTypeToUpdate;
+ private Short matchVlanIdToUpdate;
+ private Byte matchVlanPriorityToUpdate;
+ private String matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+ private Byte matchIpProtoToUpdate, matchIpToSToUpdate;
+ private Short matchSrcTcpUdpPortToUpdate, matchDstTcpUdpPortToUpdate;
+ private String actionsToUpdate;
+
+ private List<IFlowEntry> flowsToAdd;
+ private List<IFlowEntry> flowsToRemove;
+
+ public TestFlowPath() {
+ type = "flow";
+
+ entries = new ArrayList<IFlowEntry>();
+ flowsToAdd = new ArrayList<IFlowEntry>();
+ flowsToRemove = new ArrayList<IFlowEntry>();
+
+ switches = new ArrayList<ISwitchObject>();
+
+ clear();
+ }
+
+ public void commit() {
+ for(IFlowEntry flow : flowsToAdd) {
+ entries.add(flow);
+ }
+ for(IFlowEntry flow : flowsToRemove) {
+ entries.remove(flow);
+ }
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(flowIdToUpdate != null) { flowId = flowIdToUpdate; }
+ if(installerIdToUpdate != null) { installerId = installerIdToUpdate; }
+ if(flowPathTypeToUpdate != null) { flowPathType = flowPathTypeToUpdate; }
+ if(flowPathUserStateToUpdate != null) { flowPathUserState = flowPathUserStateToUpdate; }
+ if(flowPathFlagsToUpdate != null) { flowPathFlags = flowPathFlagsToUpdate; }
+ if(srcSwToUpdate != null) { srcSw = srcSwToUpdate; }
+ if(dstSwToUpdate != null) { dstSw = dstSwToUpdate; }
+ if(dataPathSummaryToUpdate != null) { dataPathSummary = dataPathSummaryToUpdate; }
+ if(srcPortToUpdate != null) { srcPort = srcPortToUpdate; }
+ if(dstPortToUpdate != null) { dstPort = dstPortToUpdate; }
+ if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+ if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+ if(matchEthernetFrameTypeToUpdate != null) { matchEthernetFrameType = matchEthernetFrameTypeToUpdate; }
+ if(matchVlanIdToUpdate != null) { matchVlanId = matchVlanIdToUpdate; }
+ if(matchVlanPriorityToUpdate != null) { matchVlanPriority = matchVlanPriorityToUpdate; }
+ if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+ if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+ if(matchIpProtoToUpdate != null) { matchIpProto = matchIpProtoToUpdate; }
+ if(matchIpToSToUpdate != null) { matchIpToS = matchIpToSToUpdate; }
+ if(matchSrcTcpUdpPortToUpdate != null) { matchSrcTcpUdpPort = matchSrcTcpUdpPortToUpdate; }
+ if(matchDstTcpUdpPortToUpdate != null) { matchDstTcpUdpPort = matchDstTcpUdpPortToUpdate; }
+ if(actionsToUpdate != null) { actions = actionsToUpdate; }
+ }
+
+ public void rollback() {
+ clear();
+ }
+
+ public void clear() {
+ flowsToAdd.clear();
+ flowsToRemove.clear();
+
+ stateToUpdate = typeToUpdate = flowIdToUpdate = installerIdToUpdate = null;
+ flowPathTypeToUpdate = null;
+ flowPathUserStateToUpdate = null;
+ flowPathFlagsToUpdate = null;
+ srcSwToUpdate = dstSwToUpdate = dataPathSummaryToUpdate = null;
+ srcPortToUpdate = dstPortToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = null;
+ matchEthernetFrameTypeToUpdate = null;
+ matchVlanIdToUpdate = null;
+ matchVlanPriorityToUpdate = null;
+ matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ matchIpProtoToUpdate = matchIpToSToUpdate = null;
+ matchSrcTcpUdpPortToUpdate = matchDstTcpUdpPortToUpdate = null;
+ actionsToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setFlowIdForTest(String flowId) { this.flowId = flowId; }
+ public void setInstallerIdForTest(String installerId) { this.installerId = installerId; }
+ public void setFlowPathTypeForTest(String flowPathType) { this.flowPathType = flowPathType; }
+ public void setFlowPathUserStateForTest(String flowPathUserState) { this.flowPathUserState = flowPathUserState; }
+ public void setFlowPathFlagsForTest(Long flowPathFlags) { this.flowPathFlags = flowPathFlags; }
+ public void setSrcSwForTest(String srcSw) { this.srcSw = srcSw; }
+ public void setDstSwForTest(String dstSw) { this.dstSw = dstSw; }
+ public void setDataPathSummaryForTest(String dataPathSummary) { this.dataPathSummary = dataPathSummary; }
+ public void setSrcPortForTest(Short srcPort) { this.srcPort = srcPort; }
+ public void setDstPortForTest(Short dstPort) { this.dstPort = dstPort; }
+ public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+ public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+ public void setMatchEthernetFrameTypeForTest(Short matchEthernetFrameType) { this.matchEthernetFrameType = matchEthernetFrameType; }
+ public void setMatchVlanIdForTest(Short matchVlanId) { this.matchVlanId = matchVlanId; }
+ public void setMatchVlanPriorityForTest(Byte matchVlanPriority) { this.matchVlanPriority = matchVlanPriority; }
+ public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+ public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+ public void setMatchIpProtoForTest(Byte matchIpProto) { this.matchIpProto = matchIpProto; }
+ public void setMatchIpToSForTest(Byte matchIpToS) { this.matchIpToS = matchIpToS; }
+ public void setMatchSrcTcpUdpPortForTest(Short matchSrcTcpUdpPort) { this.matchSrcTcpUdpPort = matchSrcTcpUdpPort; }
+ public void setMatchDstTcpUdpPortForTest(Short matchDstTcpUdpPort) { this.matchDstTcpUdpPort = matchDstTcpUdpPort; }
+ public void setActionsForTest(String actions) { this.actions = actions; }
+ public void addFlowEntryForTest(IFlowEntry entry) { entries.add(entry); }
+ public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFlowId() { return flowId; }
+
+ @Override
+ public void setFlowId(String flowId) { flowIdToUpdate = flowId; }
+
+ @Override
+ public String getInstallerId() { return installerId; }
+
+ @Override
+ public void setInstallerId(String installerId) { installerIdToUpdate = installerId; }
+
+ @Override
+ public String getFlowPathType() { return flowPathType; }
+
+ @Override
+ public void setFlowPathType(String flowPathType) { flowPathTypeToUpdate = flowPathType; }
+
+ @Override
+ public String getFlowPathUserState() { return flowPathUserState; }
+
+ @Override
+ public void setFlowPathUserState(String flowPathUserState) { flowPathUserStateToUpdate = flowPathUserState; }
+
+ @Override
+ public Long getFlowPathFlags() { return flowPathFlags; }
+
+ @Override
+ public void setFlowPathFlags(Long flowPathFlags) { flowPathFlagsToUpdate = flowPathFlags; }
+
+ @Override
+ public String getSrcSwitch() { return srcSw; }
+
+ @Override
+ public void setSrcSwitch(String srcSwitch) { srcSwToUpdate = srcSwitch; }
+
+ @Override
+ public Short getSrcPort() { return srcPort; }
+
+ @Override
+ public void setSrcPort(Short srcPort) { srcPortToUpdate = srcPort; }
+
+ @Override
+ public String getDstSwitch() { return dstSw; }
+
+ @Override
+ public void setDstSwitch(String dstSwitch) { dstSwToUpdate = dstSwitch; }
+
+ @Override
+ public Short getDstPort() { return dstPort; }
+
+ @Override
+ public void setDstPort(Short dstPort) { dstPortToUpdate = dstPort; }
+
+ @Override
+ public String getDataPathSummary() { return dataPathSummary; }
+
+ @Override
+ public void setDataPathSummary(String dataPathSummary) { dataPathSummaryToUpdate = dataPathSummary; }
+
+ @Override
+ public Iterable<IFlowEntry> getFlowEntries() { return entries; }
+
+ @Override
+ public void addFlowEntry(IFlowEntry flowEntry) {
+ if(! entries.contains(flowEntry)) {
+ flowsToAdd.add(flowEntry);
+ }
+ }
+
+ @Override
+ public void removeFlowEntry(IFlowEntry flowEntry) {
+ if(entries.contains(flowEntry)) {
+ flowsToAdd.add(flowEntry);
+ }
+ }
+
+ @Override
+ public String getMatchSrcMac() { return matchSrcMac; }
+
+ @Override
+ public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+
+ @Override
+ public String getMatchDstMac() { return matchDstMac; }
+
+ @Override
+ public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+ @Override
+ public Short getMatchEthernetFrameType() { return matchEthernetFrameType; }
+
+ @Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) {
+ matchEthernetFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public Short getMatchVlanId() { return matchVlanId; }
+
+ @Override
+ public void setMatchVlanId(Short matchVlanId) {
+ matchVlanIdToUpdate = matchVlanId; }
+
+ @Override
+ public Byte getMatchVlanPriority() { return matchVlanPriority; }
+
+ @Override
+ public void setMatchVlanPriority(Byte matchVlanPriority) {
+ matchVlanPriorityToUpdate = matchVlanPriority; }
+
+ @Override
+ public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+
+ @Override
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net) {
+ matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+
+ @Override
+ public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+
+ @Override
+ public void setMatchDstIPv4Net(String matchDstIPv4Net) {
+ matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+ @Override
+ public Byte getMatchIpProto() { return matchIpProto; }
+
+ @Override
+ public void setMatchIpProto(Byte matchIpProto) {
+ matchIpProtoToUpdate = matchIpProto; }
+
+ @Override
+ public Byte getMatchIpToS() { return matchIpToS; }
+
+ @Override
+ public void setMatchIpToS(Byte matchIpToS) {
+ matchIpToSToUpdate = matchIpToS; }
+
+ @Override
+ public Short getMatchSrcTcpUdpPort() { return matchSrcTcpUdpPort; }
+
+ @Override
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort) {
+ matchSrcTcpUdpPortToUpdate = matchSrcTcpUdpPort; }
+
+ @Override
+ public Short getMatchDstTcpUdpPort() { return matchDstTcpUdpPort; }
+
+ @Override
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort) {
+ matchDstTcpUdpPortToUpdate = matchDstTcpUdpPort; }
+
+ @Override
+ public String getActions() { return actions; }
+
+ @Override
+ public void setActions(String actions) {
+ actionsToUpdate = actions; }
+
+ @Override
+ public Iterable<ISwitchObject> getSwitches() { return switches; }
+ }
+
+ public static class TestFlowEntry implements IFlowEntry {
+ private String state,type,entryId,dpid,userState,switchState,errorStateType,errorStateCode;
+ private Short matchInPort;
+ private String matchSrcMac,matchDstMac;
+ private Short matchEtherFrameType;
+ private Short matchVlanId;
+ private Byte matchVlanPriority;
+ private String matchSrcIpaddr,matchDstIpaddr;
+ private Byte matchIpProto, matchIpToS;
+ private Short matchSrcTcpUdpPort, matchDstTcpUdpPort;
+ private Short actionOutputPort;
+ private String actions;
+
+ private IFlowPath flowPath;
+ private ISwitchObject sw;
+ private IPortObject inport,outport;
+
+ private String stateToUpdate,typeToUpdate,entryIdToUpdate,dpidToUpdate,
+ userStateToUpdate,switchStateToUpdate,errorStateTypeToUpdate,errorStateCodeToUpdate;
+ private Short matchInPortToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate;
+ private Short matchEtherFrameTypeToUpdate;
+ private Short matchVlanIdToUpdate;
+ private Byte matchVlanPriorityToUpdate;
+ private String matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+ private Byte matchIpProtoToUpdate, matchIpToSToUpdate;
+ private Short matchSrcTcpUdpPortToUpdate, matchDstTcpUdpPortToUpdate;
+ private Short actionOutputPortToUpdate;
+ private String actionsToUpdate;
+
+ private IFlowPath flowPathToUpdate;
+ private ISwitchObject swToUpdate;
+ private IPortObject inportToUpdate,outportToUpdate;
+
+ public TestFlowEntry() {
+ type = "flow_entry";
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(entryIdToUpdate != null) { entryId = entryIdToUpdate; }
+ if(dpidToUpdate != null) { dpid = dpidToUpdate; }
+ if(userStateToUpdate != null) { userState = userStateToUpdate; }
+ if(switchStateToUpdate != null) { switchState = switchStateToUpdate; }
+ if(errorStateTypeToUpdate != null) { errorStateType = errorStateTypeToUpdate; }
+ if(errorStateCodeToUpdate != null) { errorStateCode = errorStateCodeToUpdate; }
+ if(matchInPortToUpdate != null) { matchInPort = matchInPortToUpdate; }
+ if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+ if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+ if(matchEtherFrameTypeToUpdate != null) { matchEtherFrameType = matchEtherFrameTypeToUpdate; }
+ if(matchVlanIdToUpdate != null) { matchVlanId = matchVlanIdToUpdate; }
+ if(matchVlanPriorityToUpdate != null) { matchVlanPriority = matchVlanPriorityToUpdate; }
+ if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+ if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+ if(matchIpProtoToUpdate != null) { matchIpProto = matchIpProtoToUpdate; }
+ if(matchIpToSToUpdate != null) { matchIpToS = matchIpToSToUpdate; }
+ if(matchSrcTcpUdpPortToUpdate != null) { matchSrcTcpUdpPort = matchSrcTcpUdpPortToUpdate; }
+ if(matchDstTcpUdpPortToUpdate != null) { matchDstTcpUdpPort = matchDstTcpUdpPortToUpdate; }
+ if(actionOutputPortToUpdate != null) { actionOutputPort = actionOutputPortToUpdate; }
+ if(actionsToUpdate != null) { actions = actionsToUpdate; }
+
+ if(flowPathToUpdate != null) { flowPath = flowPathToUpdate; }
+ if(swToUpdate != null) { sw = swToUpdate; }
+ if(inportToUpdate != null) { inport = inportToUpdate; }
+ if(outportToUpdate != null) { outport = outportToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ stateToUpdate = typeToUpdate = entryIdToUpdate = dpidToUpdate = null;
+ userStateToUpdate = switchStateToUpdate = errorStateTypeToUpdate = errorStateCodeToUpdate = null;
+ matchInPortToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = null;
+ matchEtherFrameTypeToUpdate = null;
+ matchVlanIdToUpdate = null;
+ matchVlanPriorityToUpdate = null;
+ matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ matchIpProtoToUpdate = matchIpToSToUpdate = null;
+ matchSrcTcpUdpPortToUpdate = matchDstTcpUdpPortToUpdate = null;
+ actionOutputPortToUpdate = null;
+ actionsToUpdate = null;
+ flowPathToUpdate = null;
+ swToUpdate = null;
+ inportToUpdate = outportToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setEntryIdForTest(String entryId) { this.entryId = entryId; }
+ public void setDpidForTest(String dpid) { this.dpid = dpid; }
+ public void setUserStateForTest(String userState) { this.userState = userState; }
+ public void setSwitchStateForTest(String switchState) { this.switchState = switchState; }
+ public void setErrorStateTypeForTest(String errorStateType) { this.errorStateType = errorStateType; }
+ public void setErrorStateCodeForTest(String errorStateCode) { this.errorStateCode = errorStateCode; }
+ public void setMatchInPortForTest(Short matchInPort) { this.matchInPort = matchInPort; }
+ public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+ public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+ public void setMatchEtherFrameTypeForTest(Short matchEtherFrameType) { this.matchEtherFrameType = matchEtherFrameType; }
+ public void setMatchVlanIdForTest(Short matchVlanId) { this.matchVlanId = matchVlanId; }
+ public void setMatchVlanPriorityForTest(Byte matchVlanPriority) { this.matchVlanPriority = matchVlanPriority; }
+ public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+ public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+ public void setMatchIpProtoForTest(Byte matchIpProto) { this.matchIpProto = matchIpProto; }
+ public void setMatchIpToSForTest(Byte matchIpToS) { this.matchIpToS = matchIpToS; }
+ public void setMatchSrcTcpUdpPortForTest(Short matchSrcTcpUdpPort) { this.matchSrcTcpUdpPort = matchSrcTcpUdpPort; }
+ public void setMatchDstTcpUdpPortForTest(Short matchDstTcpUdpPort) { this.matchDstTcpUdpPort = matchDstTcpUdpPort; }
+ public void setActionOutputPortForTest(Short actionOutputPort) { this.actionOutputPort = actionOutputPort; }
+ public void setActionsForTest(String actions) { this.actions = actions; }
+ public void setFlowPathForTest(IFlowPath flowPath) { this.flowPath = flowPath; }
+ public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
+ public void setInportForTest(IPortObject inport) { this.inport = inport; }
+ public void setOutportForTest(IPortObject outport) { this.outport = outport; }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFlowEntryId() { return entryId; }
+
+ @Override
+ public void setFlowEntryId(String flowEntryId) { entryIdToUpdate = flowEntryId; }
+
+ @Override
+ public String getSwitchDpid() { return dpid; }
+
+ @Override
+ public void setSwitchDpid(String switchDpid) { dpidToUpdate = switchDpid; }
+
+ @Override
+ public String getUserState() { return userState; }
+
+ @Override
+ public void setUserState(String userState) { userStateToUpdate = userState; }
+
+ @Override
+ public String getSwitchState() { return switchState; }
+
+ @Override
+ public void setSwitchState(String switchState) { switchStateToUpdate = switchState; }
+
+ @Override
+ public String getErrorStateType() { return errorStateType; }
+
+ @Override
+ public void setErrorStateType(String errorStateType) { errorStateTypeToUpdate = errorStateType; }
+
+ @Override
+ public String getErrorStateCode() { return errorStateCode; }
+
+ @Override
+ public void setErrorStateCode(String errorStateCode) { errorStateCodeToUpdate = errorStateCode; }
+
+ @Override
+ public Short getMatchInPort() { return matchInPort; }
+
+ @Override
+ public void setMatchInPort(Short matchInPort) { matchInPortToUpdate = matchInPort; }
+
+ @Override
+ public String getMatchSrcMac() { return matchSrcMac; }
+
+ @Override
+ public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+
+ @Override
+ public String getMatchDstMac() { return matchDstMac; }
+
+ @Override
+ public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+ @Override
+ public Short getMatchEthernetFrameType() {return matchEtherFrameType; }
+
+ @Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) { matchEtherFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public Short getMatchVlanId() {return matchVlanId; }
+
+ @Override
+ public void setMatchVlanId(Short matchVlanId) { matchVlanIdToUpdate = matchVlanId; }
+
+ @Override
+ public Byte getMatchVlanPriority() {return matchVlanPriority; }
+
+ @Override
+ public void setMatchVlanPriority(Byte matchVlanPriority) { matchVlanPriorityToUpdate = matchVlanPriority; }
+
+ @Override
+ public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+
+ @Override
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net) { matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+
+ @Override
+ public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+
+ @Override
+ public void setMatchDstIPv4Net(String matchDstIPv4Net) { matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+ @Override
+ public Byte getMatchIpProto() {return matchIpProto; }
+
+ @Override
+ public void setMatchIpProto(Byte matchIpProto) { matchIpProtoToUpdate = matchIpProto; }
+
+ @Override
+ public Byte getMatchIpToS() {return matchIpToS; }
+
+ @Override
+ public void setMatchIpToS(Byte matchIpToS) { matchIpToSToUpdate = matchIpToS; }
+
+ @Override
+ public Short getMatchSrcTcpUdpPort() {return matchSrcTcpUdpPort; }
+
+ @Override
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort) { matchSrcTcpUdpPortToUpdate = matchSrcTcpUdpPort; }
+
+ @Override
+ public Short getMatchDstTcpUdpPort() {return matchDstTcpUdpPort; }
+
+ @Override
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort) { matchDstTcpUdpPortToUpdate = matchDstTcpUdpPort; }
+
+ @Override
+ public Short getActionOutputPort() { return actionOutputPort; }
+
+ @Override
+ public void setActionOutputPort(Short actionOutputPort) { actionOutputPortToUpdate = actionOutputPort; }
+
+ @Override
+ public String getActions() { return actions; }
+
+ @Override
+ public void setActions(String actions) { actionsToUpdate = actions; }
+
+ @Override
+ public IFlowPath getFlow() { return flowPath; }
+
+ @Override
+ public void setFlow(IFlowPath flow) { flowPathToUpdate = flow; }
+
+ @Override
+ public ISwitchObject getSwitch() { return sw; }
+
+ @Override
+ public void setSwitch(ISwitchObject sw) { swToUpdate = sw; }
+
+ @Override
+ public IPortObject getInPort() { return inport; }
+
+ @Override
+ public void setInPort(IPortObject port) { inportToUpdate = port; }
+
+ @Override
+ public IPortObject getOutPort() { return outport; }
+
+ @Override
+ public void setOutPort(IPortObject port) { outportToUpdate = port; }
+ }
+
+
+ public TestableGraphDBOperation() {
+ super(EasyMock.createNiceMock(GraphDBConnection.class));
+
+ switches = new ArrayList<TestSwitchObject>();
+ ports = new ArrayList<TestPortObject>();
+ devices = new ArrayList<TestDeviceObject>();
+ paths = new ArrayList<TestFlowPath>();
+ entries = new ArrayList<TestFlowEntry>();
+
+ switchesToAdd = new ArrayList<TestSwitchObject>();
+ portsToAdd = new ArrayList<TestPortObject>();
+ devicesToAdd = new ArrayList<TestDeviceObject>();
+ pathsToAdd = new ArrayList<TestFlowPath>();
+ entriesToAdd = new ArrayList<TestFlowEntry>();
+
+ switchesToRemove = new ArrayList<TestSwitchObject>();
+ portsToRemove = new ArrayList<TestPortObject>();
+ devicesToRemove = new ArrayList<TestDeviceObject>();
+ pathsToRemove = new ArrayList<TestFlowPath>();
+ entriesToRemove = new ArrayList<TestFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ private void clearUncommitedData() {
+ for(TestFlowEntry flow : entries) {
+ flow.clearUncommitedData();
+ }
+ for(TestFlowEntry flow : entriesToAdd) {
+ flow.clearUncommitedData();
+ }
+
+ for(TestDeviceObject dev : devices) {
+ dev.clearUncommitedData();
+ }
+ for(TestDeviceObject dev : devicesToAdd) {
+ dev.clearUncommitedData();
+ }
+
+ for(TestSwitchObject sw : switches) {
+ sw.clearUncommitedData();
+ }
+ for(TestSwitchObject sw : switchesToAdd) {
+ sw.clearUncommitedData();
+ }
+
+ for(TestPortObject port : ports) {
+ port.clearUncommitedData();
+ }
+ for(TestPortObject port : portsToAdd) {
+ port.clearUncommitedData();
+ }
+
+ entriesToAdd.clear();
+ entriesToRemove.clear();
+ devicesToAdd.clear();
+ devicesToRemove.clear();
+ switchesToAdd.clear();
+ switchesToRemove.clear();
+ portsToAdd.clear();
+ portsToRemove.clear();
+ }
+
+
+ // this.*ForTest() methods below are supposed to be used for creation of test topology.
+ /**
+ * Create new empty TestSwitchObject.
+ * @return New TestSwitchObject
+ */
+ public TestSwitchObject createNewSwitchForTest() {
+ TestSwitchObject sw = new TestSwitchObject();
+ switches.add(sw);
+ return sw;
+ }
+
+ /**
+ * Create new TestSwitchObject with specific DPID.
+ * @param dpid DPID to be set
+ * @return New TestSwitchObject
+ */
+ public TestSwitchObject createNewSwitchForTest(String dpid) {
+ for(TestSwitchObject sw_loop : switches) {
+ if(sw_loop.getDPID().equals(dpid)) {
+ // Already created
+ log.error("switch already exists : " + dpid);
+ return sw_loop;
+ }
+ }
+
+ TestSwitchObject sw = new TestSwitchObject();
+
+ sw.setDpidForTest(dpid);
+ switches.add(sw);
+
+ return sw;
+ }
+
+ /**
+ * Create new empty TestPortObject.
+ * @return New TestPortObject
+ */
+ public TestPortObject createNewPortForTest() {
+ TestPortObject port = new TestPortObject();
+ ports.add(port);
+ return port;
+ }
+
+ /**
+ * Create new TestPortObject with specific DPID and port number.
+ * @param dpid DPID to be set
+ * @param number Port number to be set
+ * @return New TestPortObject
+ */
+ public TestPortObject createNewPortForTest(String dpid, Short number) {
+ TestSwitchObject sw = null;
+
+ for(TestSwitchObject sw_loop : switches) {
+ if(sw_loop.getDPID().equals(dpid)) {
+ sw = sw_loop;
+ }
+ }
+
+ if(sw != null) {
+ TestPortObject port = new TestPortObject();
+ port.setNumberForTest(number);
+ port.setSwitchForTest(sw);
+ sw.addPortForTest(port);
+
+ ports.add(port);
+
+ return port;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Link a TestPortObject to other TestPortObject.
+ * @param src TestPortObjecgt of source port.
+ * @param dst TestPortObjecgt of destination port.
+ */
+ public void setLinkBetweenPortsForTest(TestPortObject src, TestPortObject dst) {
+ src.addLinkedPortForTest(dst);
+ }
+
+ /**
+ * Create new empty TestDeviceObject.
+ * @return New TestDeviceObject
+ */
+ public TestDeviceObject createNewDeviceForTest() {
+ TestDeviceObject dev = new TestDeviceObject();
+
+ return dev;
+ }
+
+ /**
+ * Create new empty TestFlowPathObject.
+ * @return New TestFlowPathObject
+ */
+ public TestFlowPath createNewFlowPathForTest() {
+ TestFlowPath path = new TestFlowPath();
+ paths.add(path);
+ return path;
+ }
+
+ /**
+ * Create new empty TestFlowEntryObject.
+ * @return New TestFlowEntryObject
+ */
+ public TestFlowEntry createNewFlowEntryForTest() {
+ TestFlowEntry entry = new TestFlowEntry();
+ entries.add(entry);
+ return entry;
+ }
+
+
+ public boolean hasLinkBetween(String srcSw_str, Short srcNumber, String dstSw_str, Short dstNumber) {
+ IPortObject srcPort = null, dstPort = null;
+ long srcSw = HexString.toLong(srcSw_str);
+ long dstSw = HexString.toLong(dstSw_str);
+
+ for(TestSwitchObject sw : switches) {
+ long swLong = HexString.toLong(sw.getDPID());
+ if(swLong == srcSw) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(srcNumber)) {
+ srcPort = port;
+ }
+ }
+ } else if(swLong == dstSw) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(dstNumber)) {
+ dstPort = port;
+ }
+ }
+ }
+ }
+
+ if(srcPort != null && dstPort != null) {
+ for(IPortObject port : srcPort.getLinkedPorts()) {
+ if(port.equals(dstPort)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ // Overriding methods below are to mock GraphDBOperation class.
+ @Override
+ public ISwitchObject newSwitch(String dpid) {
+ TestSwitchObject sw = new TestSwitchObject();
+ sw.setDPID(dpid);
+ switchesToAdd.add(sw);
+
+ return sw;
+ }
+
+ @Override
+ public ISwitchObject searchSwitch(String dpid_str) {
+ Long dpid = HexString.toLong(dpid_str);
+
+ for(ISwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid) {
+ return sw;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ISwitchObject searchActiveSwitch(String dpid_str) {
+ Long dpid = HexString.toLong(dpid_str);
+
+ for(ISwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid && sw.getState().equals("ACTIVE")) {
+ return sw;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getActiveSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ if(sw.getState() != null && sw.getState().equals("ACTIVE")) {
+ list.add(sw);
+ }
+ }
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getAllSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ list.add(sw);
+ }
+
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getInactiveSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ if(! sw.getState().equals("ACTIVE")) {
+ list.add(sw);
+ }
+ }
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
+ List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+
+ for(TestFlowEntry entry : entries) {
+ if(entry.getSwitchState().equals("FE_SWITCH_NOT_UPDATED")) {
+ list.add(entry);
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public void removeSwitch(ISwitchObject sw) {
+ if(switches.contains(sw)) {
+ switchesToRemove.add((TestSwitchObject)sw);
+ }
+ }
+
+ @Override
+ public IPortObject newPort(Short portNumber) {
+ TestPortObject port = new TestPortObject();
+ port.setNumber(portNumber);
+
+ return port;
+ }
+
+ public IPortObject newPort(Long dpid, Short portNumber) {
+ TestPortObject port = null;
+ TestSwitchObject sw = (TestSwitchObject)searchSwitch(HexString.toHexString(dpid));
+
+ if(sw != null) {
+ port = (TestPortObject)newPort(portNumber);
+ portsToAdd.add(port);
+ sw.addPort(port);
+ }
+
+ return port;
+ }
+
+ @Override
+ public IPortObject searchPort(String dpid_str, Short number) {
+ long dpid = HexString.toLong(dpid_str);
+
+ for(TestSwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(number)) {
+ return port;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void removePort(IPortObject port) {
+ for(TestSwitchObject sw : switches) {
+ for(IPortObject pt : sw.getPorts()) {
+ if(pt.equals(port)) {
+ sw.removePort(port);
+ }
+ }
+ }
+ portsToRemove.add((TestPortObject)port);
+ }
+
+ @Override
+ public IDeviceObject newDevice() {
+ TestDeviceObject dev = new TestDeviceObject();
+ devicesToAdd.add(dev);
+
+ return dev;
+ }
+
+ @Override
+ public IDeviceObject searchDevice(String macAddr) {
+ for(IDeviceObject dev : devices) {
+ if(dev.getMACAddress().equals(macAddr)) {
+ return dev;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() {
+ List<IDeviceObject> list = new ArrayList<IDeviceObject>();
+
+ for(TestDeviceObject dev : devices) {
+ list.add(dev);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeDevice(IDeviceObject dev) {
+ if(devices.contains((TestDeviceObject)dev)) {
+ devicesToRemove.add((TestDeviceObject)dev);
+ }
+ }
+
+ @Override
+ public IFlowPath newFlowPath() {
+ TestFlowPath path = new TestFlowPath();
+ pathsToAdd.add(path);
+
+ return path;
+ }
+
+ @Override
+ public IFlowPath searchFlowPath(FlowId flowId) {
+ for(IFlowPath path : paths) {
+ if(path.getFlowId().equals(flowId)) {
+ return path;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) {
+ for(IFlowPath path : paths) {
+ for(IFlowEntry entry : path.getFlowEntries()) {
+ if(entry.equals(flowEntry)) {
+ return path;
+ }
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IFlowPath> getAllFlowPaths() {
+ List<IFlowPath> list = new ArrayList<IFlowPath>();
+
+ for(IFlowPath path : paths) {
+ list.add(path);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeFlowPath(IFlowPath flowPath) {
+ if(paths.contains((TestFlowPath)flowPath)) {
+ pathsToRemove.add((TestFlowPath)flowPath);
+ }
+ }
+
+ @Override
+ public IFlowEntry newFlowEntry() {
+ TestFlowEntry entry = new TestFlowEntry();
+ entriesToAdd.add(entry);
+ return entry;
+ }
+
+ @Override
+ public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
+ for(TestFlowEntry entry : entries) {
+ // TODO check if this matching works
+ if(entry.getFlowEntryId().equals(flowEntryId)) {
+ return entry;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IFlowEntry> getAllFlowEntries() {
+ List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+
+ for(TestFlowEntry entry : entries) {
+ list.add(entry);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeFlowEntry(IFlowEntry flowEntry) {
+ if(entries.contains((TestFlowEntry)flowEntry)) {
+ entriesToRemove.add((TestFlowEntry)flowEntry);
+ }
+ }
+
+ @Override
+ public IDBConnection getDBConnection() {
+ return super.getDBConnection();
+ }
+
+ @Override
+ public void commit() {
+ for(TestSwitchObject sw : switchesToAdd) {
+ switches.add(sw);
+ }
+ for(TestSwitchObject sw : switchesToRemove) {
+ sw.commit();
+ switches.remove(sw);
+ }
+ for(TestSwitchObject sw : switches) {
+ sw.commit();
+ }
+
+ for(TestPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(TestPortObject port : portsToRemove) {
+ port.commit();
+ ports.remove(port);
+ }
+ for(TestPortObject port : ports) {
+ port.commit();
+ }
+
+ for(TestDeviceObject dev : devicesToAdd) {
+ devices.add(dev);
+ }
+ for(TestDeviceObject dev : devicesToRemove) {
+ dev.commit();
+ devices.remove(dev);
+ }
+ for(TestDeviceObject dev : devices) {
+ dev.commit();
+ }
+
+ clearUncommitedData();
+ }
+
+ @Override
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestableLinkStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
similarity index 84%
rename from src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestableLinkStorageImpl.java
rename to src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
index 223b8a1..ecba546 100644
--- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestableLinkStorageImpl.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
@@ -1,7 +1,9 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import java.util.Set;
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl;
+
import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
import com.tinkerpop.blueprints.Vertex;
@@ -16,7 +18,9 @@
*
*/
+@SuppressWarnings("deprecation")
public class TestableLinkStorageImpl extends LinkStorageImpl {
+ protected TitanGraph graph;
public TestableLinkStorageImpl(TitanGraph graph){
this.graph = graph;
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
new file mode 100644
index 0000000..e0b34e1
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
@@ -0,0 +1,26 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+
+/**
+ * Seam that allows me to set up a testable instance of SwitchStorageImpl that
+ * writes to a file database rather than a Cassandra cluster.
+ * It seems the init() API on SwitchStorageImpl might change so I won't rely
+ * on it yet.
+ *
+ * @author jono
+ *
+ */
+
+public class TestableSwitchStorageImpl extends SwitchStorageImpl {
+
+ public TestableSwitchStorageImpl(){
+ }
+
+ @Override
+ public void init(String conf){
+
+ super.init(conf);
+
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java
new file mode 100644
index 0000000..44573bc
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java
@@ -0,0 +1,519 @@
+package net.onrc.onos.ofcontroller.devicemanager.internal;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.SwitchPort;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.util.HexString;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
+import com.thinkaurelius.titan.core.TitanFactory;
+
+//Add Powermock preparation
+@Ignore //TODO broken 11/19/13, should fix
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, DeviceStorageImpl.class})
+public class DeviceStorageImplTest{
+
+ protected final static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ DeviceStorageImpl deviceImpl;
+ private GraphDBConnection mockConn;
+ private GraphDBOperation mockOpe;
+
+ @Before
+ public void setUp() throws Exception {
+ deviceImpl = new DeviceStorageImpl();
+ conf = "/dummy/path/to/db";
+
+ PowerMock.mockStatic(GraphDBConnection.class);
+ mockConn = createMock(GraphDBConnection.class);
+ PowerMock.suppress(PowerMock.constructor(GraphDBConnection.class));
+ EasyMock.expect(GraphDBConnection.getInstance((String)EasyMock.anyObject())).andReturn(mockConn);
+ PowerMock.replay(GraphDBConnection.class);
+
+ //PowerMock.mockStatic(GraphDBOperation.class);
+ mockOpe = PowerMock.createMock(GraphDBOperation.class);
+ PowerMock.expectNew(GraphDBOperation.class, new Class<?>[]{String.class}, conf).andReturn(mockOpe);
+ //mockOpe.close();
+ PowerMock.replay(GraphDBOperation.class);
+ // Replace the conf to dummy conf
+ // String conf = "/tmp/cassandra.titan";
+
+ deviceImpl.init(conf);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ verify(mockOpe);
+ }
+
+ private IPortObject getMockPort(long dpid, short port) {
+ IPortObject mockPortObject = createMock(IPortObject.class);
+ expect(mockPortObject.getNumber()).andReturn(port).anyTimes();
+ expect(mockPortObject.getDesc()).andReturn("test port").anyTimes();
+ return mockPortObject;
+ }
+
+ private IDevice getMockDevice(String strMacAddress, long attachmentDpid,
+ short attachmentPort, int ipv4Address) {
+ IDevice mockIDevice = createMock(IDevice.class);
+
+
+ long longMacAddress = HexString.toLong(strMacAddress);
+
+ SwitchPort[] attachmentSwitchPorts = {new SwitchPort(attachmentDpid, attachmentPort)};
+
+ expect(mockIDevice.getMACAddress()).andReturn(longMacAddress).anyTimes();
+ expect(mockIDevice.getMACAddressString()).andReturn(strMacAddress).anyTimes();
+ expect(mockIDevice.getAttachmentPoints()).andReturn(attachmentSwitchPorts).anyTimes();
+ expect(mockIDevice.getIPv4Addresses()).andReturn(new Integer[] {ipv4Address}).anyTimes();
+
+ replay(mockIDevice);
+
+ return mockIDevice;
+ }
+
+ /**
+ * Description:
+ * Test method for addDevice method.
+ * Condition:
+ * The device does not already exist in the database
+ * Expect:
+ * Get proper IDeviceObject
+ */
+ @Test
+ public void testAddNewDevice() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+ IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(null);
+ expect(mockOpe.newDevice()).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.<IPortObject>emptyList());
+ expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+ mockPortObject.setDevice(mockDeviceObject);
+ expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+ expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+ mockDeviceObject.addIpv4Address(mockIpv4Address);
+ expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+ expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+
+ mockDeviceObject.setMACAddress(strMacAddress);
+ mockDeviceObject.setType("device");
+ mockDeviceObject.setState("ACTIVE");
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockPortObject);
+ replay(mockIpv4Address);
+ replay(mockOpe);
+
+ IDeviceObject addedObject = deviceImpl.addDevice(device);
+ assertNotNull(addedObject);
+
+ verify(mockDeviceObject);
+ }
+
+ /**
+ * Description:
+ * Test method for addDevice method.
+ * Condition:
+ * The device already exists in the database.
+ * Expect:
+ * Get proper IDeviceObject still.
+ * Check the IDeviceObject properties set expectedly.
+ */
+ @Test
+ public void testAddExistingDevice() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+ IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singleton(mockPortObject));
+ expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+ expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+ expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+ expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+
+ mockDeviceObject.setMACAddress(strMacAddress);
+ mockDeviceObject.setType("device");
+ mockDeviceObject.setState("ACTIVE");
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockPortObject);
+ replay(mockIpv4Address);
+ replay(mockOpe);
+
+ IDeviceObject addedObject = deviceImpl.addDevice(device);
+ assertNotNull(addedObject);
+
+ verify(mockDeviceObject);
+ }
+
+ /**
+ * Description:
+ * Test method for updateDevice method.
+ * NB. this is the same test as testAddExistingDevice
+ * Condition:
+ * The MAC address and attachment point are the same.
+ * All of the other parameter are different.
+ * Expect:
+ * Changed parameters are set expectedly.
+ */
+ @Test
+ public void testAddUpdateDevice() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+ IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singleton(mockPortObject));
+ expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+ expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+ expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+ expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+
+ mockDeviceObject.setMACAddress(strMacAddress);
+ mockDeviceObject.setType("device");
+ mockDeviceObject.setState("ACTIVE");
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockPortObject);
+ replay(mockIpv4Address);
+ replay(mockOpe);
+
+ IDeviceObject addedObject = deviceImpl.updateDevice(device);
+ assertNotNull(addedObject);
+
+ verify(mockDeviceObject);
+ }
+
+ /**
+ * Description:
+ * Test method for testRemoveDevice method.
+ * Condition:
+ * 1. Unregistered IDeviceObject argument is put.
+ * Expect:
+ * 1. Nothing happen when unregistered IDeviceObject is put
+ * 2. IDeviceObject will be removed.
+ */
+ @Test
+ public void testRemoveDevice() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IIpv4Address ipv4AddressObject = createMock(IIpv4Address.class);
+ IDeviceObject deviceObject = createMock(IDeviceObject.class);
+ expect(deviceObject.getIpv4Addresses()).andReturn(Collections.singleton(ipv4AddressObject));
+ expect(deviceObject.getMACAddress()).andReturn(strMacAddress);
+ replay(deviceObject);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(deviceObject);
+ mockOpe.removeIpv4Address(ipv4AddressObject);
+ mockOpe.removeDevice(deviceObject);
+ mockOpe.commit();
+ replay(mockOpe);
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ deviceImpl.removeDevice(device);
+
+ verify(mockOpe);
+ }
+
+ /**
+ * Description:
+ * Test method for getDeviceByMac
+ * Condition:
+ * 1. Unregistered MAC address argument is set
+ * Expect:
+ * 1.Nothing happen when you put unregistered MAC address
+ * 2.Get the proper IDeviceObject.
+ * 3.Check the IDeviceObject properties set expectedly.
+ */
+ @Test
+ public void testGetDeviceByMac() {
+ String mac = "99:99:99:99:99:99";
+
+ IDeviceObject mockDevice = createMock(IDeviceObject.class);
+
+ expect(mockOpe.searchDevice(mac)).andReturn(mockDevice);
+
+ replay(mockOpe);
+
+ IDeviceObject result = deviceImpl.getDeviceByMac(mac);
+ assertNotNull(result);
+
+ verify(mockOpe);
+ }
+
+ /**
+ * Description:
+ * Test method for getDeviceByIP method.
+ * Condition:
+ * 1. Unregistered IP address argument is set
+ * Expect:
+ * 1. Nothing happen when you put unregistered IP address
+ * 2. Get the proper IDeviceObject.
+ * 3. Check the IDeviceObject properties set expectedly.
+ */
+ @Test
+ public void testGetDeviceByIP() {
+ int nonExistingIp = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.10.50"));
+ int existingIp = InetAddresses.coerceToInteger(InetAddresses.forString("10.5.12.128"));
+
+ IDeviceObject mockDevice = createMock(IDeviceObject.class);
+ IIpv4Address mockExistingIp = createMock(IIpv4Address.class);
+ expect(mockExistingIp.getDevice()).andReturn(mockDevice);
+
+ expect(mockOpe.searchIpv4Address(nonExistingIp)).andReturn(null);
+ expect(mockOpe.searchIpv4Address(existingIp)).andReturn(mockExistingIp);
+
+ replay(mockExistingIp);
+ replay(mockOpe);
+
+ IDeviceObject result = deviceImpl.getDeviceByIP(nonExistingIp);
+ assertNull(result);
+
+ result = deviceImpl.getDeviceByIP(existingIp);
+ assertNotNull(result);
+
+ verify(mockOpe);
+ }
+
+ /**
+ * Description:
+ * Test method for testChangeDeviceAttachmentsIDevice
+ * Condition:
+ * 1. The device is not currently attached to any point.
+ * Expect:
+ * 1. Nothing happen when you put nonexistent attachment point.
+ * 2. Set the attachment point expectedly;
+ */
+ @Test
+ public void testChangeDeviceAttachementsWhenUnattached() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.<IPortObject>emptyList());
+ expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+ mockPortObject.setDevice(mockDeviceObject);
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockPortObject);
+ replay(mockOpe);
+
+ deviceImpl.changeDeviceAttachments(device);
+
+ verify(mockDeviceObject);
+ verify(mockPortObject);
+ verify(mockOpe);
+ }
+
+ /**
+ * Description:
+ * Test method for testChangeDeviceAttachmentsIDevice
+ * Condition:
+ * 1. The device is currently attached to a switch, but this attachment point
+ * has now changed.
+ * Expect:
+ * 1. The device should be removed from the old attachment point.
+ * 2. Set the attachment point expectedly;
+ */
+ @Test
+ public void testChangeDeviceAttachementsWhenAttached() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ //Details for the port the device will be moved from
+ long alreadyAttachedDpid = HexString.toLong("00:00:00:00:00:00:0b:01");
+ short alreadyAttachedPort = 5;
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+ IPortObject alreadyAttachedPortObject = getMockPort(alreadyAttachedDpid, alreadyAttachedPort);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singletonList(alreadyAttachedPortObject));
+ expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+ mockPortObject.setDevice(mockDeviceObject);
+ alreadyAttachedPortObject.removeDevice(mockDeviceObject);
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(alreadyAttachedPortObject);
+ replay(mockPortObject);
+ replay(mockOpe);
+
+ deviceImpl.changeDeviceAttachments(device);
+
+ verify(mockDeviceObject);
+ verify(alreadyAttachedPortObject);
+ verify(mockPortObject);
+ verify(mockOpe);
+ }
+
+ @Ignore
+ @Test
+ public void testChangeDeviceAttachmentsIDeviceIDeviceObject() {
+ //It is tested by the testChangeDeviceAttachmentsIDevice
+ }
+
+ /**
+ * Description:
+ * Test method for testChangeDeviceIPv4Address
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Set the IP address expectedly.
+ */
+ @Test
+ public void testChangeDeviceIpv4Address() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+ IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+ expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+ mockDeviceObject.addIpv4Address(mockIpv4Address);
+ expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singletonList(mockIpv4Address));
+ expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockIpv4Address);
+ replay(mockOpe);
+
+ deviceImpl.changeDeviceIPv4Address(device);
+
+ verify(mockDeviceObject);
+ verify(mockIpv4Address);
+ verify(mockOpe);
+ }
+
+ /**
+ * Description:
+ * Test method for testChangeDeviceIPv4Address
+ * Condition:
+ * 1. The device had an old IP address which has now changed.
+ * Expect:
+ * 1. The old IP address should be removed from the device.
+ * 2. Set the IP address expectedly.
+ */
+ @Test
+ public void testChangeDeviceIpv4AddressAndRemoveExisting() {
+ String strMacAddress = "99:99:99:99:99:99";
+ long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+ short attachmentPort = 2;
+ int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+
+ IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+
+ IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+
+ IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+ IIpv4Address mockDeletingIpv4Address = createMock(IIpv4Address.class);
+ List<IIpv4Address> ipv4Vertices = new ArrayList<IIpv4Address>(2);
+ ipv4Vertices.add(mockIpv4Address);
+ ipv4Vertices.add(mockDeletingIpv4Address);
+
+ expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+ expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+ expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+ expect(mockIpv4Address.getDevice()).andReturn(null);
+ mockDeviceObject.addIpv4Address(mockIpv4Address);
+ expect(mockDeviceObject.getIpv4Addresses()).andReturn(ipv4Vertices);
+ expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+ expect(mockDeletingIpv4Address.getIpv4Address()).andReturn(1);
+ mockDeviceObject.removeIpv4Address(mockDeletingIpv4Address);
+ mockOpe.commit();
+
+ replay(mockDeviceObject);
+ replay(mockIpv4Address);
+ replay(mockOpe);
+
+ deviceImpl.changeDeviceIPv4Address(device);
+
+ verify(mockDeviceObject);
+ verify(mockIpv4Address);
+ verify(mockOpe);
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java
new file mode 100644
index 0000000..c7c74a5
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java
@@ -0,0 +1,659 @@
+package net.onrc.onos.ofcontroller.devicemanager.internal;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import net.floodlightcontroller.core.internal.TestDatabaseManager;
+import net.floodlightcontroller.devicemanager.IDevice;
+import net.floodlightcontroller.devicemanager.SwitchPort;
+import net.floodlightcontroller.devicemanager.internal.Device;
+import net.floodlightcontroller.packet.IPv4;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.util.HexString;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+/*
+ * Jono, 11/4/2013
+ * These tests are being ignored because they don't work because they
+ * rely on test functionality that was written ages ago and hasn't been
+ * updated as the database schema has evolved.
+ * These tests work by getting an in-memory Titan database and testing
+ * the DeviceStorageImpl on top of that. In this regard they're not really
+ * unit tests as they test the entire DB stack (i.e. GraphDBOperation and
+ * GraphDBConnection), not just DeviceStorageImpl.
+ * I've left them here as we may wish to resurrect this kind of
+ * integration testing of the DB layers in the future.
+ */
+@Ignore
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class DeviceStorageImplTestBB {
+ protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation ope = null;
+ private TitanGraph titanGraph = null;
+ IDeviceStorage deviceImpl = null;
+
+ @Before
+ public void setUp() throws Exception {
+
+ deviceImpl = new DeviceStorageImpl();
+ conf = "/dummy/path/to/db";
+
+ // Make mock cassandra DB
+ // Replace TitanFactory.open() to return mock DB
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ TestDatabaseManager.populateTestData(titanGraph);
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ conn = GraphDBConnection.getInstance(conf);
+ ope = new GraphDBOperation(conn);
+
+ deviceImpl.init(conf);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+
+ deviceImpl.close();
+ deviceImpl = null;
+ }
+
+ /**
+ * Desc:
+ * Test method for addDevice method.
+ * Codition:
+ * N/A
+ * Expect:
+ * Get proper IDeviceObject
+ * Check the IDeviceObject properties set
+ */
+ @Test
+ public void testAddDevice() {
+ try
+ {
+ //Make mockDevice
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ // Mac addr for test device.
+ String macAddr = "99:99:99:99:99:99";
+ // IP addr for test device
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ // Mac addr for attached switch
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ // Port number for attached switch
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+
+ EasyMock.replay(mockDev);
+
+ //Add the device
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ //Test to take a Device from DB correctly
+ IDeviceObject devObj1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, devObj1.getMACAddress());
+
+ //Test to take a attached sw from DB correctly
+ for(ISwitchObject sw1: devObj1.getSwitch())
+ {
+ String swMacFromDB = sw1.getDPID();
+ assertEquals(switchMacAddr, swMacFromDB);
+ }
+
+ //Test to take a IP addr from DB
+ //TodoForGettingIPaddr. There may be bug in the test class.
+
+ //XXX not updated to new interface
+ //String ipFromDB = devObj1.getIPAddress();
+ String ipFromDB = "foo";
+
+ String[] ipsFromDB = ipFromDB.replace("[", "").replace("]", "").split(",");
+ List<String> ipsList = Arrays.asList(ipsFromDB);
+ assertTrue(ipsList.contains(ip));
+
+ //Test to take a attached port from DB
+ for(IPortObject port : devObj1.getAttachedPorts())
+ {
+
+ //In this implementing, the object was not set the port. So it must be null.
+ if(port.getNumber() != null)
+ {
+ String portNumFromDB = port.getNumber().toString();
+ assertEquals(String.valueOf(portNum), portNumFromDB);
+ }
+ }
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Desc:
+ * Test method for addDevice method.
+ * Condition:
+ * Already added device is existed.
+ * Expect:
+ * Get proper IDeviceObject still.
+ * Check the IDeviceObject properties set.
+ */
+ @Test
+ public void testAddDeviceExisting() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ //Add the device
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ //Test to take a Device from DB correctly
+ IDeviceObject devObj1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, devObj1.getMACAddress());
+
+ //Add the same device
+ IDeviceObject obj2 = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj2);
+
+ IDeviceObject devObj2 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, devObj2.getMACAddress());
+
+ //Test to take a attached port from DB
+ for(IPortObject port : devObj2.getAttachedPorts())
+ {
+ //In this implementing, the object was not set the port. So it must be null.
+ if(port.getNumber() != null)
+ {
+
+ String portNumFromDB = port.getNumber().toString();
+ assertEquals(String.valueOf(portNum), portNumFromDB);
+
+ }
+ }
+
+ //XXX not updated to new interface
+ //String ipFromDB = devObj2.getIPAddress();
+ String ipFromDB = "foo";
+
+ String[] ipsFromDB = ipFromDB.replace("[", "").replace("]", "").split(",");
+ List<String> ipsList = Arrays.asList(ipsFromDB);
+ assertTrue(ipsList.contains(ip));
+
+ //Test to take a attached port from DB
+ for(IPortObject port : devObj2.getAttachedPorts())
+ {
+
+ //In this implementing, the object was not set the port. So it must be null.
+ if(port.getNumber() != null)
+ {
+ String portNumFromDB = port.getNumber().toString();
+ assertEquals(String.valueOf(portNum), portNumFromDB);
+ }
+ }
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+ /**
+ * Desc:
+ * Test method for updateDevice method.
+ * Condition:
+ * The mac address and attachment point are the same.
+ * All of the other parameter are different.
+ * Expect:
+ * Changed parameters are set properly.
+ */
+ //@Ignore
+ @Test
+ public void testUpdateDevice() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ //Dev2 (attached port is the same)
+ IDevice mockDev2 = EasyMock.createMock(Device.class);
+ String macAddr2 = "99:aa:aa:aa:aa:aa";
+ Integer ip2 = IPv4.toIPv4Address("192.168.100.2");
+ Integer[] ipaddrs2 = {ip2};
+
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs2);
+ EasyMock.expect(mockDev2.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr2);
+ EasyMock.replay(mockDev2);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ IDeviceObject dev1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev1.getMACAddress());
+
+ //update theDevice
+ deviceImpl.updateDevice(mockDev2);
+ IDeviceObject dev2 = ope.searchDevice(macAddr2);
+ assertEquals(macAddr2, dev2.getMACAddress());
+ IPortObject iport = ope.searchPort(switchMacAddr, portNum);
+
+ //Test to take a attached port from DB
+ for(IDeviceObject dev : iport.getDevices())
+ {
+ String macAddrFromDB = dev.getMACAddress();
+ if(macAddr2.equals(macAddrFromDB)){
+ //Nothing to do
+ }
+ else{
+ fail("notFoundTheDeviceOnThePort");
+ }
+ }
+
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Desc:
+ * Test method for testRemoveDevice method.
+ * Condition:
+ * 1. Unregistered IDeviceObject argument is put.
+ * Expect:
+ * 1. Nothing happen when unregistered IDeviceObject is put
+ * 2. IDeviceObject will be removed.
+ */
+ //@Ignore
+ @Test
+ public void testRemoveDevice() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ IDeviceObject dev1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev1.getMACAddress());
+
+ deviceImpl.removeDevice(mockDev);
+ IDeviceObject dev = deviceImpl.getDeviceByMac(macAddr);
+ assertNull(dev);
+
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Desc:
+ * Test method for getDeviceByMac
+ * Condition:
+ * 1. Unregistered mac address argument is set
+ * Expect:
+ * 1.Nothing happen when you put unregistered mac address
+ * 2.Get the proper IDeviceObject.
+ * 3.Check the IDeviceObject properties set.
+ */
+ //@Ignore
+ @Test
+ public void testGetDeviceByMac() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ IDeviceObject dev1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev1.getMACAddress());
+
+ IDeviceObject dev = deviceImpl.getDeviceByMac(macAddr);
+ assertNotNull(dev);
+ assertEquals(macAddr, dev.getMACAddress());
+
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Desc:
+ * Test method for getDeviceByIP method.
+ * Condition:
+ * 1. Unregistered ip address argument is set
+ * Expect:
+ * 1. Nothing happen when you put unregistered mac address
+ * 2. Get the proper IDeviceObject.
+ * 3. Check the IDeviceObject properties set.
+ */
+ //@Ignore
+ @Test
+ public void testGetDeviceByIP() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ IDeviceObject dev1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev1.getMACAddress());
+
+ //XXX not updated to new interface
+ //IDeviceObject dev = deviceImpl.getDeviceByIP(ip);
+ IDeviceObject dev = null;
+
+ assertNotNull(dev);
+
+ //XXX not updated to new interface
+ //String ipFromDB = dev.getIPAddress();
+ String ipFromDB = "foo";
+
+ String[] ipsFromDB = ipFromDB.replace("[", "").replace("]", "").split(",");
+ List<String> ipsList = Arrays.asList(ipsFromDB);
+ assertTrue(ipsList.contains(ip));
+
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Desc:
+ * Test method for testChangeDeviceAttachmentsIDevice
+ * Condition:
+ * 1. Unexisting attachment point argument is set
+ * Expect:
+ * 1. Unexisting attachment point is ignored, so nothing happen.
+ * 2. Change the attachment point.
+ */
+ //@Ignore
+ @Test
+ public void testChangeDeviceAttachmentsIDevice() {
+ try
+ {
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ //Dev2
+ IDevice mockDev2 = EasyMock.createMock(Device.class);
+ String switchMacAddr2 = "00:00:00:00:00:00:0a:02";
+ long lSwitchMacAddr2 = HexString.toLong(switchMacAddr2);
+ short portNum2 = 2;
+ SwitchPort sp2 = new SwitchPort(lSwitchMacAddr2, portNum2);
+ SwitchPort sps2[] = {sp2};
+
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev2.getAttachmentPoints()).andReturn(sps2);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev2);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ deviceImpl.changeDeviceAttachments(mockDev2);
+
+ IDeviceObject dev = deviceImpl.getDeviceByMac(macAddr);
+ assertNotNull(dev);
+
+ for(ISwitchObject sw1: dev.getSwitch())
+ {
+ String swMacFromDB = sw1.getDPID();
+ assertEquals(switchMacAddr2, swMacFromDB);
+ }
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ //@Ignore
+ @Test
+ public void testChangeDeviceAttachmentsIDeviceIDeviceObject() {
+ //It is tested by the testChangeDeviceAttachmentsIDevice
+ }
+
+ /**
+ * Desc:
+ * Test method for testChangeDeviceIPv4Address
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Check correctly changed the ipadress
+ */
+ //@Ignore
+ @Test
+ public void testChangeDeviceIPv4Address() {
+ try
+ {
+ //Dev1
+ IDevice mockDev = EasyMock.createMock(Device.class);
+ String macAddr = "99:99:99:99:99:99";
+ String ip = "192.168.100.1";
+ Integer ipInt = IPv4.toIPv4Address(ip);
+ Integer[] ipaddrs = {ipInt};
+ String switchMacAddr = "00:00:00:00:00:00:0a:01";
+ long switchMacAddrL = HexString.toLong(switchMacAddr);
+ short portNum = 2;
+ SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
+ SwitchPort[] sps = {sp1};
+
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
+ EasyMock.expect(mockDev.getAttachmentPoints()).andReturn(sps);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev.getMACAddressString()).andReturn(macAddr);
+ EasyMock.replay(mockDev);
+
+ IDeviceObject obj = deviceImpl.addDevice(mockDev);
+ assertNotNull(obj);
+
+ IDevice mockDev2 = EasyMock.createMock(Device.class);
+ String ip2 = "192.168.100.2";
+ Integer ipInt2 = IPv4.toIPv4Address(ip2);
+ Integer[] ipaddrs2 = {ipInt2};
+ EasyMock.expect(mockDev2.getMACAddressString()).andReturn(macAddr);
+ EasyMock.expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs2);
+ EasyMock.replay(mockDev2);
+
+ IDeviceObject dev1 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev1.getMACAddress());
+
+ //XXX not updated to new interface
+ //String ipFromDB = dev1.getIPAddress();
+ String ipFromDB = "foo";
+
+ String[] ipsFromDB = ipFromDB.replace("[", "").replace("]", "").split(",");
+ List<String> ipsList = Arrays.asList(ipsFromDB);
+ assertTrue(ipsList.contains(ip));
+
+ deviceImpl.changeDeviceIPv4Address(mockDev2);
+
+ IDeviceObject dev2 = ope.searchDevice(macAddr);
+ assertEquals(macAddr, dev2.getMACAddress());
+
+ //XXX not updated to new interface
+ //String ipFromDB2 = dev2.getIPAddress();
+ String ipFromDB2 = "foo";
+
+ String[] ipsFromDB2 = ipFromDB2.replace("[", "").replace("]", "").split(",");
+ List<String> ipsList2 = Arrays.asList(ipsFromDB2);
+ assertTrue(ipsList2.contains(ip2));
+ }
+ catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
new file mode 100644
index 0000000..c54e89d
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
@@ -0,0 +1,807 @@
+package net.onrc.onos.ofcontroller.flowmanager;
+
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.cmpEq;
+import static org.powermock.api.easymock.PowerMock.*;
+
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.*;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.factory.BasicFactory;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+/**
+ * @author Toshio Koide
+ */
+@Ignore
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({FlowManager.class, FlowDatabaseOperation.class, GraphDBOperation.class, System.class, Executors.class})
+public class FlowManagerTest {
+ private static FloodlightModuleContext context;
+ private static IFloodlightProviderService floodlightProvider;
+ private static TopologyManager topologyManager;
+ private static IDatagridService datagridService;
+ private static IRestApiService restApi;
+ private static GraphDBOperation op;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ private void expectInitWithContext() throws Exception {
+ // create mock objects
+ context = createMock(FloodlightModuleContext.class);
+ floodlightProvider = createMock(IFloodlightProviderService.class);
+ topologyManager = createMock(TopologyManager.class);
+ datagridService = createMock(IDatagridService.class);
+ restApi = createMock(IRestApiService.class);
+ op = createMock(GraphDBOperation.class);
+
+ // setup expectations
+ expect(context.getServiceImpl(IFloodlightProviderService.class)).andReturn(floodlightProvider);
+ expect(context.getServiceImpl(ITopologyNetService.class)).andReturn(topologyManager);
+ expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
+ expect(context.getServiceImpl(IRestApiService.class)).andReturn(restApi);
+ expectNew(GraphDBOperation.class, new Class<?>[] {String.class}, EasyMock.isA(String.class)).andReturn(op);
+ expectNew(TopologyManager.class, new Class<?>[] {String.class}, EasyMock.isA(String.class)).andReturn(topologyManager);
+ }
+
+ private IFlowPath createIFlowPathMock(long flowId, String installerID,
+ String flowPathType, String flowPathUserState,
+ long flowPathFlags, long srcDpid, int srcPort,
+ long dstDpid, int dstPort) {
+ IFlowPath iFlowPath = createNiceMock(IFlowPath.class);
+ expect(iFlowPath.getFlowId()).andReturn(new FlowId(flowId).toString()).anyTimes();
+ expect(iFlowPath.getInstallerId()).andReturn(installerID).anyTimes();
+ expect(iFlowPath.getFlowPathType()).andReturn(flowPathType).anyTimes();
+ expect(iFlowPath.getFlowPathUserState()).andReturn(flowPathUserState).anyTimes();
+ expect(iFlowPath.getFlowPathFlags()).andReturn(new Long(flowPathFlags)).anyTimes();
+ expect(iFlowPath.getSrcSwitch()).andReturn(new Dpid(srcDpid).toString()).anyTimes();
+ expect(iFlowPath.getSrcPort()).andReturn(new Short((short)srcPort)).anyTimes();
+ expect(iFlowPath.getDstSwitch()).andReturn(new Dpid(dstDpid).toString()).anyTimes();
+ expect(iFlowPath.getDstPort()).andReturn(new Short((short)dstPort)).anyTimes();
+ return iFlowPath;
+ }
+
+ private FlowPath createTestFlowPath(long flowId, String installerId,
+ String flowPathType, String flowPathUserState,
+ final long flowPathFlags,
+ final long srcDpid, final int srcPort,
+ final long dstDpid, final int dstPort
+ ) {
+ FlowPath flowPath = new FlowPath();
+ flowPath.setFlowId(new FlowId(flowId));
+ flowPath.setInstallerId(new CallerId(installerId));
+ flowPath.setFlowPathType(FlowPathType.valueOf(flowPathType));
+ flowPath.setFlowPathUserState(FlowPathUserState.valueOf(flowPathUserState));
+ flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
+ flowPath.setDataPath(new DataPath() {{
+ setSrcPort(new SwitchPort(new Dpid(srcDpid), new Port((short)srcPort)));
+ setDstPort(new SwitchPort(new Dpid(dstDpid), new Port((short)dstPort)));
+ }});
+ flowPath.setFlowEntryMatch(new FlowEntryMatch());
+ return flowPath;
+ }
+
+ private ArrayList<FlowPath> createTestFlowPaths() {
+ FlowPath flowPath1 = createTestFlowPath(1, "foo caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 1, 2, 2);
+ FlowPath flowPath2 = createTestFlowPath(2, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 1, 2, 2);
+ FlowPath flowPath3 = createTestFlowPath(3, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 5, 2, 2);
+
+ ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
+ flowPaths.add(flowPath1);
+ flowPaths.add(flowPath2);
+ flowPaths.add(flowPath3);
+
+ return flowPaths;
+ }
+
+
+ // IFlowService methods
+
+
+ /**
+ * Test method for {@link FlowManager#addFlow(FlowPath)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testAddFlowFailGraphCreatesNoFlow() throws Exception {
+ // instantiate required objects
+ FlowId flowId = new FlowId(123);
+ FlowPath flowPath = new FlowPath();
+ flowPath.setFlowId(flowId);
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.searchFlowPath(flowId)).andReturn(null);
+ expect(op.newFlowPath()).andReturn(null);
+ op.rollback();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ FlowId result = fm.addFlow(flowPath);
+
+ // verify the test
+ verifyAll();
+ assertNotNull(result);
+ }
+
+ /**
+ * Test method for {@link FlowManager#addFlow(FlowPath)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testAddFlowSuccessNormally() throws Exception {
+ final String addFlowEntry = "addFlowEntry";
+ // create mock objects
+ IFlowPath createdFlowPath = createNiceMock(IFlowPath.class);
+ IFlowEntry createdFlowEntry1 = createNiceMock(IFlowEntry.class);
+ IFlowEntry createdFlowEntry2 = createNiceMock(IFlowEntry.class);
+ FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlowEntry);
+
+ // instantiate required objects
+ final FlowEntry flowEntry1 = new FlowEntry();
+ final FlowEntry flowEntry2 = new FlowEntry();
+ ArrayList<FlowEntry> flowEntries = new ArrayList<FlowEntry>();
+ flowEntries.add(flowEntry1);
+ flowEntries.add(flowEntry2);
+
+ DataPath dataPath = new DataPath();
+ dataPath.setSrcPort(new SwitchPort(new Dpid(0x1234), new Port((short)1)));
+ dataPath.setDstPort(new SwitchPort(new Dpid(0x5678), new Port((short)2)));
+ dataPath.setFlowEntries(flowEntries);
+
+ FlowEntryMatch match = new FlowEntryMatch();
+
+ FlowPath flowPath = new FlowPath();
+ flowPath.setFlowId(new FlowId(0x100));
+ flowPath.setInstallerId(new CallerId("installer id"));
+ flowPath.setFlowPathType(FlowPathType.valueOf("FP_TYPE_SHORTEST_PATH"));
+ flowPath.setFlowPathUserState(FlowPathUserState.valueOf("FP_USER_ADD"));
+ flowPath.setFlowPathFlags(new FlowPathFlags(0));
+ flowPath.setDataPath(dataPath);
+ flowPath.setFlowEntryMatch(match);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.searchFlowPath(cmpEq(new FlowId(0x100)))).andReturn(null);
+ expect(op.newFlowPath()).andReturn(createdFlowPath);
+ createdFlowPath.setFlowId("0x100");
+ createdFlowPath.setType("flow");
+ createdFlowPath.setInstallerId("installer id");
+ createdFlowPath.setFlowPathType("FP_TYPE_SHORTEST_PATH");
+ createdFlowPath.setFlowPathUserState("FP_USER_ADD");
+ createdFlowPath.setFlowPathFlags(new Long((long)0));
+ createdFlowPath.setSrcSwitch("00:00:00:00:00:00:12:34");
+ createdFlowPath.setSrcPort(new Short((short)1));
+ createdFlowPath.setDstSwitch("00:00:00:00:00:00:56:78");
+ createdFlowPath.setDstPort(new Short((short)2));
+ createdFlowPath.setDataPathSummary("data path summary");
+
+ expectPrivate(fm, addFlowEntry, createdFlowPath, flowEntry1)
+ .andReturn(createdFlowEntry1);
+ expectPrivate(fm, addFlowEntry, createdFlowPath, flowEntry2)
+ .andReturn(createdFlowEntry2);
+
+ op.commit();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ FlowId result = fm.addFlow(flowPath);
+
+ // verify the test
+ verifyAll();
+ assertNotNull(result);
+ }
+
+ /**
+ * Test method for {@link FlowManager#deleteFlow(FlowId)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testDeleteFlowSuccessNormally() throws Exception {
+ // create mock objects
+ IFlowPath flowPath = createIFlowPathMock(123, "id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 2, 3, 4);
+ IFlowEntry flowEntry1 = createMock(IFlowEntry.class);
+ IFlowEntry flowEntry2 = createMock(IFlowEntry.class);
+ IFlowEntry flowEntry3 = createMock(IFlowEntry.class);
+
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+ FlowId flowId = new FlowId(123);
+ ArrayList<IFlowEntry> flowEntries = new ArrayList<IFlowEntry>();
+ flowEntries.add(flowEntry1);
+ flowEntries.add(flowEntry2);
+ flowEntries.add(flowEntry3);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.searchFlowPath(cmpEq(flowId))).andReturn(flowPath);
+ expect(flowPath.getFlowEntries()).andReturn(flowEntries);
+ flowPath.removeFlowEntry(flowEntry1);
+ flowPath.removeFlowEntry(flowEntry2);
+ flowPath.removeFlowEntry(flowEntry3);
+ op.removeFlowEntry(flowEntry1);
+ op.removeFlowEntry(flowEntry2);
+ op.removeFlowEntry(flowEntry3);
+ op.removeFlowPath(flowPath);
+ op.commit();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ fm.deleteFlow(flowId);
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link FlowManager#deleteFlow(FlowId)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testDeleteFlowSuccessEmptyFlowPath() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // create mock objects
+ IFlowPath flowObj = createNiceMock(IFlowPath.class);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.searchFlowPath(cmpEq(new FlowId(1)))).andReturn(flowObj);
+ expect(flowObj.getFlowEntries()).andReturn(new ArrayList<IFlowEntry>());
+ op.removeFlowPath(flowObj);
+ op.commit();
+ expectLastCall().anyTimes();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ Boolean result = fm.deleteFlow(new FlowId(1));
+
+ // verify the test
+ verifyAll();
+ assertTrue(result);
+ }
+
+ /**
+ * Test method for {@link FlowManager#deleteAllFlows()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testDeleteAllFlowsSuccessNormally() throws Exception {
+ // create mock objects
+ IFlowPath flowPath1 = createNiceMock(IFlowPath.class);
+ IFlowPath flowPath2 = createNiceMock(IFlowPath.class);
+ IFlowPath flowPath3 = createNiceMock(IFlowPath.class);
+ FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, "deleteFlow");
+
+ // instantiate required objects
+ ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
+ flowPaths.add(flowPath1);
+ flowPaths.add(flowPath2);
+ flowPaths.add(null);
+ flowPaths.add(flowPath3);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.getAllFlowPaths()).andReturn(flowPaths);
+ expect(flowPath1.getFlowId()).andReturn(new FlowId(1).toString());
+ expect(flowPath2.getFlowId()).andReturn(null);
+ expect(flowPath3.getFlowId()).andReturn(new FlowId(3).toString());
+ expect(fm.deleteFlow(cmpEq(new FlowId(1)))).andReturn(true);
+ expect(fm.deleteFlow(cmpEq(new FlowId(3)))).andReturn(true);
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ Boolean result = fm.deleteAllFlows();
+
+ // verify the test
+ verifyAll();
+ assertTrue(result);
+ }
+
+ /**
+ * Test method for {@link FlowManager#getFlow()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetFlowSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+ IFlowPath iFlowPath = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 1, 2, 2);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.searchFlowPath(cmpEq(new FlowId(1)))).andReturn(iFlowPath);
+ expect(iFlowPath.getFlowEntries()).andReturn(new ArrayList<IFlowEntry>()).anyTimes();
+ op.commit();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ FlowPath flowPath = fm.getFlow(new FlowId(1));
+ String installerId = flowPath.installerId().toString();
+ String flowPathType = flowPath.flowPathType().toString();
+ String flowPathUserState = flowPath.flowPathUserState().toString();
+ long flowPathFlags = flowPath.flowPathFlags().flags();
+
+ //verify the test
+ verifyAll();
+ assertEquals("caller id", installerId);
+ assertEquals("FP_TYPE_SHORTEST_PATH", flowPathType);
+ assertEquals("FP_USER_ADD", flowPathUserState);
+ assertEquals(0L, flowPathFlags);
+ }
+
+ /**
+ * Test method for {@link FlowManager#getAllFlowsSummary(FlowId, int)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetAllFlowsSummarySuccessNormally() throws Exception {
+ final String getAllFlowsWithDataPathSummary = "getAllFlowsWithDataPathSummary";
+ // create mock objects
+ FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, getAllFlowsWithDataPathSummary);
+ FlowPath flowPath1 = createTestFlowPath(1, "", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 2, 3, 4);
+ FlowPath flowPath2 = createTestFlowPath(5, "", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 2, 3, 4, 5);
+ FlowPath flowPath3 = createTestFlowPath(10, "", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 3, 4, 5, 6);
+
+ // instantiate required objects
+ ArrayList<FlowPath> flows = new ArrayList<FlowPath>();
+ flows.add(flowPath3);
+ flows.add(flowPath1);
+ flows.add(flowPath2);
+
+ // setup expectations
+ expectInitWithContext();
+ expectPrivate(fm, getAllFlowsWithDataPathSummary).andReturn(flows);
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ ArrayList<FlowPath> returnedFlows = fm.getAllFlowsSummary(null, 0);
+
+ // verify the test
+ verifyAll();
+ assertEquals(3, returnedFlows.size());
+ assertEquals(1, new FlowId(returnedFlows.get(0).flowId().value()).value());
+ assertEquals(5, new FlowId(returnedFlows.get(1).flowId().value()).value());
+ assertEquals(10, new FlowId(returnedFlows.get(2).flowId().value()).value());
+ }
+
+ /**
+ * Test method for {@link FlowManager#getAllFlows()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetAllFlowsSuccessNormally() throws Exception {
+ // create mock objects
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 2, 5, 3, 5);
+
+ // instantiate required objects
+ ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
+ flowPaths.add(iFlowPath1);
+ flowPaths.add(iFlowPath2);
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+ expect(op.getAllFlowPaths()).andReturn(flowPaths);
+ expect(iFlowPath1.getFlowEntries()).andReturn(new ArrayList<IFlowEntry>()).anyTimes();
+ expect(iFlowPath2.getFlowEntries()).andReturn(new ArrayList<IFlowEntry>()).anyTimes();
+ op.commit();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ ArrayList<FlowPath> flows = fm.getAllFlows();
+
+ // verify the test
+ verifyAll();
+ assertEquals(2, flows.size());
+ assertEquals(new SwitchPort(new Dpid(1), new Port((short)1)).toString(),
+ flows.get(0).dataPath().srcPort().toString());
+ assertEquals(new SwitchPort(new Dpid(2), new Port((short)5)).toString(),
+ flows.get(1).dataPath().srcPort().toString());
+ // TODO: more asserts
+ // TODO: ignore seq. of the list
+ }
+
+ // INetMapStorage methods
+
+ /**
+ * Test method for {@link FlowManager#init(String)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testInitSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // create mock objects
+ op = createMock(GraphDBOperation.class);
+
+ // setup expectations
+ expectNew(GraphDBOperation.class, "/dummy/path").andReturn(op);
+
+ // start the test
+ replayAll();
+
+ fm.init("/dummy/path");
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link FlowManager#close()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testCloseSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+ op.close();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ fm.close();
+
+ // verify the test
+ verifyAll();
+ }
+
+
+ // IFloodlightModule methods
+
+
+ /**
+ * Test method for {@link FlowManager#getModuleServices()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetModuleServicesSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ Collection<Class<? extends IFloodlightService>> l = fm.getModuleServices();
+
+ // verify the test
+ verifyAll();
+ assertEquals(1, l.size());
+ assertEquals(IFlowService.class, l.iterator().next());
+ }
+
+ /**
+ * Test method for {@link FlowManager#getServiceImpls()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetServiceImplsSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ Map<Class<? extends IFloodlightService>, IFloodlightService> si = fm.getServiceImpls();
+
+ // verify the test
+ verifyAll();
+ assertEquals(1, si.size());
+ assertTrue(si.containsKey(IFlowService.class));
+ assertEquals(fm, si.get(IFlowService.class));
+ }
+
+ /**
+ * Test method for {@link FlowManager#getModuleDependencies()}.
+ * @throws Exception
+ */
+ @Test
+ public final void testGetModuleDependenciesSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ Collection<Class<? extends IFloodlightService>> md = fm.getModuleDependencies();
+
+ // verify the test
+ verifyAll();
+ assertEquals(4, md.size());
+ assertTrue(md.contains(IFloodlightProviderService.class));
+ assertTrue(md.contains(IRestApiService.class));
+ }
+
+ /**
+ * Test method for {@link FlowManager#init(FloodlightModuleContext)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testInitWithFloodlightModuleContextSuccessNormally() throws Exception {
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+
+ // verify the test
+ verifyAll();
+ }
+
+ /**
+ * Test method for {@link FlowManager#startUp(FloodlightModuleContext)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testStartupSuccessNormally() throws Exception {
+ // create mock objects
+ mockStaticPartial(Executors.class, "newScheduledThreadPool");
+ ScheduledExecutorService scheduler = createMock(ScheduledExecutorService.class);
+
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ // setup expectations
+ expectInitWithContext();
+ expect(Executors.newScheduledThreadPool(1)).andReturn(scheduler);
+ expect(Executors.newScheduledThreadPool(1)).andReturn(scheduler);
+ expect(scheduler.scheduleAtFixedRate(
+ EasyMock.anyObject(Runnable.class),
+ EasyMock.anyLong(),
+ EasyMock.anyLong(),
+ EasyMock.anyObject(TimeUnit.class))).andReturn(null).times(2);
+ restApi.addRestletRoutable(EasyMock.anyObject(FlowWebRoutable.class));
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ fm.startUp(context);
+
+ // verify the test
+ verifyAll();
+ }
+
+
+ // other methods
+
+ /**
+ * Test method for {@link FlowManager#reconcileFlow(IFlowPath, DataPath)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testReconcileFlowWithFlowPathAndDataPathSuccessNormally() throws Exception {
+ final String addFlowEntry = "addFlowEntry";
+
+ // create mock objects
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 1, 2, 2);
+ IFlowEntry iFlowEntry1 = createMock(IFlowEntry.class);
+ IFlowEntry iFlowEntry2 = createMock(IFlowEntry.class);
+ FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlowEntry);
+
+ // instantiate required objects
+ FlowEntry flowEntry1 = new FlowEntry();
+ flowEntry1.setDpid(new Dpid(1));
+ flowEntry1.setFlowId(new FlowId(1));
+ flowEntry1.setInPort(new Port((short) 1));
+ flowEntry1.setOutPort(new Port((short) 11));
+ flowEntry1.setFlowEntryId(new FlowEntryId(1));
+ flowEntry1.setFlowEntryMatch(new FlowEntryMatch());
+ flowEntry1.setFlowEntryActions(new FlowEntryActions());
+ flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState());
+
+ FlowEntry flowEntry2 = new FlowEntry();
+ flowEntry2.setDpid(new Dpid(2));
+ flowEntry2.setFlowId(new FlowId(2));
+ flowEntry2.setInPort(new Port((short) 22));
+ flowEntry2.setOutPort(new Port((short) 2));
+ flowEntry2.setFlowEntryId(new FlowEntryId(2));
+ flowEntry2.setFlowEntryMatch(new FlowEntryMatch());
+ flowEntry2.setFlowEntryActions(new FlowEntryActions());
+ flowEntry2.setFlowEntryErrorState(new FlowEntryErrorState());
+
+ DataPath dataPath = new DataPath();
+ ArrayList<FlowEntry> flowEntries = new ArrayList<FlowEntry>();
+ flowEntries.add(flowEntry1);
+ flowEntries.add(flowEntry2);
+ dataPath.setFlowEntries(flowEntries);
+
+ ArrayList<IFlowEntry> oldFlowEntries = new ArrayList<IFlowEntry>();
+ oldFlowEntries.add(iFlowEntry1);
+ oldFlowEntries.add(iFlowEntry2);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(iFlowPath1.getFlowEntries()).andReturn(oldFlowEntries);
+ iFlowEntry1.setUserState("FE_USER_DELETE");
+ iFlowEntry1.setSwitchState("FE_SWITCH_NOT_UPDATED");
+ iFlowEntry2.setUserState("FE_USER_DELETE");
+ iFlowEntry2.setSwitchState("FE_SWITCH_NOT_UPDATED");
+ expectPrivate(fm, addFlowEntry, iFlowPath1, flowEntry1).andReturn(null);
+ expectPrivate(fm, addFlowEntry, iFlowPath1, flowEntry2).andReturn(null);
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ // Use reflection to test the private method
+ // Boolean result = fm.reconcileFlow(iFlowPath1, dataPath);
+ Class fmClass = FlowManager.class;
+ Method method = fmClass.getDeclaredMethod(
+ "reconcileFlow",
+ new Class[] { IFlowPath.class, DataPath.class });
+ method.setAccessible(true);
+ Boolean result = (Boolean)method.invoke(fm,
+ new Object[] { iFlowPath1, dataPath });
+
+ // verify the test
+ verifyAll();
+ assertTrue(result);
+ // TODO: write more asserts
+ }
+
+ /**
+ * Test method for {@link FlowManager#installFlowEntry(net.floodlightcontroller.core.IOFSwitch, IFlowPath, IFlowEntry)}.
+ * @throws Exception
+ */
+ @Test
+ public final void testInstallFlowEntryWithIFlowPathSuccessNormally() throws Exception {
+ // create mock object
+ IOFSwitch iofSwitch = createNiceMock(IOFSwitch.class);
+ IFlowPath iFlowPath = createIFlowPathMock(1, "id", "FP_TYPE_SHORTEST_PATH", "FP_USER_ADD", 0, 1, 2, 3, 4);
+ IFlowEntry iFlowEntry = createMock(IFlowEntry.class);
+ BasicFactory basicFactory = createMock(BasicFactory.class);
+
+ // instantiate required objects
+ FlowManager fm = new FlowManager();
+
+ FlowEntryAction action = new FlowEntryAction();
+ action.setActionOutput(new Port((short)2));
+ FlowEntryActions actions = new FlowEntryActions();
+ actions.addAction(action);
+
+ // setup expectations
+ expectInitWithContext();
+ expect(iFlowEntry.getFlowEntryId()).andReturn(new FlowEntryId(123).toString());
+ expect(iFlowEntry.getUserState()).andReturn("FE_USER_ADD");
+ iFlowEntry.setSwitchState("FE_SWITCH_UPDATED");
+ expect(iFlowEntry.getMatchInPort()).andReturn(new Short((short) 1));
+ expect(iFlowEntry.getMatchSrcMac()).andReturn("01:23:45:67:89:01");
+ expect(iFlowEntry.getMatchDstMac()).andReturn("01:23:45:67:89:02");
+ expect(iFlowEntry.getMatchEthernetFrameType()).andReturn(new Short((short)0x0800));
+ expect(iFlowEntry.getMatchVlanId()).andReturn(new Short((short)0x1234));
+ expect(iFlowEntry.getMatchVlanPriority()).andReturn(new Byte((byte)0x10));
+ expect(iFlowEntry.getMatchSrcIPv4Net()).andReturn("192.168.0.1");
+ expect(iFlowEntry.getMatchDstIPv4Net()).andReturn("192.168.0.2");
+ expect(iFlowEntry.getMatchIpProto()).andReturn(new Byte((byte)0x20));
+ expect(iFlowEntry.getMatchIpToS()).andReturn(new Byte((byte)0x3));
+ expect(iFlowEntry.getMatchSrcTcpUdpPort()).andReturn(new Short((short)40000));
+ expect(iFlowEntry.getMatchDstTcpUdpPort()).andReturn(new Short((short)80));
+ expect(iFlowEntry.getActions()).andReturn(actions.toString());
+ expect(floodlightProvider.getOFMessageFactory()).andReturn(basicFactory);
+ expect(basicFactory.getMessage(OFType.FLOW_MOD)).andReturn(new OFFlowMod());
+ expect(iofSwitch.getStringId()).andReturn(new Dpid(100).toString());
+
+ // start the test
+ replayAll();
+
+ fm.init(context);
+ // Use reflection to test the private method
+ // Boolean result = fm.installFlowEntry(iofSwitch, iFlowPath, iFlowEntry);
+ Class fmClass = FlowManager.class;
+ Method method = fmClass.getDeclaredMethod(
+ "installFlowEntry",
+ new Class[] { IOFSwitch.class, IFlowPath.class, IFlowEntry.class });
+ method.setAccessible(true);
+ Boolean result = (Boolean)method.invoke(fm,
+ new Object[] { iofSwitch, iFlowPath, iFlowEntry });
+
+
+ // verify the test
+ verifyAll();
+ assertTrue(result);
+ // TODO: write more asserts
+ }
+
+ /**
+ * Test method for {@link FlowManager#installFlowEntry(net.floodlightcontroller.core.IOFSwitch, FlowPath, FlowEntry)}.
+ * The method seems to be not used for now.
+ */
+ @Ignore @Test
+ public final void testInstallFlowEntryWithFlowPathSuccessNormally() {
+ fail("not yet implemented");
+ }
+
+ /**
+ * Test method for {@link FlowManager#removeFlowEntry(net.floodlightcontroller.core.IOFSwitch, FlowPath, FlowEntry)}.
+ * The method seems to be not implemented and not used for now.
+ */
+ @Ignore @Test
+ public final void testRemoveFlowEntrySuccessNormally() {
+ fail("not yet implemented");
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusherTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusherTest.java
new file mode 100644
index 0000000..4779b75
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusherTest.java
@@ -0,0 +1,544 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.floodlightcontroller.util.OFMessageDamper;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryActions;
+import net.onrc.onos.ofcontroller.util.FlowEntryErrorState;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.Port;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.junit.Test;
+import org.openflow.protocol.OFBarrierRequest;
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.protocol.factory.BasicFactory;
+
+public class FlowPusherTest {
+ private FlowPusher pusher;
+ private FloodlightContext context;
+ private FloodlightModuleContext modContext;
+ private BasicFactory factory;
+ private OFMessageDamper damper;
+ private IFloodlightProviderService flProviderService;
+ private IThreadPoolService threadPoolService;
+ private IFlowService flowService;
+
+ /**
+ * Test single OFMessage is correctly sent to single switch via MessageDamper.
+ */
+ @Test
+ public void testAddMessage() {
+ beginInitMock();
+
+ OFMessage msg = EasyMock.createMock(OFMessage.class);
+ EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(msg);
+
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(sw);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ boolean add_result = pusher.add(sw, msg);
+ assertTrue(add_result);
+
+ try {
+ // wait until message is processed.
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Failed in Thread.sleep()");
+ }
+
+ EasyMock.verify(msg);
+ EasyMock.verify(sw);
+
+ pusher.stop();
+ }
+
+ /**
+ * Test bunch of OFMessages are correctly sent to single switch via MessageDamper.
+ */
+ @Test
+ public void testMassiveAddMessage() {
+ final int NUM_MSG = 10000;
+
+ beginInitMock();
+
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.replay(sw);
+
+ List<OFMessage> messages = new ArrayList<OFMessage>();
+
+ for (int i = 0; i < NUM_MSG; ++i) {
+ OFMessage msg = EasyMock.createMock(OFMessage.class);
+ EasyMock.expect(msg.getXid()).andReturn(i).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(msg);
+ messages.add(msg);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ for (OFMessage msg : messages) {
+ boolean add_result = pusher.add(sw, msg);
+ assertTrue(add_result);
+ }
+
+ try {
+ // wait until message is processed.
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Failed in Thread.sleep()");
+ }
+
+ for (OFMessage msg : messages) {
+ EasyMock.verify(msg);
+ }
+ EasyMock.verify(sw);
+
+ pusher.stop();
+ }
+
+ /**
+ * Test bunch of OFMessages are correctly sent to multiple switches with single threads.
+ */
+ @Test
+ public void testMultiSwitchAddMessage() {
+ final int NUM_SWITCH = 10;
+ final int NUM_MSG = 100; // messages per thread
+
+ beginInitMock();
+
+ Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+ for (int i = 0; i < NUM_SWITCH; ++i) {
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)i).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.replay(sw);
+
+ List<OFMessage> messages = new ArrayList<OFMessage>();
+
+ for (int j = 0; j < NUM_MSG; ++j) {
+ OFMessage msg = EasyMock.createMock(OFMessage.class);
+ EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(msg);
+ messages.add(msg);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+ }
+ sw_map.put(sw, messages);
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ for (IOFSwitch sw : sw_map.keySet()) {
+ for (OFMessage msg : sw_map.get(sw)) {
+ boolean add_result = pusher.add(sw, msg);
+ assertTrue(add_result);
+ }
+ }
+
+ try {
+ // wait until message is processed.
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Failed in Thread.sleep()");
+ }
+
+ for (IOFSwitch sw : sw_map.keySet()) {
+ for (OFMessage msg : sw_map.get(sw)) {
+ EasyMock.verify(msg);
+ }
+
+ EasyMock.verify(sw);
+ }
+
+ pusher.stop();
+ }
+
+ /**
+ * Test bunch of OFMessages are correctly sent to multiple switches using multiple threads.
+ */
+ @Test
+ public void testMultiThreadedAddMessage() {
+ final int NUM_THREAD = 10;
+ final int NUM_MSG = 100; // messages per thread
+
+ beginInitMock();
+
+ Map<IOFSwitch, List<OFMessage>> sw_map = new HashMap<IOFSwitch, List<OFMessage>>();
+ for (int i = 0; i < NUM_THREAD; ++i) {
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)i).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.replay(sw);
+
+ List<OFMessage> messages = new ArrayList<OFMessage>();
+
+ for (int j = 0; j < NUM_MSG; ++j) {
+ OFMessage msg = EasyMock.createMock(OFMessage.class);
+ EasyMock.expect(msg.getXid()).andReturn(j).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(msg);
+ messages.add(msg);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+ }
+ sw_map.put(sw, messages);
+ }
+
+ endInitMock();
+ initPusher(NUM_THREAD);
+
+ for (IOFSwitch sw : sw_map.keySet()) {
+ for (OFMessage msg : sw_map.get(sw)) {
+ boolean add_result = pusher.add(sw, msg);
+ assertTrue(add_result);
+ }
+ }
+
+ try {
+ // wait until message is processed.
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Failed in Thread.sleep()");
+ }
+
+ for (IOFSwitch sw : sw_map.keySet()) {
+ for (OFMessage msg : sw_map.get(sw)) {
+ EasyMock.verify(msg);
+ }
+
+ EasyMock.verify(sw);
+ }
+
+ pusher.stop();
+ }
+
+ private long barrierTime = 0;
+ /**
+ * Test rate limitation of messages works correctly.
+ */
+ @Test
+ public void testRateLimitedAddMessage() {
+ final long LIMIT_RATE = 100; // [bytes/ms]
+ final int NUM_MSG = 1000;
+
+ // Accuracy of FlowPusher's rate calculation can't be measured by unit test
+ // because switch doesn't return BARRIER_REPLY.
+ // In unit test we use approximate way to measure rate. This value is
+ // acceptable margin of measured rate.
+ final double ACCEPTABLE_RATE = LIMIT_RATE * 1.2;
+
+ beginInitMock();
+
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().atLeastOnce();
+ prepareBarrier(sw);
+ EasyMock.replay(sw);
+
+ List<OFMessage> messages = new ArrayList<OFMessage>();
+
+ for (int i = 0; i < NUM_MSG; ++i) {
+ OFMessage msg = EasyMock.createMock(OFMessage.class);
+ EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.expect(msg.getLengthU()).andReturn(100).anyTimes();
+ EasyMock.replay(msg);
+ messages.add(msg);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.eq(msg), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+ }
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage)EasyMock.anyObject(), EasyMock.eq(context)))
+ .andAnswer(new IAnswer<Boolean>() {
+ @Override
+ public Boolean answer() throws Throwable {
+ OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
+ if (msg.getType() == OFType.BARRIER_REQUEST) {
+ barrierTime = System.currentTimeMillis();
+ }
+ return true;
+ }
+ }).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ pusher.createQueue(sw);
+ pusher.setRate(sw, LIMIT_RATE);
+
+ long beginTime = System.currentTimeMillis();
+ for (OFMessage msg : messages) {
+ boolean add_result = pusher.add(sw, msg);
+ assertTrue(add_result);
+ }
+
+ pusher.barrierAsync(sw);
+
+ try {
+ do {
+ Thread.sleep(1000);
+ } while (barrierTime == 0);
+ } catch (InterruptedException e) {
+ fail("Failed to sleep");
+ }
+
+ double measured_rate = NUM_MSG * 100 / (barrierTime - beginTime);
+ assertTrue(measured_rate < ACCEPTABLE_RATE);
+
+ for (OFMessage msg : messages) {
+ EasyMock.verify(msg);
+ }
+ EasyMock.verify(sw);
+
+ pusher.stop();
+ }
+
+ /**
+ * Test barrier message is correctly sent to a switch.
+ */
+ @Test
+ public void testBarrierMessage() {
+ beginInitMock();
+
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().atLeastOnce();
+ prepareBarrier(sw);
+ EasyMock.replay(sw);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), (OFMessage)EasyMock.anyObject(), EasyMock.eq(context)))
+ .andReturn(true).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ OFBarrierReplyFuture future = pusher.barrierAsync(sw);
+
+ assertNotNull(future);
+ pusher.stop();
+ }
+
+ /**
+ * Test FlowObject is correctly converted to message and is sent to a switch.
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAddFlow() {
+ // Code below are copied from FlowManagerTest
+
+ // instantiate required objects
+ FlowEntry flowEntry1 = new FlowEntry();
+ flowEntry1.setDpid(new Dpid(1));
+ flowEntry1.setFlowId(new FlowId(1));
+ flowEntry1.setInPort(new Port((short) 1));
+ flowEntry1.setOutPort(new Port((short) 11));
+ flowEntry1.setFlowEntryId(new FlowEntryId(1));
+ flowEntry1.setFlowEntryMatch(new FlowEntryMatch());
+ flowEntry1.setFlowEntryActions(new FlowEntryActions());
+ flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState());
+ flowEntry1.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
+
+ beginInitMock();
+
+ OFFlowMod msg = EasyMock.createMock(OFFlowMod.class);
+ EasyMock.expect(msg.setIdleTimeout(EasyMock.anyShort())).andReturn(msg);
+ EasyMock.expect(msg.setHardTimeout(EasyMock.anyShort())).andReturn(msg);
+ EasyMock.expect(msg.setPriority(EasyMock.anyShort())).andReturn(msg);
+ EasyMock.expect(msg.setBufferId(EasyMock.anyInt())).andReturn(msg);
+ EasyMock.expect(msg.setCookie(EasyMock.anyLong())).andReturn(msg);
+ EasyMock.expect(msg.setCommand(EasyMock.anyShort())).andReturn(msg);
+ EasyMock.expect(msg.setMatch(EasyMock.anyObject(OFMatch.class))).andReturn(msg);
+ EasyMock.expect(msg.setActions((List<OFAction>)EasyMock.anyObject())).andReturn(msg);
+ EasyMock.expect(msg.setLengthU(EasyMock.anyShort())).andReturn(msg);
+ EasyMock.expect(msg.setOutPort(EasyMock.anyShort())).andReturn(msg).atLeastOnce();
+ EasyMock.expect(msg.getXid()).andReturn(1).anyTimes();
+ EasyMock.expect(msg.getType()).andReturn(OFType.FLOW_MOD).anyTimes();
+ EasyMock.expect(msg.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(msg);
+
+ EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.FLOW_MOD))).andReturn(msg);
+
+ ScheduledExecutorService executor = EasyMock.createMock(ScheduledExecutorService.class);
+ EasyMock.expect(executor.schedule((Runnable)EasyMock.anyObject(), EasyMock.anyLong(),
+ (TimeUnit)EasyMock.anyObject())).andReturn(null).once();
+ EasyMock.replay(executor);
+ EasyMock.expect(threadPoolService.getScheduledExecutor()).andReturn(executor);
+
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+ EasyMock.expect(sw.getStringId()).andReturn("1").anyTimes();
+ sw.flush();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(sw);
+
+ try {
+ EasyMock.expect(damper.write(EasyMock.eq(sw), EasyMock.anyObject(OFMessage.class), EasyMock.eq(context)))
+ .andAnswer(new IAnswer<Boolean>() {
+ @Override
+ public Boolean answer() throws Throwable {
+ OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
+ assertEquals(msg.getType(), OFType.FLOW_MOD);
+ return true;
+ }
+ }).once();
+ } catch (IOException e1) {
+ fail("Failed in OFMessageDamper#write()");
+ }
+
+ endInitMock();
+ initPusher(1);
+
+ pusher.pushFlowEntry(sw, flowEntry1);
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Failed to sleep");
+ }
+
+ EasyMock.verify(sw);
+
+ pusher.stop();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void beginInitMock() {
+ context = EasyMock.createMock(FloodlightContext.class);
+ modContext = EasyMock.createMock(FloodlightModuleContext.class);
+ factory = EasyMock.createMock(BasicFactory.class);
+ damper = EasyMock.createMock(OFMessageDamper.class);
+ flProviderService = EasyMock.createMock(IFloodlightProviderService.class);
+ threadPoolService = EasyMock.createMock(IThreadPoolService.class);
+ flowService = EasyMock.createMock(IFlowService.class);
+
+ flowService.flowEntriesPushedToSwitch(EasyMock.anyObject(Collection.class));
+ EasyMock.expectLastCall().anyTimes();
+
+ EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IThreadPoolService.class)))
+ .andReturn(threadPoolService).once();
+ EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IFloodlightProviderService.class)))
+ .andReturn(flProviderService).once();
+ EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IFlowService.class)))
+ .andReturn(flowService).once();
+ flProviderService.addOFMessageListener(EasyMock.eq(OFType.BARRIER_REPLY),
+ (FlowPusher) EasyMock.anyObject());
+ EasyMock.expectLastCall().once();
+ }
+
+ private void endInitMock() {
+ EasyMock.replay(flowService);
+ EasyMock.replay(threadPoolService);
+ EasyMock.replay(flProviderService);
+ EasyMock.replay(damper);
+ EasyMock.replay(factory);
+ EasyMock.replay(modContext);
+ EasyMock.replay(context);
+ }
+
+ private void initPusher(int num_thread) {
+ pusher = new FlowPusher(num_thread);
+ pusher.init(context, modContext, factory, damper);
+ pusher.start();
+ }
+
+ private void prepareBarrier(IOFSwitch sw) {
+ OFBarrierRequest req = EasyMock.createMock(OFBarrierRequest.class);
+ req.setXid(EasyMock.anyInt());
+ EasyMock.expectLastCall().once();
+ EasyMock.expect(req.getXid()).andReturn(1).anyTimes();
+ EasyMock.expect(req.getType()).andReturn(OFType.BARRIER_REQUEST).anyTimes();
+ EasyMock.expect(req.getLength()).andReturn((short)100).anyTimes();
+ EasyMock.replay(req);
+ EasyMock.expect(factory.getMessage(EasyMock.eq(OFType.BARRIER_REQUEST))).andReturn(req);
+
+ ScheduledExecutorService executor = EasyMock.createMock(ScheduledExecutorService.class);
+ EasyMock.expect(executor.schedule((Runnable)EasyMock.anyObject(), EasyMock.anyLong(),
+ (TimeUnit)EasyMock.anyObject())).andReturn(null).once();
+ EasyMock.replay(executor);
+ EasyMock.expect(threadPoolService.getScheduledExecutor()).andReturn(executor);
+
+ EasyMock.expect(sw.getNextTransactionId()).andReturn(1);
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizerTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizerTest.java
new file mode 100644
index 0000000..5b1bbdd
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizerTest.java
@@ -0,0 +1,313 @@
+package net.onrc.onos.ofcontroller.flowprogrammer;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import io.netty.util.concurrent.Future;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.flowmanager.FlowDatabaseOperation;
+import net.onrc.onos.ofcontroller.util.FlowEntry;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFFlowMod;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFStatisticsRequest;
+import org.openflow.protocol.OFType;
+import org.openflow.protocol.statistics.OFFlowStatisticsReply;
+import org.openflow.protocol.statistics.OFStatistics;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({FlowSynchronizer.class, GraphDBOperation.class, FlowDatabaseOperation.class})
+public class FlowSynchronizerTest {
+ private FlowPusher pusher;
+ private FlowSynchronizer sync;
+ private List<Long> idAdded;
+ private List<Long> idRemoved;
+
+ @Before
+ public void setUp() throws Exception {
+ idAdded = new ArrayList<Long>();
+ idRemoved = new ArrayList<Long>();
+
+ pusher = EasyMock.createMock(FlowPusher.class);
+ pusher.add(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(OFMessage.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ OFMessage msg = (OFMessage)EasyMock.getCurrentArguments()[1];
+ if (msg.getType().equals(OFType.FLOW_MOD)) {
+ OFFlowMod fm = (OFFlowMod)msg;
+ if (fm.getCommand() == OFFlowMod.OFPFC_DELETE_STRICT) {
+ idRemoved.add(fm.getCookie());
+ }
+ }
+ return null;
+ }
+ }).anyTimes();
+ pusher.pushFlowEntry(EasyMock.anyObject(IOFSwitch.class), EasyMock.anyObject(FlowEntry.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ FlowEntry flow = (FlowEntry)EasyMock.getCurrentArguments()[1];
+ idAdded.add(flow.flowEntryId().value());
+ return null;
+ }
+ }).anyTimes();
+ EasyMock.replay(pusher);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test that synchronization doesn't affect anything in case either DB and
+ * flow table has the same entries.
+ */
+ @Test
+ public void testStable() {
+ // Create mock of flow table : flow 1
+ IOFSwitch sw = createMockSwitch(new long[] {1});
+
+ // Create mock of flow entries : flow 1
+ initMockGraph(new long[] {1});
+
+ // synchronize
+ doSynchronization(sw,100);
+
+ // check if flow is not changed
+ assertEquals(0, idAdded.size());
+ assertEquals(0, idRemoved.size());
+ }
+
+ /**
+ * Test that an flow is added in case DB has an extra FlowEntry.
+ */
+ @Test
+ public void testSingleAdd() {
+ // Create mock of flow table : null
+ IOFSwitch sw = createMockSwitch(new long[] {});
+
+ // Create mock of flow entries : flow 1
+ initMockGraph(new long[] {1});
+
+ // synchronize
+ doSynchronization(sw,100);
+
+ // check if single flow is installed
+ assertEquals(1, idAdded.size());
+ assertTrue(idAdded.contains((long)1));
+ assertEquals(0, idRemoved.size());
+ }
+
+ /**
+ * Test that an flow is deleted in case switch has an extra FlowEntry.
+ */
+ @Test
+ public void testSingleDelete() {
+ // Create mock of flow table : flow 1
+ IOFSwitch sw = createMockSwitch(new long[] {1});
+
+ // Create mock of flow entries : null
+ initMockGraph(new long[] {});
+
+ // synchronize
+ doSynchronization(sw,100);
+
+ // check if single flow is deleted
+ assertEquals(0, idAdded.size());
+ assertEquals(1, idRemoved.size());
+ assertTrue(idRemoved.contains((long)1));
+ }
+
+ /**
+ * Test that appropriate flows are added and other appropriate flows are deleted
+ * in case flows in DB are overlapping flows in switch.
+ */
+ @Test
+ public void testMixed() {
+ // Create mock of flow table : flow 1,2,3
+ IOFSwitch sw = createMockSwitch(new long[] {1,2,3});
+
+ // Create mock of flow entries : flow 2,3,4,5
+ initMockGraph(new long[] {2,3,4,5});
+
+ // synchronize
+ doSynchronization(sw,100);
+
+ // check if two flows {4,5} is installed and one flow {1} is deleted
+ assertEquals(2, idAdded.size());
+ assertTrue(idAdded.contains((long)4));
+ assertTrue(idAdded.contains((long)5));
+ assertEquals(1, idRemoved.size());
+ assertTrue(idRemoved.contains((long)1));
+ }
+
+
+ @Test
+ public void testMassive() {
+ // Create mock of flow table : flow 0-1999
+ long [] swIdList = new long [2000];
+ for (long i = 0; i < 2000; ++i) {
+ swIdList[(int)i] = i;
+ }
+ IOFSwitch sw = createMockSwitch(swIdList);
+
+ // Create mock of flow entries : flow 1500-3499
+ long [] dbIdList = new long [2000];
+ for (long i = 0; i < 2000; ++i) {
+ dbIdList[(int)i] = 1500 + i;
+ }
+ initMockGraph(dbIdList);
+
+ // synchronize
+ doSynchronization(sw, 3000);
+
+ // check if 1500 flows {2000-3499} is installed and 1500 flows {0,...,1499} is deleted
+ assertEquals(1500, idAdded.size());
+ for (long i = 2000; i < 3500; ++i) {
+ assertTrue(idAdded.contains(i));
+ }
+ assertEquals(1500, idRemoved.size());
+ for (long i = 0; i < 1500; ++i) {
+ assertTrue(idRemoved.contains(i));
+ }
+ }
+
+ /**
+ * Create mock IOFSwitch with flow table which has arbitrary flows.
+ * @param cookieList List of FlowEntry IDs switch has.
+ * @return Mock object.
+ */
+ private IOFSwitch createMockSwitch(long[] cookieList) {
+ IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
+ EasyMock.expect(sw.getId()).andReturn((long)1).anyTimes();
+
+ List<OFStatistics> stats = new ArrayList<OFStatistics>();
+ for (long cookie : cookieList) {
+ stats.add(createReply(cookie));
+ }
+
+ @SuppressWarnings("unchecked")
+ Future<List<OFStatistics>> future = EasyMock.createMock(Future.class);
+ try {
+ EasyMock.expect(future.get()).andReturn(stats).once();
+ } catch (InterruptedException e1) {
+ fail("Failed in Future#get()");
+ } catch (ExecutionException e1) {
+ fail("Failed in Future#get()");
+ }
+ EasyMock.replay(future);
+
+ try {
+ EasyMock.expect(sw.getStatistics(EasyMock.anyObject(OFStatisticsRequest.class)))
+ .andReturn(future).once();
+ } catch (IOException e) {
+ fail("Failed in IOFSwitch#getStatistics()");
+ }
+
+ EasyMock.replay(sw);
+ return sw;
+ }
+
+ /**
+ * Create single OFFlowStatisticsReply object which is actually obtained from switch.
+ * @param cookie Cookie value, which indicates ID of FlowEntry installed to switch.
+ * @return Created object.
+ */
+ private OFFlowStatisticsReply createReply(long cookie) {
+ OFFlowStatisticsReply stat = new OFFlowStatisticsReply();
+ OFMatch match = new OFMatch();
+
+ stat.setCookie(cookie);
+ stat.setMatch(match);
+ stat.setPriority((short)1);
+
+ return stat;
+ }
+
+ /**
+ * Create mock GraphDBOperation and FlowDatabaseOperation to mock DB.
+ * @param idList List of FlowEntry IDs stored in DB.
+ */
+ private void initMockGraph(long[] idList) {
+ List<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
+
+ for (long id : idList) {
+ IFlowEntry entry = EasyMock.createMock(IFlowEntry.class);
+ EasyMock.expect(entry.getFlowEntryId()).andReturn(String.valueOf(id)).anyTimes();
+ EasyMock.replay(entry);
+ flowEntryList.add(entry);
+ }
+
+ ISwitchObject swObj = EasyMock.createMock(ISwitchObject.class);
+ EasyMock.expect(swObj.getFlowEntries()).andReturn(flowEntryList).once();
+ EasyMock.replay(swObj);
+
+ GraphDBOperation mockOp = PowerMock.createMock(GraphDBOperation.class);
+ EasyMock.expect(mockOp.searchSwitch(EasyMock.anyObject(String.class))).andReturn(swObj).once();
+
+ PowerMock.mockStatic(FlowDatabaseOperation.class);
+ for (IFlowEntry entry : flowEntryList) {
+ EasyMock.expect(FlowDatabaseOperation.extractFlowEntry(EasyMock.eq(entry)))
+ .andAnswer(new IAnswer<FlowEntry>() {
+ @Override
+ public FlowEntry answer() throws Throwable {
+ IFlowEntry iflow = (IFlowEntry)EasyMock.getCurrentArguments()[0];
+ long flowEntryId = Long.valueOf(iflow.getFlowEntryId());
+
+ FlowEntry flow = EasyMock.createMock(FlowEntry.class);
+ EasyMock.expect(flow.flowEntryId()).andReturn(new FlowEntryId(flowEntryId)).anyTimes();
+ EasyMock.replay(flow);
+ return flow;
+ }
+
+ }).anyTimes();
+ EasyMock.expect(mockOp.searchFlowEntry(EasyMock.eq(new FlowEntryId(entry.getFlowEntryId()))))
+ .andReturn(entry);
+ }
+ PowerMock.replay(FlowDatabaseOperation.class);
+ EasyMock.replay(mockOp);
+
+ try {
+ PowerMock.expectNew(GraphDBOperation.class, "").andReturn(mockOp);
+ } catch (Exception e) {
+ fail("Failed to create GraphDBOperation");
+ }
+ PowerMock.replay(GraphDBOperation.class);
+ }
+
+ /**
+ * Instantiate FlowSynchronizer and sync flows.
+ * @param sw Target IOFSwitch object
+ */
+ private void doSynchronization(IOFSwitch sw, long wait) {
+ sync = new FlowSynchronizer();
+ sync.init(pusher);
+ sync.synchronize(sw);
+
+ try {
+ Thread.sleep(wait);
+ } catch (InterruptedException e) {
+ fail("Failed to sleep");
+ }
+ }
+}
diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
similarity index 97%
rename from src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
rename to src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
index 6e99acd..c3647f2 100644
--- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import static org.easymock.EasyMock.*;
@@ -35,10 +35,6 @@
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.restserver.RestApiServer;
import net.floodlightcontroller.routing.IRoutingService;
@@ -50,6 +46,10 @@
import net.floodlightcontroller.topology.ITopologyService;
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
/**
*
@@ -58,7 +58,7 @@
public class LinkDiscoveryManagerTest extends FloodlightTestCase {
private TestLinkDiscoveryManager ldm;
- protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
+ protected final static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
public class TestLinkDiscoveryManager extends LinkDiscoveryManager {
public boolean isSendLLDPsCalled = false;
diff --git a/src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java
new file mode 100644
index 0000000..09d0a00
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java
@@ -0,0 +1,242 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.Map;
+
+import org.easymock.EasyMock;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanFactory;
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+/**
+ * A class for testing the TopologyManager class.
+ * @see net.onrc.onos.ofcontroller.topology.TopologyManager
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, TopologyManager.class})
+public class TopologyManagerTest {
+ String conf;
+ private GraphDBConnection conn = null;
+ private GraphDBOperation oper = null;
+ private TitanGraph titanGraph = null;
+ private TopologyManager topologyManager = null;
+
+ /**
+ * Setup the tests.
+ */
+ @Before
+ public void setUp() throws Exception {
+ conf = "/dummy/path/to/db";
+
+ //
+ // Make mock database.
+ // Replace TitanFactory.open() to return the mock database.
+ //
+ titanGraph = TestDatabaseManager.getTestDatabase();
+ PowerMock.mockStatic(TitanFactory.class);
+ EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+ PowerMock.replay(TitanFactory.class);
+
+ // Create the connection to the database
+ conn = GraphDBConnection.getInstance(conf);
+ oper = new GraphDBOperation(conn);
+
+ // Populate the database
+ TestDatabaseManager.populateTestData(titanGraph);
+
+ // Prepare the TopologyManager instance
+ topologyManager = new TopologyManager(oper);
+ }
+
+ /**
+ * Cleanup after the tests.
+ */
+ @After
+ public void tearDown() throws Exception {
+ titanGraph.shutdown();
+ TestDatabaseManager.deleteTestDatabase();
+ }
+
+ /**
+ * Test method TopologyManager.getTopologyShortestPath()
+ *
+ * @see net.onrc.onos.ofcontroller.topology.TopologyManager#getTopologyShortestPath
+ */
+ @Test
+ public void test_getTopologyShortestPath() {
+ DataPath dataPath = null;
+ String srcDpidStr = "00:00:00:00:00:00:0a:01";
+ String dstDpidStr = "00:00:00:00:00:00:0a:06";
+ short srcPortShort = 1;
+ short dstPortShort = 1;
+
+ //
+ // Initialize the source and destination points
+ //
+ Dpid srcDpid = new Dpid(srcDpidStr);
+ Port srcPort = new Port(srcPortShort);
+ Dpid dstDpid = new Dpid(dstDpidStr);
+ Port dstPort = new Port(dstPortShort);
+ SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
+ SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+
+ //
+ // Test a valid Shortest-Path computation
+ //
+ Topology topology = topologyManager.newDatabaseTopology();
+ dataPath = topologyManager.getTopologyShortestPath(topology,
+ srcSwitchPort,
+ dstSwitchPort);
+ assertTrue(dataPath != null);
+ String dataPathSummaryStr = dataPath.dataPathSummary();
+ // System.out.println(dataPathSummaryStr);
+ String expectedResult = "1/00:00:00:00:00:00:0a:01/2;1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ assertEquals(dataPathSummaryStr, expectedResult);
+
+ // Test if we apply various Flow Path Flags
+ String expectedResult2 = "1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ String expectedResult3 = "1/00:00:00:00:00:00:0a:03/2;";
+ FlowPathFlags flowPathFlags2 = new FlowPathFlags("DISCARD_FIRST_HOP_ENTRY");
+ FlowPathFlags flowPathFlags3 = new FlowPathFlags("KEEP_ONLY_FIRST_HOP_ENTRY");
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags2);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult2);
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags3);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult3);
+
+ //
+ // Test Shortest-Path computation to non-existing destination
+ //
+ String noSuchDpidStr = "ff:ff:00:00:00:00:0a:06";
+ Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
+ SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
+ dataPath = topologyManager.getTopologyShortestPath(topology,
+ srcSwitchPort,
+ noSuchDstSwitchPort);
+ assertTrue(dataPath == null);
+
+ topologyManager.dropTopology(topology);
+ }
+
+ /**
+ * Test method TopologyManager.getDatabaseShortestPath()
+ *
+ * @see net.onrc.onos.ofcontroller.routing.TopologyManager#getDatabaseShortestPath
+ */
+ @Test
+ public void test_getDatabaseShortestPath() {
+ DataPath dataPath = null;
+ String srcDpidStr = "00:00:00:00:00:00:0a:01";
+ String dstDpidStr = "00:00:00:00:00:00:0a:06";
+ short srcPortShort = 1;
+ short dstPortShort = 1;
+
+ //
+ // Initialize the source and destination points
+ //
+ Dpid srcDpid = new Dpid(srcDpidStr);
+ Port srcPort = new Port(srcPortShort);
+ Dpid dstDpid = new Dpid(dstDpidStr);
+ Port dstPort = new Port(dstPortShort);
+ SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
+ SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+
+ //
+ // Test a valid Shortest-Path computation
+ //
+ dataPath = topologyManager.getDatabaseShortestPath(srcSwitchPort,
+ dstSwitchPort);
+ assertTrue(dataPath != null);
+ String dataPathSummaryStr = dataPath.dataPathSummary();
+ // System.out.println(dataPathSummaryStr);
+ String expectedResult = "1/00:00:00:00:00:00:0a:01/2;1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ assertEquals(dataPathSummaryStr, expectedResult);
+
+ // Test if we apply various Flow Path Flags
+ String expectedResult2 = "1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ String expectedResult3 = "1/00:00:00:00:00:00:0a:03/2;";
+ FlowPathFlags flowPathFlags2 = new FlowPathFlags("DISCARD_FIRST_HOP_ENTRY");
+ FlowPathFlags flowPathFlags3 = new FlowPathFlags("KEEP_ONLY_FIRST_HOP_ENTRY");
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags2);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult2);
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags3);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult3);
+
+ //
+ // Test Shortest-Path computation to non-existing destination
+ //
+ String noSuchDpidStr = "ff:ff:00:00:00:00:0a:06";
+ Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
+ SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
+
+ dataPath = topologyManager.getDatabaseShortestPath(srcSwitchPort,
+ noSuchDstSwitchPort);
+ assertTrue(dataPath == null);
+ }
+
+ /**
+ * Test method TopologyManager.routeExists()
+ *
+ * @see net.onrc.onos.ofcontroller.routing.TopologyManager#routeExists
+ */
+ @Test
+ public void test_routeExists() {
+ Boolean result;
+ String srcDpidStr = "00:00:00:00:00:00:0a:01";
+ String dstDpidStr = "00:00:00:00:00:00:0a:06";
+ short srcPortShort = 1;
+ short dstPortShort = 1;
+
+ //
+ // Initialize the source and destination points
+ //
+ Dpid srcDpid = new Dpid(srcDpidStr);
+ Port srcPort = new Port(srcPortShort);
+ Dpid dstDpid = new Dpid(dstDpidStr);
+ Port dstPort = new Port(dstPortShort);
+ SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
+ SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+
+ //
+ // Test a valid route
+ //
+ result = topologyManager.routeExists(srcSwitchPort, dstSwitchPort);
+ assertTrue(result == true);
+
+ //
+ // Test a non-existing route
+ //
+ String noSuchDpidStr = "ff:ff:00:00:00:00:0a:06";
+ Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
+ SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
+ result = topologyManager.routeExists(srcSwitchPort,
+ noSuchDstSwitchPort);
+ assertTrue(result != true);
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java
new file mode 100644
index 0000000..d816517
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java
@@ -0,0 +1,427 @@
+package net.onrc.onos.ofcontroller.util;
+
+import static org.junit.Assert.assertEquals;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionEnqueue;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionOutput;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetEthernetAddr;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetIPv4Addr;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetIpToS;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetTcpUdpPort;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetVlanId;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetVlanPriority;
+import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionStripVlan;
+
+import org.junit.Test;
+
+public class FlowEntryActionTest {
+
+ @Test
+ public void testSetActionOutputActionOutput(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionOutput actout = new FlowEntryAction.ActionOutput(new Port((short)42));
+ act.setActionOutput(actout);
+
+ assertEquals("action output",FlowEntryAction.ActionValues.ACTION_OUTPUT , act.actionType());
+ assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port());
+ assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionOutputPort(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionOutput(new Port((short)42));
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionOutputToController(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionOutputToController((short)0);
+
+ FlowEntryAction act_copy = new FlowEntryAction();
+ act_copy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER));
+ ;
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetVlanIdActionSetVlanId(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short)42);
+ act.setActionSetVlanId(actVlan);
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID , act.actionType());
+ assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetVlanIdShort(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetVlanId((short)42);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetVlanPriorityActionSetVlanPriority(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte)42);
+ act.setActionSetVlanPriority(actVlan);
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP , act.actionType());
+ assertEquals("vlan priority should be the same", actVlan.vlanPriority(), act.actionSetVlanPriority().vlanPriority());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetVlanPriorityByte(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetVlanPriority((byte)42);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionStripVlanActionStripVlan(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan();
+ act.setActionStripVlan(actVlan);
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_STRIP_VLAN , act.actionType());
+ assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionStripVlanBoolean(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionStripVlan(true);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr(){
+ FlowEntryAction act = new FlowEntryAction();
+ byte[] mac = { 1, 2, 3, 4, 5, 6 };
+ ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
+ act.setActionSetEthernetSrcAddr( setEth );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_SRC , act.actionType());
+ assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr());
+
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetEthernetSrcAddrMACAddress(){
+ FlowEntryAction act = new FlowEntryAction();
+ byte[] mac = { 1, 2, 3, 4, 5, 6 };
+ act.setActionSetEthernetSrcAddr(new MACAddress(mac));
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetEthernetDstAddrActionSetEthernetAddr(){
+ FlowEntryAction act = new FlowEntryAction();
+ byte[] mac = { 1, 2, 3, 4, 5, 6 };
+ ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
+ act.setActionSetEthernetDstAddr( setEth );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_DST , act.actionType());
+ assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetEthernetDstAddrMACAddress(){
+ FlowEntryAction act = new FlowEntryAction();
+ byte[] mac = { 1, 2, 3, 4, 5, 6 };
+ act.setActionSetEthernetDstAddr(new MACAddress(mac));
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+ act.setActionSetIPv4SrcAddr( setIp );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_SRC , act.actionType());
+ assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIPv4SrcAddrIPv4(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1"));
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIPv4DstAddrActionSetIPv4Addr(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+ act.setActionSetIPv4DstAddr( setIp );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_DST , act.actionType());
+ assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIPv4DstAddrIPv4(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1"));
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIpToSActionSetIpToS(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte)42);
+ act.setActionSetIpToS( setIpTos );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_TOS , act.actionType());
+ assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetIpToSByte(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetIpToS((byte)1);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
+ act.setActionSetTcpUdpSrcPort( setPorts );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_SRC , act.actionType());
+ assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetTcpUdpSrcPortShort(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetTcpUdpSrcPort((short)1);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
+ act.setActionSetTcpUdpDstPort( setPorts );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_DST , act.actionType());
+ assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionSetTcpUdpDstPortShort(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionSetTcpUdpDstPort((short)1);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionEnqueueActionEnqueue(){
+ FlowEntryAction act = new FlowEntryAction();
+ ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new Port((short)42), 1);
+ act.setActionEnqueue( enq );
+
+ assertEquals("action type",FlowEntryAction.ActionValues.ACTION_ENQUEUE , act.actionType());
+ assertEquals("port should be the same", enq.port(), act.actionEnqueue().port());
+ assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId());
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+ @Test
+ public void testSetActionEnqueuePortInt(){
+ FlowEntryAction act = new FlowEntryAction();
+ act.setActionEnqueue(new Port((short)42), 1);
+
+ FlowEntryAction act_copy = new FlowEntryAction(act);
+ FlowEntryAction act_copy2 = new FlowEntryAction(act.toString());
+
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy.toString());
+ assertEquals("toString must match between copies", act.toString(),
+ act_copy2.toString());
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryMatchTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryMatchTest.java
new file mode 100644
index 0000000..4381208
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryMatchTest.java
@@ -0,0 +1,312 @@
+package net.onrc.onos.ofcontroller.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import net.floodlightcontroller.util.MACAddress;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class FlowEntryMatchTest {
+
+ FlowEntryMatch match;
+
+ Port inport = new Port((short)1);
+ byte[] byte1 = { 1, 2, 3, 4, 5, 6 };
+ byte[] byte2 = { 6, 5, 4, 3, 2, 1 };
+ MACAddress mac1 = new MACAddress(byte1);
+ MACAddress mac2 = new MACAddress(byte2);
+ Short ether = Short.valueOf((short)2);
+ Short vlanid = Short.valueOf((short)3);
+ Byte vlanprio = Byte.valueOf((byte)4);
+ IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
+ IPv4Net ip2 = new IPv4Net("127.0.0.2/32");
+ Byte ipproto = Byte.valueOf((byte)5);
+ Byte ipToS = Byte.valueOf((byte)6);
+ Short tport1 = Short.valueOf((short)7);
+ Short tport2 = Short.valueOf((short)8);
+
+ @Before
+ public void setUp() throws Exception{
+ match = new FlowEntryMatch();
+ match.enableInPort( inport);
+ match.enableSrcMac( mac1 );
+ match.enableDstMac( mac2 );
+ match.enableEthernetFrameType( ether );
+ match.enableVlanId( vlanid );
+ match.enableVlanPriority( vlanprio );
+ match.enableSrcIPv4Net( ip1 );
+ match.enableDstIPv4Net( ip2 );
+ match.enableIpProto( ipproto );
+ match.enableIpToS( ipToS );
+ match.enableSrcTcpUdpPort( tport1 );
+ match.enableDstTcpUdpPort( tport2 );
+ }
+
+ @Test
+ public void testFlowEntryMatch(){
+ FlowEntryMatch def = new FlowEntryMatch();
+
+ assertEquals("default null", null, def.inPort() );
+ assertEquals("default null", null, def.srcMac() );
+ assertEquals("default null", null, def.dstMac() );
+ assertEquals("default null", null, def.ethernetFrameType() );
+ assertEquals("default null", null, def.vlanId() );
+ assertEquals("default null", null, def.vlanPriority() );
+ assertEquals("default null", null, def.srcIPv4Net() );
+ assertEquals("default null", null, def.dstIPv4Net() );
+ assertEquals("default null", null, def.ipProto() );
+ assertEquals("default null", null, def.ipToS() );
+ assertEquals("default null", null, def.srcTcpUdpPort() );
+ assertEquals("default null", null, def.dstTcpUdpPort() );
+ }
+
+ @Test
+ public void testFlowEntryMatchFlowEntryMatch(){
+ FlowEntryMatch def_base = new FlowEntryMatch();
+ FlowEntryMatch def = new FlowEntryMatch(def_base);
+
+ assertEquals("default null", null, def.inPort() );
+ assertEquals("default null", null, def.srcMac() );
+ assertEquals("default null", null, def.dstMac() );
+ assertEquals("default null", null, def.ethernetFrameType() );
+ assertEquals("default null", null, def.vlanId() );
+ assertEquals("default null", null, def.vlanPriority() );
+ assertEquals("default null", null, def.srcIPv4Net() );
+ assertEquals("default null", null, def.dstIPv4Net() );
+ assertEquals("default null", null, def.ipProto() );
+ assertEquals("default null", null, def.ipToS() );
+ assertEquals("default null", null, def.srcTcpUdpPort() );
+ assertEquals("default null", null, def.dstTcpUdpPort() );
+
+ FlowEntryMatch copy = new FlowEntryMatch( match );
+
+ assertEquals("inport", inport, copy.inPort() );
+ assertEquals("mac1", mac1, copy.srcMac() );
+ assertEquals("mac2", mac2, copy.dstMac() );
+ assertEquals("ether", ether, copy.ethernetFrameType() );
+ assertEquals("vlan id", vlanid, copy.vlanId() );
+ assertEquals("vlan prio", vlanprio, copy.vlanPriority() );
+ assertEquals("ip1", ip1, copy.srcIPv4Net() );
+ assertEquals("ip2", ip2, copy.dstIPv4Net() );
+ assertEquals("ip proto", ipproto, copy.ipProto() );
+ assertEquals("tos", ipToS, copy.ipToS() );
+ assertEquals("src port", tport1, copy.srcTcpUdpPort() );
+ assertEquals("dst port", tport2, copy.dstTcpUdpPort() );
+
+ }
+
+ @Test
+ public void testInPort(){
+ assertEquals("inport", inport, match.inPort() );
+ }
+
+ @Test
+ public void testDisableInPort(){
+ match.disableInPort();
+ assertEquals("inport", null, match.inPort() );
+ assertFalse( match.matchInPort() );
+ }
+
+ @Test
+ public void testMatchInPort(){
+ assertTrue( match.matchInPort() );
+ }
+
+ @Test
+ public void testSrcMac(){
+ assertEquals("mac1", mac1, match.srcMac() );
+ }
+
+ @Test
+ public void testDisableSrcMac(){
+ match.disableSrcMac();
+ assertEquals("srcMac", null, match.srcMac() );
+ assertFalse( match.matchSrcMac() );
+ }
+
+ @Test
+ public void testMatchSrcMac(){
+ assertTrue( match.matchSrcMac() );
+ }
+
+ @Test
+ public void testDstMac(){
+ assertEquals("mac2", mac2, match.dstMac() );
+ }
+
+ @Test
+ public void testDisableDstMac(){
+ match.disableDstMac();
+ assertEquals("dstMac", null, match.dstMac() );
+ assertFalse( match.matchDstMac() );
+ }
+
+ @Test
+ public void testMatchDstMac(){
+ assertTrue( match.matchDstMac() );
+ }
+
+ @Test
+ public void testEthernetFrameType(){
+ assertEquals("ether", ether, match.ethernetFrameType() );
+ }
+
+ @Test
+ public void testDisableEthernetFrameType(){
+ match.disableEthernetFrameType();
+ assertEquals("ethernetFrameType", null, match.ethernetFrameType() );
+ assertFalse( match.matchEthernetFrameType() );
+ }
+
+ @Test
+ public void testMatchEthernetFrameType(){
+ assertTrue( match.matchEthernetFrameType() );
+ }
+
+ @Test
+ public void testVlanId(){
+ assertEquals("vlan id", vlanid, match.vlanId() );
+ }
+
+ @Test
+ public void testDisableVlanId(){
+ match.disableVlanId();
+ assertEquals("vlanId", null, match.vlanId() );
+ assertFalse( match.matchVlanId() );
+ }
+
+ @Test
+ public void testMatchVlanId(){
+ assertTrue( match.matchVlanId() );
+ }
+
+ @Test
+ public void testVlanPriority(){
+ assertEquals("vlan prio", vlanprio, match.vlanPriority() );
+ }
+
+ @Test
+ public void testDisableVlanPriority(){
+ match.disableVlanPriority();
+ assertEquals("vlanPriority", null, match.vlanPriority() );
+ assertFalse( match.matchVlanPriority() );
+ }
+
+ @Test
+ public void testMatchVlanPriority(){
+ assertTrue( match.matchVlanPriority() );
+ }
+
+ @Test
+ public void testSrcIPv4Net(){
+ assertEquals("ip1", ip1, match.srcIPv4Net() );
+ }
+
+ @Test
+ public void testDisableSrcIPv4Net(){
+ match.disableSrcIPv4Net();
+ assertEquals("srcIPv4Net", null, match.srcIPv4Net() );
+ assertFalse( match.matchSrcIPv4Net() );
+ }
+
+ @Test
+ public void testMatchSrcIPv4Net(){
+ assertTrue( match.matchSrcIPv4Net() );
+ }
+
+ @Test
+ public void testDstIPv4Net(){
+ assertEquals("ip2", ip2, match.dstIPv4Net() );
+ }
+
+ @Test
+ public void testDisableDstIPv4Net(){
+ match.disableDstIPv4Net();
+ assertEquals("dstIPv4Net", null, match.dstIPv4Net() );
+ assertFalse( match.matchDstIPv4Net() );
+ }
+
+ @Test
+ public void testMatchDstIPv4Net(){
+ assertTrue( match.matchDstIPv4Net() );
+ }
+
+ @Test
+ public void testIpProto(){
+ assertEquals("ip proto", ipproto, match.ipProto() );
+ }
+
+ @Test
+ public void testDisableIpProto(){
+ match.disableIpProto();
+ assertEquals("ipProto", null, match.ipProto() );
+ assertFalse( match.matchIpProto() );
+ }
+
+ @Test
+ public void testMatchIpProto(){
+ assertTrue( match.matchIpProto() );
+ }
+
+ @Test
+ public void testIpToS(){
+ assertEquals("tos", ipToS, match.ipToS() );
+ }
+
+ @Test
+ public void testDisableIpToS(){
+ match.disableIpToS();
+ assertEquals("ipToS", null, match.ipToS() );
+ assertFalse( match.matchIpToS() );
+ }
+
+ @Test
+ public void testMatchIpToS(){
+ assertTrue( match.matchIpToS() );
+ }
+
+ @Test
+ public void testSrcTcpUdpPort(){
+ assertEquals("src port", tport1, match.srcTcpUdpPort() );
+ }
+
+ @Test
+ public void testDisableSrcTcpUdpPort(){
+ match.disableSrcTcpUdpPort();
+ assertEquals("srcTcpUdpPort", null, match.srcTcpUdpPort() );
+ assertFalse( match.matchSrcTcpUdpPort() );
+ }
+
+ @Test
+ public void testMatchSrcTcpUdpPort(){
+ assertTrue( match.matchSrcTcpUdpPort() );
+ }
+
+ @Test
+ public void testDstTcpUdpPort(){
+ assertEquals("dst port", tport2, match.dstTcpUdpPort() );
+ }
+
+ @Test
+ public void testDisableDstTcpUdpPort(){
+ match.disableDstTcpUdpPort();
+ assertEquals("dstTcpUdpPort", null, match.dstTcpUdpPort() );
+ assertFalse( match.matchDstTcpUdpPort() );
+ }
+
+ @Test
+ public void testMatchDstTcpUdpPort(){
+ assertTrue( match.matchDstTcpUdpPort() );
+ }
+
+ @Test
+ public void testToString(){
+ FlowEntryMatch def = new FlowEntryMatch();
+ assertEquals("match default", def.toString(), "[]");
+
+ assertEquals("match set", match.toString(), "[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8]");
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java
new file mode 100644
index 0000000..fc17178
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java
@@ -0,0 +1,244 @@
+package net.onrc.onos.ofcontroller.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import net.floodlightcontroller.util.MACAddress;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class FlowEntryTest {
+
+ FlowEntry entry;
+
+ FlowId flowId = new FlowId(0x1234);
+ FlowEntryId flowEntryId = new FlowEntryId(0x5678);
+ FlowEntryMatch match;
+ FlowEntryActions actions;
+
+ Dpid dpid = new Dpid(0xCAFE);
+
+ Port inport = new Port((short)1);
+ byte[] byte1 = { 1, 2, 3, 4, 5, 6 };
+ byte[] byte2 = { 6, 5, 4, 3, 2, 1 };
+ MACAddress mac1 = new MACAddress(byte1);
+ MACAddress mac2 = new MACAddress(byte2);
+ Short ether = Short.valueOf((short)2);
+ Short vlanid = Short.valueOf((short)3);
+ Byte vlanprio = Byte.valueOf((byte)4);
+ IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
+ IPv4Net ip2 = new IPv4Net( new IPv4("127.0.0.2"), (short)32);
+ IPv4 ipaddr1 = new IPv4("127.0.0.3");
+ IPv4 ipaddr2 = new IPv4("127.0.0.4");
+ Byte ipproto = Byte.valueOf((byte)5);
+ Byte ipToS = Byte.valueOf((byte)6);
+ Short tport1 = Short.valueOf((short)7);
+ Short tport2 = Short.valueOf((short)8);
+ Port outport = new Port((short)9);
+ Port queueport = new Port((short)10);
+ int queueId = 11;
+
+ FlowEntryErrorState errorState = new FlowEntryErrorState( (short)12, (short)13);
+
+
+ @Before
+ public void setUp() throws Exception{
+ entry = new FlowEntry();
+
+ flowId = new FlowId("0x1234");
+ entry.setFlowId( flowId );
+
+ flowEntryId = new FlowEntryId("0x5678");
+ entry.setFlowEntryId(flowEntryId);
+
+ dpid = new Dpid("CA:FE");
+ entry.setDpid( dpid );
+
+ entry.setInPort( inport );
+ entry.setOutPort( outport );
+
+ match = new FlowEntryMatch();
+ match.enableInPort( inport);
+ match.enableSrcMac( mac1 );
+ match.enableDstMac( mac2 );
+ match.enableEthernetFrameType( ether );
+ match.enableVlanId( vlanid );
+ match.enableVlanPriority( vlanprio );
+ match.enableSrcIPv4Net( ip1 );
+ match.enableDstIPv4Net( ip2 );
+ match.enableIpProto( ipproto );
+ match.enableIpToS( ipToS );
+ match.enableSrcTcpUdpPort( tport1 );
+ match.enableDstTcpUdpPort( tport2 );
+
+ entry.setFlowEntryMatch( match );
+
+ FlowEntryAction action = null;
+ actions = entry.flowEntryActions();
+
+ action = new FlowEntryAction();
+ action.setActionOutput(outport);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionOutputToController((short)0);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetVlanId(vlanid);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetVlanPriority(vlanprio);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionStripVlan(true);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetEthernetSrcAddr(mac1);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetEthernetDstAddr(mac2);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIPv4SrcAddr(ipaddr1);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIPv4DstAddr(ipaddr2);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetIpToS(ipToS);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpSrcPort(tport1);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpDstPort(tport2);
+ actions.addAction(action);
+
+ action = new FlowEntryAction();
+ action.setActionEnqueue(queueport, queueId);
+ actions.addAction(action);
+
+ entry.setFlowEntryUserState( FlowEntryUserState.FE_USER_ADD );
+ entry.setFlowEntrySwitchState( FlowEntrySwitchState.FE_SWITCH_UPDATED );
+ entry.setFlowEntryErrorState( errorState );
+
+ }
+
+ @Test
+ public void testFlowEntry(){
+ FlowEntry e = new FlowEntry();
+
+ assertTrue( e.flowEntryActions().isEmpty() );
+ assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_UNKNOWN, e.flowEntryUserState() );
+ assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UNKNOWN, e.flowEntrySwitchState() );
+ }
+
+ @Test
+ public void testFlowId(){
+ assertEquals("flowId", flowId, entry.flowId() );
+ }
+
+ @Test
+ public void testIsValidFlowId(){
+ FlowEntry e = new FlowEntry();
+
+ // Test a Flow Entry with empty Flow ID
+ assertEquals("isValidFlowId", false, e.isValidFlowId() );
+
+ // Test a Flow Entry with invalid Flow ID
+ e.setFlowId(new FlowId());
+ assertEquals("isValidFlowId", false, e.isValidFlowId() );
+
+ // Test a Flow Entry with valid Flow ID
+ e.setFlowId(new FlowId(0x1));
+ assertEquals("isValidFlowId", true, e.isValidFlowId() );
+ assertEquals("isValidFlowId", true, entry.isValidFlowId() );
+ }
+
+ @Test
+ public void testFlowEntryId(){
+ assertEquals("flowEntryId", flowEntryId, entry.flowEntryId() );
+ }
+
+ @Test
+ public void testIsValidFlowEntryId(){
+ FlowEntry e = new FlowEntry();
+
+ // Test a Flow Entry with empty Flow Entry ID
+ assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId() );
+
+ // Test a Flow Entry with invalid Flow Entry ID
+ e.setFlowEntryId(new FlowEntryId());
+ assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId() );
+
+ // Test a Flow Entry with valid Flow Entry ID
+ e.setFlowEntryId(new FlowEntryId(0x1));
+ assertEquals("isValidFlowEntryId", true, e.isValidFlowEntryId() );
+ assertEquals("isValidFlowEntryId", true, entry.isValidFlowEntryId() );
+ }
+
+ @Test
+ public void testFlowEntryMatch(){
+ assertEquals("flowEntryMatch", match, entry.flowEntryMatch() );
+ }
+
+ @Test
+ public void testFlowEntryActions(){
+ assertEquals("flowEntryActions", actions, entry.flowEntryActions() );
+ }
+
+ @Test
+ public void testSetFlowEntryActions(){
+ FlowEntryActions actions = new FlowEntryActions();
+ entry.setFlowEntryActions( actions );
+ assertEquals("flowEntryActions", actions, entry.flowEntryActions() );
+ }
+
+ @Test
+ public void testDpid(){
+ assertEquals("dpid", dpid, entry.dpid() );
+ }
+
+ @Test
+ public void testInPort(){
+ assertEquals("inPort", inport, entry.inPort() );
+ }
+
+ @Test
+ public void testOutPort(){
+ assertEquals("outPort", outport, entry.outPort() );
+ }
+
+ @Test
+ public void testFlowEntryUserState(){
+ assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_ADD, entry.flowEntryUserState() );
+ }
+
+ @Test
+ public void testFlowEntrySwitchState(){
+ assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UPDATED, entry.flowEntrySwitchState() );
+ }
+
+ @Test
+ public void testFlowEntryErrorState(){
+ assertEquals("flowEntryErrorState", errorState, entry.flowEntryErrorState() );
+ }
+
+ @Test
+ public void testToString(){
+ FlowEntry def = new FlowEntry();
+ assertEquals("toString", def.toString(), "[ flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN flowEntrySwitchState=FE_SWITCH_UNKNOWN]" );
+ assertEquals("toString", entry.toString(), "[flowEntryId=0x5678 flowId=0x1234 flowEntryMatch=[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8] flowEntryActions=[[type=ACTION_OUTPUT action=[port=9 maxLen=0]];[type=ACTION_OUTPUT action=[port=-3 maxLen=0]];[type=ACTION_SET_VLAN_VID action=[vlanId=3]];[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];[type=ACTION_STRIP_VLAN action=[stripVlan=true]];[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];[type=ACTION_SET_NW_TOS action=[ipToS=6]];[type=ACTION_SET_TP_SRC action=[port=7]];[type=ACTION_SET_TP_DST action=[port=8]];[type=ACTION_ENQUEUE action=[port=10 queueId=11]];] dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9 flowEntryUserState=FE_USER_ADD flowEntrySwitchState=FE_SWITCH_UPDATED flowEntryErrorState=[type=12 code=13]]" );
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
new file mode 100644
index 0000000..bd42ac8
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
@@ -0,0 +1,205 @@
+package net.onrc.onos.ofcontroller.util;
+
+import static org.junit.Assert.*;
+import net.onrc.onos.ofcontroller.core.internal.TestableGraphDBOperation.TestFlowEntry;
+import net.onrc.onos.ofcontroller.core.internal.TestableGraphDBOperation.TestFlowPath;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class FlowPathTest {
+
+ FlowPath flowPath;
+
+ @Before
+ public void setUp() throws Exception{
+ TestFlowPath iFlowPath = new TestFlowPath();
+ iFlowPath.setFlowIdForTest("0x1234");
+ iFlowPath.setInstallerIdForTest("installerId");
+ iFlowPath.setFlowPathTypeForTest("FP_TYPE_SHORTEST_PATH");
+ iFlowPath.setFlowPathUserStateForTest("FP_USER_ADD");
+ iFlowPath.setFlowPathFlagsForTest(0L);
+ iFlowPath.setSrcSwForTest("CA:FE");
+ iFlowPath.setSrcPortForTest((short)1);
+ iFlowPath.setDstSwForTest("BA:BE");
+ iFlowPath.setDstPortForTest((short)2);
+
+ iFlowPath.setActionsForTest("[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]");
+
+ TestFlowEntry iFlowEntry = new TestFlowEntry();
+ iFlowEntry.setEntryIdForTest("0x14");
+ iFlowEntry.setDpidForTest("BE:EF");
+ iFlowEntry.setActionsForTest("[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];]");
+ iFlowEntry.setUserStateForTest("FE_USER_MODIFY");
+ iFlowEntry.setSwitchStateForTest("FE_SWITCH_UPDATE_IN_PROGRESS");
+ iFlowPath.addFlowEntryForTest(iFlowEntry);
+
+ flowPath = new FlowPath(iFlowPath);
+ }
+
+ @Test
+ public void testFlowPath(){
+ FlowPath flowPath = new FlowPath();
+ assertTrue ( flowPath.flowPathType() == FlowPathType.FP_TYPE_UNKNOWN);
+ assertTrue ( flowPath.flowPathUserState() == FlowPathUserState.FP_USER_UNKNOWN);
+ assertFalse( flowPath.flowPathFlags().isDiscardFirstHopEntry() );
+ assertFalse( flowPath.flowPathFlags().isKeepOnlyFirstHopEntry() );
+ assertTrue( flowPath.flowEntryActions().isEmpty() );
+ }
+
+ @Test
+ public void testFlowPathIFlowPath(){
+ TestFlowPath iFlowPath = new TestFlowPath();
+ iFlowPath.setFlowIdForTest("0x1234");
+ iFlowPath.setInstallerIdForTest("installerId");
+ iFlowPath.setFlowPathTypeForTest("FP_TYPE_SHORTEST_PATH");
+ iFlowPath.setFlowPathUserStateForTest("FP_USER_ADD");
+ iFlowPath.setFlowPathFlagsForTest(0L);
+ iFlowPath.setSrcSwForTest("CA:FE");
+ iFlowPath.setSrcPortForTest((short)1);
+ iFlowPath.setDstSwForTest("BA:BE");
+ iFlowPath.setDstPortForTest((short)2);
+
+ iFlowPath.setMatchSrcMacForTest("01:02:03:04:05:06");
+ iFlowPath.setMatchDstMacForTest("06:05:04:03:02:01");
+ iFlowPath.setMatchEthernetFrameTypeForTest((short)3);
+ iFlowPath.setMatchVlanIdForTest((short)4);
+ iFlowPath.setMatchVlanPriorityForTest((byte)5);
+ iFlowPath.setMatchSrcIpaddrForTest("127.0.0.1/32");
+ iFlowPath.setMatchDstIpaddrForTest("127.0.0.2/32");
+ iFlowPath.setMatchIpProtoForTest((byte)6);
+ iFlowPath.setMatchIpToSForTest((byte)7);
+ iFlowPath.setMatchSrcTcpUdpPortForTest((short)8);
+ iFlowPath.setMatchDstTcpUdpPortForTest((short)9);
+
+ iFlowPath.setActionsForTest("[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]");
+
+ TestFlowEntry iFlowEntry = new TestFlowEntry();
+ iFlowEntry.setEntryIdForTest("0x14");
+ iFlowEntry.setDpidForTest("BE:EF");
+ iFlowEntry.setMatchInPortForTest((short)15);
+ iFlowEntry.setMatchSrcMacForTest("11:22:33:44:55:66");
+ iFlowEntry.setMatchDstMacForTest("66:55:44:33:22:11");
+ iFlowEntry.setMatchEtherFrameTypeForTest((short)16);
+ iFlowEntry.setMatchVlanIdForTest((short)17);
+ iFlowEntry.setMatchVlanPriorityForTest((byte)18);
+ iFlowEntry.setMatchSrcIpaddrForTest("127.0.0.3/32");
+ iFlowEntry.setMatchDstIpaddrForTest("127.0.0.4/32");
+ iFlowEntry.setMatchIpProtoForTest((byte)19);
+ iFlowEntry.setMatchIpToSForTest((byte)20);
+ iFlowEntry.setMatchSrcTcpUdpPortForTest((short)21);
+ iFlowEntry.setMatchDstTcpUdpPortForTest((short)22);
+ iFlowEntry.setActionsForTest("[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];]");
+ iFlowEntry.setUserStateForTest("FE_USER_MODIFY");
+ iFlowEntry.setSwitchStateForTest("FE_SWITCH_UPDATE_IN_PROGRESS");
+ iFlowPath.addFlowEntryForTest(iFlowEntry);
+
+ FlowPath flowPath = new FlowPath(iFlowPath);
+ assertEquals(flowPath.flowId().value(), 0x1234);
+ assertEquals(flowPath.installerId().value(), "installerId");
+ assertEquals(flowPath.flowPathType(), FlowPathType.FP_TYPE_SHORTEST_PATH);
+ assertEquals(flowPath.flowPathUserState(), FlowPathUserState.FP_USER_ADD);
+ assertEquals(flowPath.flowPathFlags().flags(), 0);
+ assertEquals(flowPath.dataPath().srcPort().dpid().value(), 0xCAFE);
+ assertEquals(flowPath.dataPath().srcPort().port().value(), 1);
+ assertEquals(flowPath.dataPath().dstPort().dpid().value(), 0xBABE);
+ assertEquals(flowPath.dataPath().dstPort().port().value(), 2);
+
+ assertEquals(flowPath.flowEntryMatch().srcMac().toString(), "01:02:03:04:05:06");
+ assertEquals(flowPath.flowEntryMatch().dstMac().toString(), "06:05:04:03:02:01");
+ assertEquals(flowPath.flowEntryMatch().ethernetFrameType().shortValue(), 3);
+ assertEquals(flowPath.flowEntryMatch().vlanId().shortValue(), 4);
+ assertEquals(flowPath.flowEntryMatch().vlanPriority().shortValue(), 5);
+ assertEquals(flowPath.flowEntryMatch().srcIPv4Net().address().toString(), "127.0.0.1");
+ assertEquals(flowPath.flowEntryMatch().srcIPv4Net().prefixLen() , 32);
+ assertEquals(flowPath.flowEntryMatch().dstIPv4Net().address().toString(), "127.0.0.2");
+ assertEquals(flowPath.flowEntryMatch().dstIPv4Net().prefixLen() , 32);
+ assertEquals(flowPath.flowEntryMatch().ipProto().byteValue(), 6);
+ assertEquals(flowPath.flowEntryMatch().ipToS().byteValue(), 7);
+ assertEquals(flowPath.flowEntryMatch().srcTcpUdpPort().shortValue(), 8);
+ assertEquals(flowPath.flowEntryMatch().dstTcpUdpPort().shortValue(), 9);
+
+ assertEquals(flowPath.flowEntryActions().toString(),"[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]");
+
+ assertEquals(0x14, flowPath.dataPath().flowEntries().get(0).flowEntryId().value() );
+ assertEquals(0xBEEF, flowPath.dataPath().flowEntries().get(0).dpid().value() );
+ assertEquals(15, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().inPort().value() );
+ assertEquals("11:22:33:44:55:66", flowPath.dataPath().flowEntries().get(0).flowEntryMatch().srcMac().toString());
+ assertEquals("66:55:44:33:22:11", flowPath.dataPath().flowEntries().get(0).flowEntryMatch().dstMac().toString());
+ assertEquals(16, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().ethernetFrameType().shortValue());
+ assertEquals(17, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().vlanId().shortValue());
+ assertEquals(18, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().vlanPriority().byteValue());
+ assertEquals("127.0.0.3", flowPath.dataPath().flowEntries().get(0).flowEntryMatch().srcIPv4Net().address().toString());
+ assertEquals(32, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().srcIPv4Net().prefixLen());
+ assertEquals("127.0.0.4", flowPath.dataPath().flowEntries().get(0).flowEntryMatch().dstIPv4Net().address().toString());
+ assertEquals(32, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().dstIPv4Net().prefixLen());
+ assertEquals(19, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().ipProto().byteValue());
+ assertEquals(20, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().ipToS().byteValue());
+ assertEquals(21, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().srcTcpUdpPort().shortValue());
+ assertEquals(22, flowPath.dataPath().flowEntries().get(0).flowEntryMatch().dstTcpUdpPort().shortValue());
+ assertEquals("[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];]", flowPath.dataPath().flowEntries().get(0).flowEntryActions().toString());
+ assertEquals("FE_USER_MODIFY", flowPath.dataPath().flowEntries().get(0).flowEntryUserState().toString());
+ assertEquals("FE_SWITCH_UPDATE_IN_PROGRESS", flowPath.dataPath().flowEntries().get(0).flowEntrySwitchState().toString());
+ }
+
+ @Test
+ public void testSetFlowPathType(){
+ FlowPath flowPath = new FlowPath();
+ FlowPathType type = FlowPathType.FP_TYPE_SHORTEST_PATH;
+ flowPath.setFlowPathType( type );
+ assertTrue( flowPath.flowPathType() == FlowPathType.FP_TYPE_SHORTEST_PATH );
+ }
+
+ @Test
+ public void testSetFlowPathUserState(){
+ FlowPath flowPath = new FlowPath();
+ FlowPathUserState state = FlowPathUserState.FP_USER_ADD;
+ flowPath.setFlowPathUserState( state );
+ assertTrue( flowPath.flowPathUserState() == FlowPathUserState.FP_USER_ADD );
+ }
+
+ @Test
+ public void testFlowPathFlags(){
+ FlowPath flowPath = new FlowPath();
+ FlowPathFlags flags = new FlowPathFlags();
+ flags.setFlags(0);
+ flowPath.setFlowPathFlags( flags );
+ assertFalse( flowPath.flowPathFlags().isDiscardFirstHopEntry() );
+ assertFalse( flowPath.flowPathFlags().isKeepOnlyFirstHopEntry() );
+ }
+
+ @Test
+ public void testSetFlowPathFlags(){
+ FlowPath flowPath = new FlowPath();
+ FlowPathFlags flags = new FlowPathFlags("DISCARD_FIRST_HOP_ENTRY");
+ flags.setFlagsStr("KEEP_ONLY_FIRST_HOP_ENTRY");
+ flowPath.setFlowPathFlags( flags );
+ assertFalse( flowPath.flowPathFlags().isDiscardFirstHopEntry() );
+ assertTrue( flowPath.flowPathFlags().isKeepOnlyFirstHopEntry() );
+ }
+
+ @Test
+ public void testSetDataPath(){
+ FlowPath flowPath = new FlowPath();
+ DataPath dataPath = new DataPath();
+ flowPath.setDataPath( dataPath );
+ assertEquals(flowPath.dataPath(), dataPath );
+ }
+
+ @Test
+ public void testToString(){
+
+ assertEquals("[flowId=0x1234 installerId=installerId flowPathType=FP_TYPE_SHORTEST_PATH flowPathUserState=FP_USER_ADD flowPathFlags=[flags=] dataPath=[src=00:00:00:00:00:00:ca:fe/1 flowEntry=[flowEntryId=0x14 flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];] dpid=00:00:00:00:00:00:be:ef flowEntryUserState=FE_USER_MODIFY flowEntrySwitchState=FE_SWITCH_UPDATE_IN_PROGRESS] dst=00:00:00:00:00:00:ba:be/2] flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]]", flowPath.toString());
+ }
+
+ @Test
+ public void testCompareTo(){
+ FlowPath flowPath1 = new FlowPath();
+ flowPath1.setFlowId( new FlowId(1));
+ FlowPath flowPath2 = new FlowPath();
+ flowPath2.setFlowId( new FlowId(2));
+
+ assertTrue( flowPath1.compareTo(flowPath2) < 0);
+ }
+
+}
diff --git a/src/test/java/net/onrc/onos/registry/controller/StandaloneRegistryTest.java b/src/test/java/net/onrc/onos/registry/controller/StandaloneRegistryTest.java
new file mode 100644
index 0000000..7c4a1a0
--- /dev/null
+++ b/src/test/java/net/onrc/onos/registry/controller/StandaloneRegistryTest.java
@@ -0,0 +1,461 @@
+package net.onrc.onos.registry.controller;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openflow.util.HexString;
+
+/**
+ * Unit test for {@link StandaloneRegistry}.
+ * @author Naoki Shiota
+ *
+ */
+public class StandaloneRegistryTest {
+ protected static final long TIMEOUT_MSEC = 1000;
+
+ protected StandaloneRegistry registry;
+
+ /**
+ * Implementation of {@link ControlChangeCallback} which defines callback interfaces called by Registry.
+ * This class remembers past callback parameters and provides methods to access them.
+ * This class also provides CountDownLatch so one can wait until the callback be called
+ * specific times (specified by constructor parameter). Particularly, the first time callback
+ * called is supposed for registration, this class has an independent latch to wait for
+ * the first callback.
+ * @author Naoki Shiota
+ */
+ public static class LoggingCallback implements ControlChangeCallback {
+ private LinkedList<Long> dpidsCalledback = new LinkedList<Long>();
+ private LinkedList<Boolean> controlsCalledback = new LinkedList<Boolean>();
+ private CountDownLatch lock = null, registerLock = null;;
+
+ /**
+ * Constructor with number of times callback to be called.
+ * @param numberToCall Number of times expected callback to be called
+ */
+ public LoggingCallback(int numberToCall) {
+ lock = new CountDownLatch(numberToCall);
+ registerLock = new CountDownLatch(1);
+ }
+
+ /**
+ * Wait until registration is finished (callback is called for the first time).
+ * @throws InterruptedException
+ */
+ public void waitForRegistration() throws InterruptedException {
+ registerLock.await();
+ }
+
+ /**
+ * Wait for registration specifying timeout.
+ * @param msec Milliseconds to timeout
+ * @throws InterruptedException
+ */
+ public void waitForRegistration(long msec) throws InterruptedException {
+ registerLock.await(msec, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Wait until callback is called specific times.
+ * @throws InterruptedException
+ */
+ public void waitUntilCalled() throws InterruptedException {
+ lock.await();
+ }
+
+ /**
+ * Wait until callback is called specific times, specifying timeout.
+ * @param msec Milliseconds to timeout
+ * @throws InterruptedException
+ */
+ public void waitUntilCalled(long msec) throws InterruptedException {
+ lock.await(msec, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Get DPID parameter given by specific callback time.
+ * @param index Specify which time to get parameter
+ * @return DPID value by number.
+ */
+ public Long getDpid(int index) { return dpidsCalledback.get(index); }
+
+ /**
+ * Get hasControl parameter given by specific callback time.
+ * @param index Specify which time to get parameter
+ * @return hasControl value
+ */
+ public Boolean getControl(int index) { return controlsCalledback.get(index); }
+
+ /**
+ * Get DPID parameter given by latest call.
+ * @return DPID value by number
+ */
+ public Long getLatestDpid() { return dpidsCalledback.peekLast(); }
+
+ /**
+ * Get hasControl parameter given by latest call
+ * @return hasControl value
+ */
+ public Boolean getLatestControl() { return controlsCalledback.peekLast(); }
+
+ @Override
+ public void controlChanged(long dpid, boolean hasControl) {
+ dpidsCalledback.addLast(dpid);
+ controlsCalledback.addLast(hasControl);
+
+ lock.countDown();
+ registerLock.countDown();
+ }
+ };
+
+ @Before
+ public void setUp() throws Exception {
+ FloodlightModuleContext fmc = new FloodlightModuleContext();
+ registry = new StandaloneRegistry();
+ registry.init(fmc);
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#registerController(String)} can run without error.
+ */
+ @Test
+ public void testRegisterController() {
+ String controllerIdToRegister = "test";
+ try {
+ registry.registerController(controllerIdToRegister);
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ // Register Controller ID doubly
+ try {
+ registry.registerController(controllerIdToRegister);
+ fail("Double registration goes through without exception");
+ } catch (RegistryException e) {
+ // expected behavior
+ }
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#getControllerId()} can return correct ID.
+ * @throws RegistryException
+ */
+ @Test
+ public void testGetControllerId() throws RegistryException {
+ String controllerIdToRegister = "test";
+
+ // try before controller is registered
+ String controllerId = registry.getControllerId();
+ assertNull(controllerId);
+
+ // register
+ registry.registerController(controllerIdToRegister);
+
+ // call getControllerId and verify
+ controllerId = registry.getControllerId();
+ assertNotNull(controllerId);
+ assertEquals(controllerIdToRegister, controllerId);
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#getAllControllers()} can return correct list of controllers.
+ * @throws RegistryException
+ */
+ @Test
+ public void testGetAllControllers() throws RegistryException {
+ String controllerIdToRegister = "test";
+
+ // Test before register controller
+ try {
+ Collection<String> ctrls = registry.getAllControllers();
+ assertFalse(ctrls.contains(controllerIdToRegister));
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ // register
+ registry.registerController(controllerIdToRegister);
+
+ // Test after register controller
+ try {
+ Collection<String> ctrls = registry.getAllControllers();
+ assertTrue(ctrls.contains(controllerIdToRegister));
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#requestControl(long, ControlChangeCallback)} can correctly take control for switch so that callback is called.
+ * @throws RegistryException
+ * @throws InterruptedException
+ */
+ @Test
+ public void testRequestControl() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ LoggingCallback callback = new LoggingCallback(1);
+ long dpidToRequest = 1000L;
+
+ try {
+ registry.requestControl(dpidToRequest, callback);
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ callback.waitForRegistration();
+
+ long dpidCallback = callback.getLatestDpid();
+ boolean controlCallback = callback.getLatestControl();
+
+ assertEquals(dpidToRequest, dpidCallback);
+ assertTrue(controlCallback);
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#releaseControl(long)} can correctly release the control so that callback is called.
+ * @throws InterruptedException
+ * @throws RegistryException
+ */
+ @Test
+ public void testReleaseControl() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 1000L;
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // to request and wait to take control
+ registry.requestControl(dpidToRequest, callback);
+ callback.waitForRegistration();
+
+ registry.releaseControl(dpidToRequest);
+
+ // verify
+ callback.waitUntilCalled();
+ assertEquals(dpidToRequest, (long)callback.getLatestDpid());
+ assertFalse(callback.getLatestControl());
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#hasControl(long)} returns correct status.
+ * @throws InterruptedException
+ * @throws RegistryException
+ */
+ @Test
+ public void testHasControl() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 1000L;
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // Test before request control
+ assertFalse(registry.hasControl(dpidToRequest));
+
+ registry.requestControl(dpidToRequest, callback);
+ callback.waitForRegistration();
+
+ // Test after take control
+ assertTrue(registry.hasControl(dpidToRequest));
+
+ registry.releaseControl(dpidToRequest);
+
+ callback.waitUntilCalled();
+
+ // Test after release control
+ assertFalse(registry.hasControl(dpidToRequest));
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#getControllerForSwitch(long)} returns correct controller ID.
+ * @throws InterruptedException
+ * @throws RegistryException
+ */
+ @Test
+ public void testGetControllerForSwitch() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 1000L;
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // Test before request control
+ try {
+ String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+ assertNotEquals(controllerId,controllerForSw);
+ } catch (RegistryException e) {
+ fail("Failed before request control : " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ registry.requestControl(dpidToRequest, callback);
+ callback.waitForRegistration();
+
+ // Test after take control
+ try {
+ String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+ assertEquals(controllerId,controllerForSw);
+ } catch (RegistryException e) {
+ fail("Failed after take control : " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ registry.releaseControl(dpidToRequest);
+ callback.waitUntilCalled();
+
+ // Test after release control
+ try {
+ String controllerForSw = registry.getControllerForSwitch(dpidToRequest);
+ assertNotEquals(controllerId,controllerForSw);
+ } catch (RegistryException e) {
+ fail("Failed after release control : " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#getAllSwitches()} returns correct list of switches.
+ * @throws InterruptedException
+ * @throws RegistryException
+ */
+ @Test
+ public void testGetAllSwitches() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 1000L;
+ String dpidToRequestStr = HexString.toHexString(dpidToRequest);
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // Test before request control
+ Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
+ assertNotNull(switches);
+ assertFalse(switches.keySet().contains(dpidToRequestStr));
+
+ registry.requestControl(dpidToRequest, callback);
+ callback.waitForRegistration();
+
+ // Test after take control
+ switches = registry.getAllSwitches();
+ assertNotNull(switches);
+ assertTrue(switches.keySet().contains(dpidToRequestStr));
+ int count = 0;
+ for(ControllerRegistryEntry ctrl : switches.get(dpidToRequestStr)) {
+ if(ctrl.getControllerId().equals(controllerId)) {
+ ++count;
+ }
+ }
+ assertEquals(1,count);
+
+ registry.releaseControl(dpidToRequest);
+ callback.waitUntilCalled();
+
+ // Test after release control
+ switches = registry.getAllSwitches();
+ assertNotNull(switches);
+ assertFalse(switches.keySet().contains(dpidToRequestStr));
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#getSwitchesControlledByController(String)} returns correct list of switches.
+ * @throws InterruptedException
+ * @throws RegistryException
+ */
+ // TODO: remove @Ignore after implement StandaloneRegistry#getSwitchesControlledByController
+ @Ignore @Test
+ public void testGetSwitchesControlledByController() throws InterruptedException, RegistryException {
+ String controllerId = "test";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 1000L;
+ String dpidToRequestStr = HexString.toHexString(dpidToRequest);
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // Test before request control
+ Collection<Long> switches = registry.getSwitchesControlledByController(controllerId);
+ assertNotNull(switches);
+ assertFalse(switches.contains(dpidToRequestStr));
+
+ registry.requestControl(dpidToRequest, callback);
+ callback.waitForRegistration();
+
+ // Test after take control
+ switches = registry.getSwitchesControlledByController(controllerId);
+ assertNotNull(switches);
+ assertTrue(switches.contains(dpidToRequestStr));
+ int count = 0;
+ for(Long dpid : switches) {
+ if((long)dpid == dpidToRequest) {
+ ++count;
+ }
+ }
+ assertEquals(1, count);
+
+ registry.releaseControl(dpidToRequest);
+ callback.waitUntilCalled();
+
+ // Test after release control
+ switches = registry.getSwitchesControlledByController(controllerId);
+ assertNotNull(switches);
+ assertFalse(switches.contains(dpidToRequestStr));
+ }
+
+ /**
+ * Test if {@link StandaloneRegistry#allocateUniqueIdBlock()} returns appropriate object.
+ * Get bulk of IdBlocks and check if they do have unique range of IDs.
+ */
+ @Test
+ public void testAllocateUniqueIdBlock() {
+ // Number of blocks to be verified that any of them has unique block
+ final int NUM_BLOCKS = 100;
+ ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
+
+ for(int i = 0; i < NUM_BLOCKS; ++i) {
+ blocks.add(registry.allocateUniqueIdBlock());
+ }
+
+ for(int i = 0; i < NUM_BLOCKS; ++i) {
+ IdBlock block1 = blocks.get(i);
+ for(int j = i + 1; j < NUM_BLOCKS; ++j) {
+ IdBlock block2 = blocks.get(j);
+ IdBlock lower,higher;
+
+ if(block1.getStart() < block2.getStart()) {
+ lower = block1;
+ higher = block2;
+ } else {
+ lower = block2;
+ higher = block1;
+ }
+
+ assertTrue(lower.getSize() > 0L);
+ assertTrue(higher.getSize() > 0L);
+ assertTrue(lower.getEnd() < higher.getStart());
+ }
+ }
+ }
+}
diff --git a/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java b/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java
new file mode 100644
index 0000000..3314ad2
--- /dev/null
+++ b/src/test/java/net/onrc/onos/registry/controller/ZookeeperRegistryTest.java
@@ -0,0 +1,597 @@
+package net.onrc.onos.registry.controller;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.test.FloodlightTestCase;
+import net.onrc.onos.registry.controller.StandaloneRegistryTest.LoggingCallback;
+import net.onrc.onos.registry.controller.ZookeeperRegistry.SwitchLeaderListener;
+
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.util.HexString;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.netflix.curator.RetryPolicy;
+import com.netflix.curator.framework.CuratorFramework;
+import com.netflix.curator.framework.CuratorFrameworkFactory;
+import com.netflix.curator.framework.listen.ListenerContainer;
+import com.netflix.curator.framework.recipes.atomic.AtomicValue;
+import com.netflix.curator.framework.recipes.atomic.DistributedAtomicLong;
+import com.netflix.curator.framework.recipes.cache.ChildData;
+import com.netflix.curator.framework.recipes.cache.PathChildrenCache;
+import com.netflix.curator.framework.recipes.cache.PathChildrenCacheEvent;
+import com.netflix.curator.framework.recipes.cache.PathChildrenCacheListener;
+import com.netflix.curator.framework.recipes.cache.PathChildrenCache.StartMode;
+import com.netflix.curator.framework.recipes.leader.LeaderLatch;
+import com.netflix.curator.x.discovery.ServiceCache;
+import com.netflix.curator.x.discovery.ServiceCacheBuilder;
+import com.netflix.curator.x.discovery.ServiceDiscovery;
+import com.netflix.curator.x.discovery.ServiceDiscoveryBuilder;
+import com.netflix.curator.x.discovery.ServiceInstance;
+
+/**
+ * Unit test for {@link ZookeeperRegistry}.
+ * NOTE: {@link FloodlightTestCase} conflicts with PowerMock. If FloodLight-related methods need to be tested,
+ * implement another test class to test them.
+ * @author Naoki Shiota
+ *
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ZookeeperRegistry.class, CuratorFramework.class, CuratorFrameworkFactory.class,
+ ServiceDiscoveryBuilder.class, ServiceDiscovery.class, ServiceCache.class, PathChildrenCache.class,
+ ZookeeperRegistry.SwitchPathCacheListener.class})
+public class ZookeeperRegistryTest extends FloodlightTestCase {
+ private final static Long ID_BLOCK_SIZE = 0x100000000L;
+
+ protected ZookeeperRegistry registry;
+ protected CuratorFramework client;
+
+ protected PathChildrenCacheListener pathChildrenCacheListener;
+ protected final String CONTROLLER_ID = "controller2013";
+
+ /**
+ * Initialize {@link ZookeeperRegistry} Object and inject initial value with {@link ZookeeperRegistry#init(FloodlightModuleContext)} method.
+ * This setup code also tests {@link ZookeeperRegistry#init(FloodlightModuleContext)} method itself.
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ pathChildrenCacheListener = null;
+
+ // Mock of CuratorFramework
+ client = createCuratorFrameworkMock();
+
+ // Mock of CuratorFrameworkFactory
+ PowerMock.mockStatic(CuratorFrameworkFactory.class);
+ EasyMock.expect(CuratorFrameworkFactory.newClient((String)EasyMock.anyObject(),
+ EasyMock.anyInt(), EasyMock.anyInt(), (RetryPolicy)EasyMock.anyObject())).andReturn(client);
+ PowerMock.replay(CuratorFrameworkFactory.class);
+
+ FloodlightModuleContext fmc = new FloodlightModuleContext();
+ registry = new ZookeeperRegistry();
+ fmc.addService(ZookeeperRegistry.class, registry);
+
+ registry.init(fmc);
+
+ PowerMock.verify(client, CuratorFrameworkFactory.class);
+ }
+
+ /**
+ * Clean up member variables (empty for now).
+ */
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#registerController(String)} method can go through without exception.
+ * (Exceptions are usually out of test target, but {@link ZookeeperRegistry#registerController(String)} throws an exception in case of invalid registration.)
+ */
+ @Test
+ public void testRegisterController() {
+ String controllerIdToRegister = "controller2013";
+
+ try {
+ registry.registerController(controllerIdToRegister);
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#getControllerId()} correctly returns registered ID.
+ * @throws Exception
+ */
+ @Test
+ public void testGetControllerId() throws Exception {
+ String controllerIdToRegister = "controller1";
+
+ // try before controller is registered
+ String controllerId = registry.getControllerId();
+ assertNull(controllerId);
+
+ // register
+ registry.registerController(controllerIdToRegister);
+
+ // call getControllerId and verify
+ controllerId = registry.getControllerId();
+ assertNotNull(controllerId);
+ assertEquals(controllerIdToRegister, controllerId);
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#getAllControllers()} returns all controllers.
+ * Controllers to be returned are injected while setup. See {@link ZookeeperRegistryTest#createCuratorFrameworkMock()}
+ * to what controllers are injected using mock {@link ServiceCache}.
+ * @throws Exception
+ */
+ @Test
+ public void testGetAllControllers() throws Exception {
+ String controllerIdRegistered = "controller1";
+ String controllerIdNotRegistered = "controller2013";
+
+ try {
+ Collection<String> ctrls = registry.getAllControllers();
+ assertTrue(ctrls.contains(controllerIdRegistered));
+ assertFalse(ctrls.contains(controllerIdNotRegistered));
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback)}
+ * correctly take control of specific switch. Because {@link ZookeeperRegistry#requestControl(long, net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback)}
+ * doesn't return values, inject mock {@link LeaderLatch} object and verify latch is correctly set up.
+ * @throws Exception
+ */
+ @Test
+ public void testRequestControl() throws Exception {
+ // Mock LeaderLatch
+ LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+ latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+ EasyMock.expectLastCall().once();
+ latch.start();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(latch);
+
+ PowerMock.expectNew(LeaderLatch.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+ .andReturn(latch).once();
+ PowerMock.replay(LeaderLatch.class);
+
+ String controllerId = "controller2013";
+ registry.registerController(controllerId);
+
+ LoggingCallback callback = new LoggingCallback(1);
+ long dpidToRequest = 2000L;
+
+ try {
+ registry.requestControl(dpidToRequest, callback);
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ EasyMock.verify(latch);
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#releaseControl(long)} correctly release control of specific switch.
+ * Because {@link ZookeeperRegistry#releaseControl(long)} doesn't return values, inject mock
+ * {@link LeaderLatch} object and verify latch is correctly set up.
+ * @throws Exception
+ */
+ @Test
+ public void testReleaseControl() throws Exception {
+ // Mock of LeaderLatch
+ LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+ latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+ EasyMock.expectLastCall().once();
+ latch.start();
+ EasyMock.expectLastCall().once();
+ latch.removeAllListeners();
+ EasyMock.expectLastCall().once();
+ latch.close();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(latch);
+
+ PowerMock.expectNew(LeaderLatch.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+ .andReturn(latch).once();
+ PowerMock.replay(LeaderLatch.class);
+
+ String controllerId = "controller2013";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 2000L;
+ LoggingCallback callback = new LoggingCallback(1);
+
+ registry.requestControl(dpidToRequest, callback);
+ registry.releaseControl(dpidToRequest);
+
+ EasyMock.verify(latch);
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#hasControl(long)} returns correct status whether controller has control of specific switch.
+ * @throws Exception
+ */
+ @Test
+ public void testHasControl() throws Exception {
+ // Mock of LeaderLatch
+ LeaderLatch latch = EasyMock.createMock(LeaderLatch.class);
+ latch.addListener(EasyMock.anyObject(SwitchLeaderListener.class));
+ EasyMock.expectLastCall().once();
+ latch.start();
+ EasyMock.expectLastCall().once();
+ EasyMock.expect(latch.hasLeadership()).andReturn(true).anyTimes();
+ latch.removeAllListeners();
+ EasyMock.expectLastCall().once();
+ latch.close();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(latch);
+
+ PowerMock.expectNew(LeaderLatch.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))
+ .andReturn(latch);
+ PowerMock.replay(LeaderLatch.class);
+
+ String controllerId = "controller2013";
+ registry.registerController(controllerId);
+
+ long dpidToRequest = 2000L;
+ LoggingCallback callback = new LoggingCallback(2);
+
+ // Test before request control
+ assertFalse(registry.hasControl(dpidToRequest));
+
+ registry.requestControl(dpidToRequest, callback);
+
+ // Test after request control
+ assertTrue(registry.hasControl(dpidToRequest));
+
+ registry.releaseControl(dpidToRequest);
+
+ // Test after release control
+ assertFalse(registry.hasControl(dpidToRequest));
+
+ EasyMock.verify(latch);
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#getControllerForSwitch(long)} correctly returns controller ID of specific switch.
+ * Relation between controllers and switches are defined by {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
+ * @throws Throwable
+ */
+ @Test
+ public void testGetControllerForSwitch() throws Throwable {
+ long dpidRegistered = 1000L;
+ long dpidNotRegistered = 2000L;
+
+ setPathChildrenCache();
+
+ String controllerForSw = registry.getControllerForSwitch(dpidRegistered);
+ assertEquals("controller1",controllerForSw);
+
+ controllerForSw = registry.getControllerForSwitch(dpidNotRegistered);
+ assertEquals(null, controllerForSw);
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#getSwitchesControlledByController(String)} returns correct list of
+ * switches controlled by a controller.
+ * @throws Exception
+ */
+ // TODO: Test after getSwitchesControlledByController() is implemented.
+ @Ignore @Test
+ public void testGetSwitchesControlledByController() throws Exception {
+ String controllerIdRegistered = "controller1";
+ String dpidRegistered = HexString.toHexString(1000L);
+ String controllerIdNotRegistered = CONTROLLER_ID;
+
+ Collection<Long> switches = registry.getSwitchesControlledByController(controllerIdRegistered);
+ assertNotNull(switches);
+ assertTrue(switches.contains(dpidRegistered));
+
+ switches = registry.getSwitchesControlledByController(controllerIdNotRegistered);
+ assertNotNull(switches);
+ assertEquals(0, switches.size());
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#getAllSwitches()} returns correct list of all switches.
+ * Switches are injected in {@link ZookeeperRegistryTest#setPathChildrenCache()} function.
+ * @throws Exception
+ */
+ @Test
+ public void testGetAllSwitches() throws Exception {
+ String [] dpids = {
+ HexString.toHexString(1000L),
+ HexString.toHexString(1001L),
+ HexString.toHexString(1002L),
+ };
+
+ setPathChildrenCache();
+
+ Map<String, List<ControllerRegistryEntry>> switches = registry.getAllSwitches();
+ assertNotNull(switches);
+ assertEquals(dpids.length, switches.size());
+ for(String dpid : dpids) {
+ assertTrue(switches.keySet().contains(dpid));
+ }
+ }
+
+ /**
+ * Test if {@link ZookeeperRegistry#allocateUniqueIdBlock()} can assign IdBlock without duplication.
+ */
+ @Test
+ public void testAllocateUniqueIdBlock() {
+ // Number of blocks to be verified that any of them has unique block
+ final int NUM_BLOCKS = 100;
+ ArrayList<IdBlock> blocks = new ArrayList<IdBlock>(NUM_BLOCKS);
+
+ for(int i = 0; i < NUM_BLOCKS; ++i) {
+ IdBlock block = registry.allocateUniqueIdBlock();
+ assertNotNull(block);
+ blocks.add(block);
+ }
+
+ for(int i = 0; i < NUM_BLOCKS; ++i) {
+ IdBlock block1 = blocks.get(i);
+ for(int j = i + 1; j < NUM_BLOCKS; ++j) {
+ IdBlock block2 = blocks.get(j);
+ IdBlock lower,higher;
+
+ if(block1.getStart() < block2.getStart()) {
+ lower = block1;
+ higher = block2;
+ } else {
+ lower = block2;
+ higher = block1;
+ }
+
+ assertTrue(lower.getSize() > 0L);
+ assertTrue(higher.getSize() > 0L);
+ assertTrue(lower.getEnd() <= higher.getStart());
+ }
+ }
+ }
+
+
+ //-------------------------- Creation of mock objects --------------------------
+ /**
+ * Create mock {@link CuratorFramework} object with initial value below.<br>
+ * [Ctrl ID] : [DPID]<br>
+ * controller1 : 1000<br>
+ * controller2 : 1001<br>
+ * controller2 : 1002<br>
+ * controller2013 : nothing
+ * @return Created mock object
+ * @throws Exception
+ */
+ @SuppressWarnings({ "serial", "unchecked" })
+ private CuratorFramework createCuratorFrameworkMock() throws Exception {
+ // Mock of AtomicValue
+ AtomicValue<Long> atomicValue = EasyMock.createMock(AtomicValue.class);
+ EasyMock.expect(atomicValue.succeeded()).andReturn(true).anyTimes();
+ EasyMock.expect(atomicValue.preValue()).andAnswer(new IAnswer<Long>() {
+ private long value = 0;
+ @Override
+ public Long answer() throws Throwable {
+ value += ID_BLOCK_SIZE;
+ return value;
+ }
+ }).anyTimes();
+ EasyMock.expect(atomicValue.postValue()).andAnswer(new IAnswer<Long>() {
+ private long value = ID_BLOCK_SIZE;
+ @Override
+ public Long answer() throws Throwable {
+ value += ID_BLOCK_SIZE;
+ return value;
+ }
+ }).anyTimes();
+ EasyMock.replay(atomicValue);
+
+ // Mock DistributedAtomicLong
+ DistributedAtomicLong daLong = EasyMock.createMock(DistributedAtomicLong.class);
+ EasyMock.expect(daLong.add(EasyMock.anyLong())).andReturn(atomicValue).anyTimes();
+ EasyMock.replay(daLong);
+ PowerMock.expectNew(DistributedAtomicLong.class,
+ new Class<?> [] {CuratorFramework.class, String.class, RetryPolicy.class},
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyObject(RetryPolicy.class)).
+ andReturn(daLong).anyTimes();
+ PowerMock.replay(DistributedAtomicLong.class);
+
+ // Mock ListenerContainer
+ ListenerContainer<PathChildrenCacheListener> listenerContainer = EasyMock.createMock(ListenerContainer.class);
+ listenerContainer.addListener(EasyMock.anyObject(PathChildrenCacheListener.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ @Override
+ public Object answer() throws Throwable {
+ pathChildrenCacheListener = (PathChildrenCacheListener)EasyMock.getCurrentArguments()[0];
+ return null;
+ }
+ }).once();
+ EasyMock.replay(listenerContainer);
+
+ // Mock PathChildrenCache
+ PathChildrenCache pathChildrenCacheMain = createPathChildrenCacheMock(CONTROLLER_ID, new String[] {"/switches"}, listenerContainer);
+ PathChildrenCache pathChildrenCache1 = createPathChildrenCacheMock("controller1", new String[] {HexString.toHexString(1000L)}, listenerContainer);
+ PathChildrenCache pathChildrenCache2 = createPathChildrenCacheMock("controller2", new String[] {
+ HexString.toHexString(1001L), HexString.toHexString(1002L) },listenerContainer);
+
+ // Mock PathChildrenCache constructor
+ PowerMock.expectNew(PathChildrenCache.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+ andReturn(pathChildrenCacheMain).once();
+ PowerMock.expectNew(PathChildrenCache.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+ andReturn(pathChildrenCache1).once();
+ PowerMock.expectNew(PathChildrenCache.class,
+ EasyMock.anyObject(CuratorFramework.class), EasyMock.anyObject(String.class), EasyMock.anyBoolean()).
+ andReturn(pathChildrenCache2).anyTimes();
+ PowerMock.replay(PathChildrenCache.class);
+
+ // Mock ServiceCache
+ ServiceCache<ControllerService> serviceCache = EasyMock.createMock(ServiceCache.class);
+ serviceCache.start();
+ EasyMock.expectLastCall().once();
+ EasyMock.expect(serviceCache.getInstances()).andReturn(new ArrayList<ServiceInstance<ControllerService> > () {{
+ add(createServiceInstanceMock("controller1"));
+ add(createServiceInstanceMock("controller2"));
+ }}).anyTimes();
+ EasyMock.replay(serviceCache);
+
+ // Mock ServiceCacheBuilder
+ ServiceCacheBuilder<ControllerService> serviceCacheBuilder = EasyMock.createMock(ServiceCacheBuilder.class);
+ EasyMock.expect(serviceCacheBuilder.name(EasyMock.anyObject(String.class))).andReturn(serviceCacheBuilder).once();
+ EasyMock.expect(serviceCacheBuilder.build()).andReturn(serviceCache).once();
+ EasyMock.replay(serviceCacheBuilder);
+
+ // Mock ServiceDiscovery
+ ServiceDiscovery<ControllerService> serviceDiscovery = EasyMock.createMock(ServiceDiscovery.class);
+ serviceDiscovery.start();
+ EasyMock.expectLastCall().once();
+ EasyMock.expect(serviceDiscovery.serviceCacheBuilder()).andReturn(serviceCacheBuilder).once();
+ serviceDiscovery.registerService(EasyMock.anyObject(ServiceInstance.class));
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(serviceDiscovery);
+
+ // Mock CuratorFramework
+ CuratorFramework client = EasyMock.createMock(CuratorFramework.class);
+ client.start();
+ EasyMock.expectLastCall().once();
+ EasyMock.expect(client.usingNamespace(EasyMock.anyObject(String.class))).andReturn(client);
+ EasyMock.replay(client);
+
+ // Mock ServiceDiscoveryBuilder
+ ServiceDiscoveryBuilder<ControllerService> builder = EasyMock.createMock(ServiceDiscoveryBuilder.class);
+ EasyMock.expect(builder.client(client)).andReturn(builder).once();
+ EasyMock.expect(builder.basePath(EasyMock.anyObject(String.class))).andReturn(builder);
+ EasyMock.expect(builder.build()).andReturn(serviceDiscovery);
+ EasyMock.replay(builder);
+
+ PowerMock.mockStatic(ServiceDiscoveryBuilder.class);
+ EasyMock.expect(ServiceDiscoveryBuilder.builder(ControllerService.class)).andReturn(builder).once();
+ PowerMock.replay(ServiceDiscoveryBuilder.class);
+
+ return client;
+ }
+
+ /**
+ * Create mock {@link ServiceInstance} object using given controller ID.
+ * @param controllerId Controller ID to represent instance's payload (ControllerService).
+ * @return Mock ServiceInstance object
+ */
+ private ServiceInstance<ControllerService> createServiceInstanceMock(String controllerId) {
+ ControllerService controllerService = EasyMock.createMock(ControllerService.class);
+ EasyMock.expect(controllerService.getControllerId()).andReturn(controllerId).anyTimes();
+ EasyMock.replay(controllerService);
+
+ @SuppressWarnings("unchecked")
+ ServiceInstance<ControllerService> serviceInstance = EasyMock.createMock(ServiceInstance.class);
+ EasyMock.expect(serviceInstance.getPayload()).andReturn(controllerService).anyTimes();
+ EasyMock.replay(serviceInstance);
+
+ return serviceInstance;
+ }
+
+ /**
+ * Create mock {@link PathChildrenCache} using given controller ID and DPIDs.
+ * @param controllerId Controller ID to represent current data.
+ * @param paths List of HexString indicating switch's DPID.
+ * @param listener Callback object to be set as Listenable.
+ * @return Mock PathChildrenCache object
+ * @throws Exception
+ */
+ private PathChildrenCache createPathChildrenCacheMock(final String controllerId, final String [] paths,
+ ListenerContainer<PathChildrenCacheListener> listener) throws Exception {
+ PathChildrenCache pathChildrenCache = EasyMock.createMock(PathChildrenCache.class);
+
+ EasyMock.expect(pathChildrenCache.getListenable()).andReturn(listener).anyTimes();
+
+ pathChildrenCache.start(EasyMock.anyObject(StartMode.class));
+ EasyMock.expectLastCall().anyTimes();
+
+ List<ChildData> childs = new ArrayList<ChildData>();
+ for(String path : paths) {
+ childs.add(createChildDataMockForCurrentData(controllerId,path));
+ }
+ EasyMock.expect(pathChildrenCache.getCurrentData()).andReturn(childs).anyTimes();
+
+ pathChildrenCache.rebuild();
+ EasyMock.expectLastCall().anyTimes();
+
+ EasyMock.replay(pathChildrenCache);
+
+ return pathChildrenCache;
+ }
+
+ /**
+ * Create mock {@link ChildData} for {@link PathChildrenCache#getCurrentData()} return value.
+ * This object need to include 'sequence number' in tail of path string. ("-0" means 0th sequence)
+ * @param controllerId Controller ID
+ * @param path HexString indicating switch's DPID
+ * @return Mock ChildData object
+ */
+ private ChildData createChildDataMockForCurrentData(String controllerId, String path) {
+ ChildData data = EasyMock.createMock(ChildData.class);
+ EasyMock.expect(data.getPath()).andReturn(path + "-0").anyTimes();
+ EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
+ EasyMock.replay(data);
+
+ return data;
+ }
+
+ /**
+ * Inject relations between controllers and switches using callback object.
+ * @throws Exception
+ */
+ private void setPathChildrenCache() throws Exception {
+ pathChildrenCacheListener.childEvent(client,
+ createChildrenCacheEventMock("controller1", HexString.toHexString(1000L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+ pathChildrenCacheListener.childEvent(client,
+ createChildrenCacheEventMock("controller2", HexString.toHexString(1001L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+ pathChildrenCacheListener.childEvent(client,
+ createChildrenCacheEventMock("controller2", HexString.toHexString(1002L), PathChildrenCacheEvent.Type.CHILD_ADDED));
+ }
+
+ /**
+ * Create mock {@link PathChildrenCacheEvent} object using given controller ID and DPID.
+ * @param controllerId Controller ID.
+ * @param path HexString of DPID.
+ * @param type Event type to be set to mock object.
+ * @return Mock PathChildrenCacheEvent object
+ */
+ private PathChildrenCacheEvent createChildrenCacheEventMock(String controllerId, String path,
+ PathChildrenCacheEvent.Type type) {
+ PathChildrenCacheEvent event = EasyMock.createMock(PathChildrenCacheEvent.class);
+ ChildData data = EasyMock.createMock(ChildData.class);
+
+ EasyMock.expect(data.getPath()).andReturn(path).anyTimes();
+ EasyMock.expect(data.getData()).andReturn(controllerId.getBytes()).anyTimes();
+ EasyMock.replay(data);
+
+ EasyMock.expect(event.getType()).andReturn(type).anyTimes();
+ EasyMock.expect(event.getData()).andReturn(data).anyTimes();
+ EasyMock.replay(event);
+
+ return event;
+ }
+}
diff --git a/start-cassandra.sh b/start-cassandra.sh
index d670511..426fa60 100755
--- a/start-cassandra.sh
+++ b/start-cassandra.sh
@@ -1,10 +1,10 @@
#!/bin/bash
# Set paths
-FL_HOME=`dirname $0`
-CASSANDRA_DIR=${HOME}/apache-cassandra-1.1.4
-LOGDIR=${HOME}/ONOS/onos-logs
-CASSANDRA_LOG=$LOGDIR/cassandara.`hostname`.log
+ONOS_HOME=`dirname $0`
+CASSANDRA_DIR=${HOME}/apache-cassandra-1.2.4
+LOGDIR=${ONOS_HOME}/ONOS/onos-logs
+CASSANDRA_LOG=${LOGDIR}/cassandara.`hostname`.log
function lotate {
logfile=$1
@@ -30,6 +30,11 @@
# Run cassandra
echo "Starting cassandra"
+# echo "[31;48m[WARNING] This script copies conf/cassandra.yaml to $CASSANDRA_DIR/conf/cassandra.yaml (overwrites)[0m"
+# echo "[31;48moriginal cassandra.yaml was backed up as cassandra.yaml.backup[0m"
+# id=`hostid`
+# cp ${CASSANDRA_DIR}/conf/cassandra.yaml $CASSANDRA_DIR/conf/cassandra.yaml.backup
+# cp ${ONOS_HOME}/conf/cassandra.yaml.${id} $CASSANDRA_DIR/conf
$CASSANDRA_DIR/bin/cassandra > $CASSANDRA_LOG 2>&1
}
@@ -39,7 +44,7 @@
pids="$capid"
for p in ${pids}; do
if [ x$p != "x" ]; then
- sudo kill -KILL $p
+ kill -KILL $p
echo "Killed existing prosess (pid: $p)"
fi
done
@@ -56,7 +61,7 @@
case "$1" in
start)
deldb
- cp $FL_HOME/cassandra.titan /tmp
+ cp $ONOS_HOME/conf/cassandra.titan /tmp
stop
start
;;
diff --git a/start-onos-embedded.sh b/start-onos-embedded.sh
new file mode 100755
index 0000000..8688f69
--- /dev/null
+++ b/start-onos-embedded.sh
@@ -0,0 +1,165 @@
+#!/bin/bash
+
+# Set paths
+if [ -z "${ONOS_HOME}" ]; then
+ ONOS_HOME=`dirname $0`
+fi
+ONOS_LOGBACK="${ONOS_HOME}/logback.`hostname`.xml"
+LOGDIR=${ONOS_HOME}/onos-logs
+ONOS_LOG="${LOGDIR}/onos.`hostname`.log"
+PCAP_LOG="${LOGDIR}/onos.`hostname`.pcap"
+LOGS="$ONOS_LOG $PCAP_LOG"
+
+# Set JVM options
+JVM_OPTS=""
+JVM_OPTS="$JVM_OPTS -server -d64"
+JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m"
+#JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
+JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC -XX:+UseAdaptiveSizePolicy -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
+JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
+JVM_OPTS="$JVM_OPTS -javaagent:lib/jamm-0.2.5.jar"
+JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8 \
+ -XX:+UseThreadPriorities \
+ -XX:ThreadPriorityPolicy=42 \
+ -XX:+UseCompressedOops \
+ -Dcassandra.compaction.priority=1 \
+ -Dcom.sun.management.jmxremote.port=7199 \
+ -Dcom.sun.management.jmxremote.ssl=false \
+ -Dcom.sun.management.jmxremote.authenticate=false"
+JVM_OPTS="$JVM_OPTS -Dhazelcast.logging.type=slf4j"
+
+#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
+
+# Set Main class to start ONOS core
+MAIN_CLASS="net.onrc.onos.ofcontroller.core.Main"
+
+if [ -z "${MVN}" ]; then
+ MVN="mvn"
+fi
+#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
+#<appender-ref ref="STDOUT" />
+
+function lotate {
+ logfile=$1
+ nr_max=${2:-10}
+ if [ -f $logfile ]; then
+ for i in `seq $(expr $nr_max - 1) -1 1`; do
+ if [ -f ${logfile}.${i} ]; then
+ mv -f ${logfile}.${i} ${logfile}.`expr $i + 1`
+ fi
+ done
+ mv $logfile $logfile.1
+ fi
+}
+
+function start {
+ if [ ! -d ${LOGDIR} ]; then
+ mkdir -p ${LOGDIR}
+ fi
+ # Backup log files
+ for log in ${LOGS}; do
+ echo "rotate log: $log"
+ if [ -f ${log} ]; then
+ lotate ${log}
+ fi
+ done
+
+# Create a logback file if required
+ cat <<EOF_LOGBACK >${ONOS_LOGBACK}
+<configuration scan="true" debug="true">
+<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+<encoder>
+<pattern>%level [%logger:%thread] %msg%n</pattern>
+</encoder>
+</appender>
+
+<appender name="FILE" class="ch.qos.logback.core.FileAppender">
+<file>${ONOS_LOG}</file>
+<encoder>
+<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+</encoder>
+</appender>
+
+<logger name="org" level="WARN"/>
+<logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
+<logger name="net.floodlightcontroller.logging" level="WARN"/>
+
+<root level="DEBUG">
+<appender-ref ref="FILE" />
+</root>
+</configuration>
+EOF_LOGBACK
+
+ # Run floodlight
+ echo "Starting ONOS controller ..."
+ echo
+
+ # XXX MVN has to run at the project top dir..
+ cd ${ONOS_HOME}
+ echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties\""
+ ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties" > ${LOGDIR}/onos.stdout 2>${LOGDIR}/onos.stderr &
+
+ echo "Waiting for ONOS to start..."
+ COUNT=0
+ ESTATE=0
+ while [ "$COUNT" != "10" ]; do
+ COUNT=$((COUNT + 1))
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
+ if [ "$n" -ge "1" ]; then
+ exit 0
+ fi
+ sleep $COUNT
+ done
+ echo "Timed out"
+ exit 1
+
+ sudo -b /usr/sbin/tcpdump -n -i eth0 -s0 -w ${PCAP_LOG} 'tcp port 6633' > /dev/null 2>&1
+}
+
+function stop {
+ # Kill the existing processes
+ flpid=`jps -l |grep ${MAIN_CLASS} | awk '{print $1}'`
+ tdpid=`ps -edalf |grep tcpdump |grep ${PCAP_LOG} | awk '{print $4}'`
+ pids="$flpid $tdpid"
+ for p in ${pids}; do
+ if [ x$p != "x" ]; then
+ kill -KILL $p
+ echo "Killed existing process (pid: $p)"
+ fi
+ done
+}
+
+function deldb {
+ # Delete the cassandra data
+ if [ -d "/tmp/cassandra" ]; then
+ rm -rf /tmp/cassandra/*
+ fi
+}
+
+case "$1" in
+ start)
+ stop
+ start
+ ;;
+ startifdown)
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
+ if [ $n == 0 ]; then
+ start
+ else
+ echo "$n instance of onos running"
+ fi
+ ;;
+ stop)
+ stop
+ ;;
+ deldb)
+ deldb
+ ;;
+ status)
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
+ echo "$n instance of onos running"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status|startifdown}"
+ exit 1
+esac
diff --git a/start-onos.sh b/start-onos.sh
index f8e9309..495141d 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -1,51 +1,47 @@
#!/bin/bash
# Set paths
-FL_HOME=`dirname $0`
-FL_JAR="${FL_HOME}/target/floodlight.jar"
-FL_LOGBACK="${FL_HOME}/logback.xml"
-LOGDIR=${FL_HOME}/onos-logs
-FL_LOG="${LOGDIR}/onos.`hostname`.log"
+if [ -z "${ONOS_HOME}" ]; then
+ ONOS_HOME=`dirname $0`
+fi
+
+## Because the script change dir to $ONOS_HOME, we can set ONOS_LOGBACK and LOGDIR relative to $ONOS_HOME
+#ONOS_LOGBACK="${ONOS_HOME}/logback.`hostname`.xml"
+#LOGDIR=${ONOS_HOME}/onos-logs
+ONOS_LOGBACK="./logback.`hostname`.xml"
+LOGDIR=./onos-logs
+ONOS_LOG="${LOGDIR}/onos.`hostname`.log"
PCAP_LOG="${LOGDIR}/onos.`hostname`.pcap"
-LOGS="$FL_LOG $PCAP_LOG"
+LOGS="$ONOS_LOG $PCAP_LOG"
# Set JVM options
JVM_OPTS=""
-#JVM_OPTS="$JVM_OPTS -server -d64"
+## If you want JaCoCo Code Coverage reports... uncomment line below
+JVM_OPTS="$JVM_OPTS -javaagent:${ONOS_HOME}/lib/jacocoagent.jar=dumponexit=true,output=file,destfile=${LOGDIR}/jacoco.exec"
+JVM_OPTS="$JVM_OPTS -server -d64"
#JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m"
+JVM_OPTS="$JVM_OPTS -Xmx1g -Xms1g -Xmn800m"
#JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
-#JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
-#JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8"
+JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC -XX:+UseAdaptiveSizePolicy -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
+JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
+JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8"
+JVM_OPTS="$JVM_OPTS -XX:OnError=crash-logger" ;# For dumping core
#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
+JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8 \
+ -XX:+UseThreadPriorities \
+ -XX:ThreadPriorityPolicy=42 \
+ -XX:+UseCompressedOops \
+ -Dcom.sun.management.jmxremote.port=7189 \
+ -Dcom.sun.management.jmxremote.ssl=false \
+ -Dcom.sun.management.jmxremote.authenticate=false"
+JVM_OPTS="$JVM_OPTS -Dhazelcast.logging.type=slf4j"
-# Set classpath to include titan libs
-CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
+# Set ONOS core main class
+MAIN_CLASS="net.onrc.onos.ofcontroller.core.Main"
-# Create a logback file if required
-cat <<EOF_LOGBACK >${FL_LOGBACK}
-<configuration scan="true" debug="true">
-<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-<encoder>
-<pattern>%level [%logger:%thread] %msg%n</pattern>
-</encoder>
-</appender>
-
-<appender name="FILE" class="ch.qos.logback.core.FileAppender">
-<file>${FL_LOG}</file>
-<encoder>
-<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
-</encoder>
-</appender>
-
-<logger name="org" level="WARN"/>
-<logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
-<logger name="net.floodlightcontroller.logging" level="WARN"/>
-
-<root level="DEBUG">
-<appender-ref ref="FILE" />
-</root>
-</configuration>
-EOF_LOGBACK
+if [ -z "${MVN}" ]; then
+ MVN="mvn -o"
+fi
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />
@@ -75,34 +71,80 @@
fi
done
+# Create a logback file if required
+ if [ ! -f ${ONOS_LOGBACK} ]; then
+ cat <<EOF_LOGBACK >${ONOS_LOGBACK}
+<configuration scan="true" debug="true">
+<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+<encoder>
+<pattern>%level [%logger:%thread] %msg%n</pattern>
+</encoder>
+</appender>
+
+<appender name="FILE" class="ch.qos.logback.core.FileAppender">
+<file>${ONOS_LOG}</file>
+<encoder>
+<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+</encoder>
+</appender>
+
+<logger name="org" level="WARN"/>
+<logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
+<logger name="net.floodlightcontroller.logging" level="WARN"/>
+
+<root level="DEBUG">
+<appender-ref ref="FILE" />
+</root>
+</configuration>
+EOF_LOGBACK
+ fi
+
# Run floodlight
echo "Starting ONOS controller ..."
echo
- java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR} -cf ./onos.properties > /dev/null 2>&1 &
-# echo "java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -jar ${FL_JAR} -cf ./onos.properties > /dev/null 2>&1 &"
- sudo -b /usr/sbin/tcpdump -n -i eth0 -s0 -w ${PCAP_LOG} 'tcp port 6633' > /dev/null 2>&1
+
+ # XXX : MVN has to run at the project top dir
+ echo $ONOS_HOME
+ cd ${ONOS_HOME}
+ pwd
+ echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties\""
+
+ ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties" > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
+
+ echo "Waiting for ONOS to start..."
+ COUNT=0
+ ESTATE=0
+ while [ "$COUNT" != "10" ]; do
+ echo -n "."
+ sleep 1
+# COUNT=$((COUNT + 1))
+# sleep $COUNT
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
+ if [ "$n" -ge "1" ]; then
+ echo ""
+ exit 0
+ fi
+ done
+ echo "Timed out"
+ exit 1
+
+# echo "java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR} -cf ./onos.properties > /dev/null 2>&1 &"
+# sudo -b /usr/sbin/tcpdump -n -i eth0 -s0 -w ${PCAP_LOG} 'tcp port 6633' > /dev/null 2>&1
}
function stop {
# Kill the existing processes
- flpid=`ps -edalf |grep java |grep logback.xml | awk '{print $4}'`
+ flpid=`jps -l |grep ${MAIN_CLASS} | awk '{print $1}'`
tdpid=`ps -edalf |grep tcpdump |grep ${PCAP_LOG} | awk '{print $4}'`
pids="$flpid $tdpid"
for p in ${pids}; do
if [ x$p != "x" ]; then
- sudo kill -KILL $p
- echo "Killed existing prosess (pid: $p)"
+ kill -TERM $p
+ echo "Killed existing process (pid: $p)"
fi
done
}
-function deldb {
- # Delete the berkeley db database
- if [ -d "/tmp/cassandra.titan" ]; then
- rm -rf /tmp/cassandra.titan
- mkdir /tmp/cassandra.titan
- fi
-}
function check_db {
if [ -d "/tmp/cassandra.titan" ]; then
echo "Cassandra is running on local berkely db. Exitting"
@@ -121,17 +163,22 @@
check_db
start
;;
+ startifdown)
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
+ if [ $n == 0 ]; then
+ start
+ else
+ echo "$n instance of onos running"
+ fi
+ ;;
stop)
stop
;;
- deldb)
- deldb
- ;;
status)
- n=`ps -edalf |grep java |grep logback.xml | wc -l`
+ n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
echo "$n instance of onos running"
;;
*)
- echo "Usage: $0 {start|stop|restart|status}"
+ echo "Usage: $0 {start|stop|restart|status|startifdown}"
exit 1
esac
diff --git a/start-rest.sh b/start-rest.sh
index 1f801fe..01e7638 100755
--- a/start-rest.sh
+++ b/start-rest.sh
@@ -11,6 +11,16 @@
REST_LOG="${LOGDIR}/rest.`hostname`.log"
#######################
+dokill() {
+ for cpid in $(ps -o pid= --ppid $1)
+ do
+ dokill $cpid
+ done
+ echo "killing: $(ps -p $1 -o cmd=)"
+ kill -9 $1 > /dev/null 2>&1
+}
+
+
function lotate {
logfile=$1
nr_max=${2:-10}
@@ -28,15 +38,16 @@
pids=`ps -edalf |grep ${script_name} | grep python | grep -v grep | awk '{print $4}'`
for p in ${pids}; do
if [ x$p != "x" ]; then
- sudo kill -KILL $p
- echo "Killed existing prosess (pid: $p)"
+ dokill $p
+# sudo kill -KILL $p
+# echo "Killed existing prosess (pid: $p)"
fi
done
}
function status {
nr_process=`ps -edalf |grep ${script_name} | grep python | grep -v grep | wc -l`
- if [ x${nr_process} != "x" ] ; then
+ if [ ${nr_process} != 0 ] ; then
echo "rest server is running"
else
echo "rest server is not running"
@@ -52,14 +63,12 @@
case "$1" in
start)
stop
+ sleep 2
start
;;
stop)
stop
;;
- deldb)
- deldb
- ;;
status)
status
;;
diff --git a/start-zk.sh b/start-zk.sh
new file mode 100755
index 0000000..0853a96
--- /dev/null
+++ b/start-zk.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Set paths
+
+ONOS_HOME=`dirname $0`
+ZK_DIR=${HOME}/zookeeper-3.4.5
+#ZK_CONF=${ONOS_HOME}/conf/zoo.cfg
+
+function start {
+ # Run Zookeeper with our configuration
+ echo "Starting Zookeeper"
+# echo "[31;48m[WARNING] This script copies conf/zoo.cfg to $ZK_DIR/conf/zoo.cfg (overwrites)[0m"
+# echo "[31;48moriginal zoo.cfg was backed up as zoo.cfg.backup[0m"
+# if [ $ZK_DIR/conf/zoo.cfg ]; then
+# cp $ZK_DIR/conf/zoo.cfg $ZK_DIR/conf/zoo.cfg.backup
+# fi
+# hostid > /var/lib/zookeeper/myid
+# cp $ZK_CONF $ZK_DIR/conf
+# echo "cp $ZK_CONF $ZK_DIR/conf"
+ $ZK_DIR/bin/zkServer.sh start
+}
+
+function stop {
+ # Kill the existing processes
+ pids=`jps -l | grep org.apache.zookeeper.server | awk '{print $1}'`
+ for p in ${pids}; do
+ if [ x$p != "x" ]; then
+ kill -KILL $p
+ echo "Killed existing prosess (pid: $p)"
+ fi
+ done
+}
+function status {
+ $ZK_DIR/bin/zkServer.sh status
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
diff --git a/start.sh b/start.sh
deleted file mode 100755
index d6aa010..0000000
--- a/start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-if [ -f floodlight.onos1vpc.log ]; then
- mv floodlight.onos1vpc.log floodlight.onos1vpc.log.1
-fi
-ppid=`ps -edalf |grep java |grep floodlight.jar | awk '{print $4}'`
-if [ x$ppid != "x" ]; then
- sudo kill -KILL $ppid
-fi
-java -jar target/floodlight.jar > floodlight.onos1vpc.log 2>&1 &
diff --git a/test-network/flows/generate_flows_domains_8.py b/test-network/flows/generate_flows_domains_8.py
new file mode 100755
index 0000000..3d61318
--- /dev/null
+++ b/test-network/flows/generate_flows_domains_8.py
@@ -0,0 +1,113 @@
+#! /usr/bin/env python
+# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+
+#
+# A script for generating a number of flows.
+#
+# The output of the script should be saved to a file, and the flows from
+# that file should be added by the following command:
+#
+# web/add_flow.py -f filename
+#
+# NOTE: Currently, some of the parameters fo the flows are hard-coded,
+# and all flows are between same source and destination DPID and ports
+# (differentiated by different matchSrcMac and matchDstMac).
+#
+
+import copy
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+## Global Var ##
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+DOMAINS_N = 7
+NODES_N = 25
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+
+if __name__ == "__main__":
+ usage_msg = "Generate a number of flows by using a pre-defined template.\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + "NOTE: This script is work-in-progress. Currently all flows are within same\n"
+ usage_msg = usage_msg + "pair of switch ports and contain auto-generated MAC-based matching conditions.\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + "Usage: %s <begin-flow-id>\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " The output should be saved to a file, and the flows should be installed\n"
+ usage_msg = usage_msg + " by using the command './add_flow.py -f filename'\n"
+
+
+ # app.debug = False
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+ if len(sys.argv) < 2:
+ log_error(usage_msg)
+ exit(1)
+
+ # Extract the arguments
+ begin_flow_id = int(sys.argv[1], 0)
+
+ #
+ # Do the work
+ #
+ # NOTE: Currently, up to 65536 flows are supported.
+ # More flows can be supported by iterating by, say, iterating over some of
+ # the other bytes of the autogenereated source/destination MAC addresses.
+ #
+ # We iterate over each pair of domains. E.g.:
+ # (2,3) (2,4) (2,5) ... (2,8) (3,2) (3,4) ... (3,8) (4,2) ... (8,7)
+ # Within each domain we iterate over the corresponding pairs of node IDs:
+ # (2,2) (3,3) (4,4) (5,5) ... (25, 25)
+ #
+ flow_id = begin_flow_id
+ idx = 0
+ src_domain_id = 2
+ while src_domain_id < DOMAINS_N + 2:
+ dst_domain_id = 2
+ while dst_domain_id < DOMAINS_N + 2:
+ if src_domain_id == dst_domain_id:
+ dst_domain_id = dst_domain_id + 1
+ continue
+ node_id = 2
+ while node_id < NODES_N:
+ # The matching MAC addresses
+ mac2 = idx / 255
+ mac3 = idx % 255
+ str_mac2 = "%0.2x" % mac2
+ str_mac3 = "%0.2x" % mac3
+ src_mac = "00:01:" + str_mac2 + ":" + str_mac3 + ":00:00"
+ dst_mac = "00:02:" + str_mac2 + ":" + str_mac3 + ":00:00"
+ # The src/dst node DPID
+ src_node_dpid = "%0.2x" % node_id
+ dst_node_dpid = "%0.2x" % node_id
+ src_domain_dpid = "%0.2x" % src_domain_id
+ dst_domain_dpid = "%0.2x" % dst_domain_id
+ src_dpid = "00:00:00:00:00:00:" + src_domain_dpid + ":" + src_node_dpid
+ dst_dpid = "00:00:00:00:00:00:" + dst_domain_dpid + ":" + dst_node_dpid
+ # The flow from source to destination
+ print "%s FOOBAR %s 1 %s 1 matchSrcMac %s matchDstMac %s" % (flow_id, src_dpid, dst_dpid, src_mac, dst_mac)
+ flow_id = flow_id + 1
+ idx = idx + 1
+ node_id = node_id + 1
+ dst_domain_id = dst_domain_id + 1
+ src_domain_id = src_domain_id + 1
diff --git a/test-network/flows/test1_ons_flows_966.txt b/test-network/flows/test1_ons_flows_966.txt
new file mode 100644
index 0000000..0bd55a0
--- /dev/null
+++ b/test-network/flows/test1_ons_flows_966.txt
@@ -0,0 +1,966 @@
+1 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:00:00:00 matchDstMac 00:02:00:00:00:00
+2 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:01:00:00 matchDstMac 00:02:00:01:00:00
+3 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:02:00:00 matchDstMac 00:02:00:02:00:00
+4 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:00:03:00:00 matchDstMac 00:02:00:03:00:00
+5 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:00:04:00:00 matchDstMac 00:02:00:04:00:00
+6 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:00:05:00:00 matchDstMac 00:02:00:05:00:00
+7 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:00:06:00:00 matchDstMac 00:02:00:06:00:00
+8 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:00:07:00:00 matchDstMac 00:02:00:07:00:00
+9 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:00:08:00:00 matchDstMac 00:02:00:08:00:00
+10 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:00:09:00:00 matchDstMac 00:02:00:09:00:00
+11 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:00:0a:00:00 matchDstMac 00:02:00:0a:00:00
+12 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:00:0b:00:00 matchDstMac 00:02:00:0b:00:00
+13 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:00:0c:00:00 matchDstMac 00:02:00:0c:00:00
+14 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:00:0d:00:00 matchDstMac 00:02:00:0d:00:00
+15 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:00:0e:00:00 matchDstMac 00:02:00:0e:00:00
+16 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:00:0f:00:00 matchDstMac 00:02:00:0f:00:00
+17 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:00:10:00:00 matchDstMac 00:02:00:10:00:00
+18 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:00:11:00:00 matchDstMac 00:02:00:11:00:00
+19 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:00:12:00:00 matchDstMac 00:02:00:12:00:00
+20 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:00:13:00:00 matchDstMac 00:02:00:13:00:00
+21 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:00:14:00:00 matchDstMac 00:02:00:14:00:00
+22 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:00:15:00:00 matchDstMac 00:02:00:15:00:00
+23 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:00:16:00:00 matchDstMac 00:02:00:16:00:00
+24 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:17:00:00 matchDstMac 00:02:00:17:00:00
+25 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:18:00:00 matchDstMac 00:02:00:18:00:00
+26 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:19:00:00 matchDstMac 00:02:00:19:00:00
+27 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:00:1a:00:00 matchDstMac 00:02:00:1a:00:00
+28 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:00:1b:00:00 matchDstMac 00:02:00:1b:00:00
+29 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:00:1c:00:00 matchDstMac 00:02:00:1c:00:00
+30 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:00:1d:00:00 matchDstMac 00:02:00:1d:00:00
+31 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:00:1e:00:00 matchDstMac 00:02:00:1e:00:00
+32 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:00:1f:00:00 matchDstMac 00:02:00:1f:00:00
+33 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:00:20:00:00 matchDstMac 00:02:00:20:00:00
+34 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:00:21:00:00 matchDstMac 00:02:00:21:00:00
+35 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:00:22:00:00 matchDstMac 00:02:00:22:00:00
+36 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:00:23:00:00 matchDstMac 00:02:00:23:00:00
+37 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:00:24:00:00 matchDstMac 00:02:00:24:00:00
+38 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:00:25:00:00 matchDstMac 00:02:00:25:00:00
+39 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:00:26:00:00 matchDstMac 00:02:00:26:00:00
+40 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:00:27:00:00 matchDstMac 00:02:00:27:00:00
+41 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:00:28:00:00 matchDstMac 00:02:00:28:00:00
+42 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:00:29:00:00 matchDstMac 00:02:00:29:00:00
+43 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:00:2a:00:00 matchDstMac 00:02:00:2a:00:00
+44 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:00:2b:00:00 matchDstMac 00:02:00:2b:00:00
+45 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:00:2c:00:00 matchDstMac 00:02:00:2c:00:00
+46 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:00:2d:00:00 matchDstMac 00:02:00:2d:00:00
+47 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:2e:00:00 matchDstMac 00:02:00:2e:00:00
+48 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:2f:00:00 matchDstMac 00:02:00:2f:00:00
+49 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:30:00:00 matchDstMac 00:02:00:30:00:00
+50 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:00:31:00:00 matchDstMac 00:02:00:31:00:00
+51 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:00:32:00:00 matchDstMac 00:02:00:32:00:00
+52 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:00:33:00:00 matchDstMac 00:02:00:33:00:00
+53 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:00:34:00:00 matchDstMac 00:02:00:34:00:00
+54 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:00:35:00:00 matchDstMac 00:02:00:35:00:00
+55 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:00:36:00:00 matchDstMac 00:02:00:36:00:00
+56 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:00:37:00:00 matchDstMac 00:02:00:37:00:00
+57 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:00:38:00:00 matchDstMac 00:02:00:38:00:00
+58 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:00:39:00:00 matchDstMac 00:02:00:39:00:00
+59 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:00:3a:00:00 matchDstMac 00:02:00:3a:00:00
+60 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:00:3b:00:00 matchDstMac 00:02:00:3b:00:00
+61 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:00:3c:00:00 matchDstMac 00:02:00:3c:00:00
+62 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:00:3d:00:00 matchDstMac 00:02:00:3d:00:00
+63 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:00:3e:00:00 matchDstMac 00:02:00:3e:00:00
+64 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:00:3f:00:00 matchDstMac 00:02:00:3f:00:00
+65 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:00:40:00:00 matchDstMac 00:02:00:40:00:00
+66 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:00:41:00:00 matchDstMac 00:02:00:41:00:00
+67 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:00:42:00:00 matchDstMac 00:02:00:42:00:00
+68 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:00:43:00:00 matchDstMac 00:02:00:43:00:00
+69 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:00:44:00:00 matchDstMac 00:02:00:44:00:00
+70 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:45:00:00 matchDstMac 00:02:00:45:00:00
+71 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:46:00:00 matchDstMac 00:02:00:46:00:00
+72 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:47:00:00 matchDstMac 00:02:00:47:00:00
+73 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:00:48:00:00 matchDstMac 00:02:00:48:00:00
+74 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:00:49:00:00 matchDstMac 00:02:00:49:00:00
+75 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:00:4a:00:00 matchDstMac 00:02:00:4a:00:00
+76 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:00:4b:00:00 matchDstMac 00:02:00:4b:00:00
+77 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:00:4c:00:00 matchDstMac 00:02:00:4c:00:00
+78 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:00:4d:00:00 matchDstMac 00:02:00:4d:00:00
+79 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:00:4e:00:00 matchDstMac 00:02:00:4e:00:00
+80 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:00:4f:00:00 matchDstMac 00:02:00:4f:00:00
+81 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:00:50:00:00 matchDstMac 00:02:00:50:00:00
+82 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:00:51:00:00 matchDstMac 00:02:00:51:00:00
+83 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:00:52:00:00 matchDstMac 00:02:00:52:00:00
+84 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:00:53:00:00 matchDstMac 00:02:00:53:00:00
+85 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:00:54:00:00 matchDstMac 00:02:00:54:00:00
+86 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:00:55:00:00 matchDstMac 00:02:00:55:00:00
+87 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:00:56:00:00 matchDstMac 00:02:00:56:00:00
+88 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:00:57:00:00 matchDstMac 00:02:00:57:00:00
+89 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:00:58:00:00 matchDstMac 00:02:00:58:00:00
+90 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:00:59:00:00 matchDstMac 00:02:00:59:00:00
+91 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:00:5a:00:00 matchDstMac 00:02:00:5a:00:00
+92 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:00:5b:00:00 matchDstMac 00:02:00:5b:00:00
+93 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:5c:00:00 matchDstMac 00:02:00:5c:00:00
+94 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:5d:00:00 matchDstMac 00:02:00:5d:00:00
+95 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:5e:00:00 matchDstMac 00:02:00:5e:00:00
+96 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:00:5f:00:00 matchDstMac 00:02:00:5f:00:00
+97 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:00:60:00:00 matchDstMac 00:02:00:60:00:00
+98 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:00:61:00:00 matchDstMac 00:02:00:61:00:00
+99 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:00:62:00:00 matchDstMac 00:02:00:62:00:00
+100 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:00:63:00:00 matchDstMac 00:02:00:63:00:00
+101 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:00:64:00:00 matchDstMac 00:02:00:64:00:00
+102 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:00:65:00:00 matchDstMac 00:02:00:65:00:00
+103 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:00:66:00:00 matchDstMac 00:02:00:66:00:00
+104 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:00:67:00:00 matchDstMac 00:02:00:67:00:00
+105 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:00:68:00:00 matchDstMac 00:02:00:68:00:00
+106 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:00:69:00:00 matchDstMac 00:02:00:69:00:00
+107 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:00:6a:00:00 matchDstMac 00:02:00:6a:00:00
+108 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:00:6b:00:00 matchDstMac 00:02:00:6b:00:00
+109 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:00:6c:00:00 matchDstMac 00:02:00:6c:00:00
+110 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:00:6d:00:00 matchDstMac 00:02:00:6d:00:00
+111 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:00:6e:00:00 matchDstMac 00:02:00:6e:00:00
+112 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:00:6f:00:00 matchDstMac 00:02:00:6f:00:00
+113 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:00:70:00:00 matchDstMac 00:02:00:70:00:00
+114 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:00:71:00:00 matchDstMac 00:02:00:71:00:00
+115 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:00:72:00:00 matchDstMac 00:02:00:72:00:00
+116 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:73:00:00 matchDstMac 00:02:00:73:00:00
+117 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:74:00:00 matchDstMac 00:02:00:74:00:00
+118 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:75:00:00 matchDstMac 00:02:00:75:00:00
+119 FOOBAR 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:00:76:00:00 matchDstMac 00:02:00:76:00:00
+120 FOOBAR 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:00:77:00:00 matchDstMac 00:02:00:77:00:00
+121 FOOBAR 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:00:78:00:00 matchDstMac 00:02:00:78:00:00
+122 FOOBAR 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:00:79:00:00 matchDstMac 00:02:00:79:00:00
+123 FOOBAR 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:00:7a:00:00 matchDstMac 00:02:00:7a:00:00
+124 FOOBAR 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:00:7b:00:00 matchDstMac 00:02:00:7b:00:00
+125 FOOBAR 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:00:7c:00:00 matchDstMac 00:02:00:7c:00:00
+126 FOOBAR 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:00:7d:00:00 matchDstMac 00:02:00:7d:00:00
+127 FOOBAR 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:00:7e:00:00 matchDstMac 00:02:00:7e:00:00
+128 FOOBAR 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:00:7f:00:00 matchDstMac 00:02:00:7f:00:00
+129 FOOBAR 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:00:80:00:00 matchDstMac 00:02:00:80:00:00
+130 FOOBAR 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:00:81:00:00 matchDstMac 00:02:00:81:00:00
+131 FOOBAR 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:00:82:00:00 matchDstMac 00:02:00:82:00:00
+132 FOOBAR 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:00:83:00:00 matchDstMac 00:02:00:83:00:00
+133 FOOBAR 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:00:84:00:00 matchDstMac 00:02:00:84:00:00
+134 FOOBAR 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:00:85:00:00 matchDstMac 00:02:00:85:00:00
+135 FOOBAR 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:00:86:00:00 matchDstMac 00:02:00:86:00:00
+136 FOOBAR 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:00:87:00:00 matchDstMac 00:02:00:87:00:00
+137 FOOBAR 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:00:88:00:00 matchDstMac 00:02:00:88:00:00
+138 FOOBAR 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:00:89:00:00 matchDstMac 00:02:00:89:00:00
+139 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:8a:00:00 matchDstMac 00:02:00:8a:00:00
+140 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:8b:00:00 matchDstMac 00:02:00:8b:00:00
+141 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:8c:00:00 matchDstMac 00:02:00:8c:00:00
+142 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:00:8d:00:00 matchDstMac 00:02:00:8d:00:00
+143 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:00:8e:00:00 matchDstMac 00:02:00:8e:00:00
+144 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:00:8f:00:00 matchDstMac 00:02:00:8f:00:00
+145 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:00:90:00:00 matchDstMac 00:02:00:90:00:00
+146 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:00:91:00:00 matchDstMac 00:02:00:91:00:00
+147 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:00:92:00:00 matchDstMac 00:02:00:92:00:00
+148 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:00:93:00:00 matchDstMac 00:02:00:93:00:00
+149 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:00:94:00:00 matchDstMac 00:02:00:94:00:00
+150 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:00:95:00:00 matchDstMac 00:02:00:95:00:00
+151 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:00:96:00:00 matchDstMac 00:02:00:96:00:00
+152 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:00:97:00:00 matchDstMac 00:02:00:97:00:00
+153 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:00:98:00:00 matchDstMac 00:02:00:98:00:00
+154 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:00:99:00:00 matchDstMac 00:02:00:99:00:00
+155 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:00:9a:00:00 matchDstMac 00:02:00:9a:00:00
+156 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:00:9b:00:00 matchDstMac 00:02:00:9b:00:00
+157 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:00:9c:00:00 matchDstMac 00:02:00:9c:00:00
+158 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:00:9d:00:00 matchDstMac 00:02:00:9d:00:00
+159 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:00:9e:00:00 matchDstMac 00:02:00:9e:00:00
+160 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:00:9f:00:00 matchDstMac 00:02:00:9f:00:00
+161 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:00:a0:00:00 matchDstMac 00:02:00:a0:00:00
+162 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:a1:00:00 matchDstMac 00:02:00:a1:00:00
+163 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:a2:00:00 matchDstMac 00:02:00:a2:00:00
+164 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:a3:00:00 matchDstMac 00:02:00:a3:00:00
+165 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:00:a4:00:00 matchDstMac 00:02:00:a4:00:00
+166 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:00:a5:00:00 matchDstMac 00:02:00:a5:00:00
+167 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:00:a6:00:00 matchDstMac 00:02:00:a6:00:00
+168 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:00:a7:00:00 matchDstMac 00:02:00:a7:00:00
+169 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:00:a8:00:00 matchDstMac 00:02:00:a8:00:00
+170 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:00:a9:00:00 matchDstMac 00:02:00:a9:00:00
+171 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:00:aa:00:00 matchDstMac 00:02:00:aa:00:00
+172 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:00:ab:00:00 matchDstMac 00:02:00:ab:00:00
+173 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:00:ac:00:00 matchDstMac 00:02:00:ac:00:00
+174 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:00:ad:00:00 matchDstMac 00:02:00:ad:00:00
+175 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:00:ae:00:00 matchDstMac 00:02:00:ae:00:00
+176 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:00:af:00:00 matchDstMac 00:02:00:af:00:00
+177 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:00:b0:00:00 matchDstMac 00:02:00:b0:00:00
+178 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:00:b1:00:00 matchDstMac 00:02:00:b1:00:00
+179 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:00:b2:00:00 matchDstMac 00:02:00:b2:00:00
+180 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:00:b3:00:00 matchDstMac 00:02:00:b3:00:00
+181 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:00:b4:00:00 matchDstMac 00:02:00:b4:00:00
+182 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:00:b5:00:00 matchDstMac 00:02:00:b5:00:00
+183 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:00:b6:00:00 matchDstMac 00:02:00:b6:00:00
+184 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:00:b7:00:00 matchDstMac 00:02:00:b7:00:00
+185 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:b8:00:00 matchDstMac 00:02:00:b8:00:00
+186 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:b9:00:00 matchDstMac 00:02:00:b9:00:00
+187 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:ba:00:00 matchDstMac 00:02:00:ba:00:00
+188 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:00:bb:00:00 matchDstMac 00:02:00:bb:00:00
+189 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:00:bc:00:00 matchDstMac 00:02:00:bc:00:00
+190 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:00:bd:00:00 matchDstMac 00:02:00:bd:00:00
+191 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:00:be:00:00 matchDstMac 00:02:00:be:00:00
+192 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:00:bf:00:00 matchDstMac 00:02:00:bf:00:00
+193 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:00:c0:00:00 matchDstMac 00:02:00:c0:00:00
+194 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:00:c1:00:00 matchDstMac 00:02:00:c1:00:00
+195 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:00:c2:00:00 matchDstMac 00:02:00:c2:00:00
+196 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:00:c3:00:00 matchDstMac 00:02:00:c3:00:00
+197 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:00:c4:00:00 matchDstMac 00:02:00:c4:00:00
+198 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:00:c5:00:00 matchDstMac 00:02:00:c5:00:00
+199 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:00:c6:00:00 matchDstMac 00:02:00:c6:00:00
+200 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:00:c7:00:00 matchDstMac 00:02:00:c7:00:00
+201 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:00:c8:00:00 matchDstMac 00:02:00:c8:00:00
+202 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:00:c9:00:00 matchDstMac 00:02:00:c9:00:00
+203 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:00:ca:00:00 matchDstMac 00:02:00:ca:00:00
+204 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:00:cb:00:00 matchDstMac 00:02:00:cb:00:00
+205 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:00:cc:00:00 matchDstMac 00:02:00:cc:00:00
+206 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:00:cd:00:00 matchDstMac 00:02:00:cd:00:00
+207 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:00:ce:00:00 matchDstMac 00:02:00:ce:00:00
+208 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:cf:00:00 matchDstMac 00:02:00:cf:00:00
+209 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:d0:00:00 matchDstMac 00:02:00:d0:00:00
+210 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:d1:00:00 matchDstMac 00:02:00:d1:00:00
+211 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:00:d2:00:00 matchDstMac 00:02:00:d2:00:00
+212 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:00:d3:00:00 matchDstMac 00:02:00:d3:00:00
+213 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:00:d4:00:00 matchDstMac 00:02:00:d4:00:00
+214 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:00:d5:00:00 matchDstMac 00:02:00:d5:00:00
+215 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:00:d6:00:00 matchDstMac 00:02:00:d6:00:00
+216 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:00:d7:00:00 matchDstMac 00:02:00:d7:00:00
+217 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:00:d8:00:00 matchDstMac 00:02:00:d8:00:00
+218 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:00:d9:00:00 matchDstMac 00:02:00:d9:00:00
+219 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:00:da:00:00 matchDstMac 00:02:00:da:00:00
+220 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:00:db:00:00 matchDstMac 00:02:00:db:00:00
+221 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:00:dc:00:00 matchDstMac 00:02:00:dc:00:00
+222 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:00:dd:00:00 matchDstMac 00:02:00:dd:00:00
+223 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:00:de:00:00 matchDstMac 00:02:00:de:00:00
+224 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:00:df:00:00 matchDstMac 00:02:00:df:00:00
+225 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:00:e0:00:00 matchDstMac 00:02:00:e0:00:00
+226 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:00:e1:00:00 matchDstMac 00:02:00:e1:00:00
+227 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:00:e2:00:00 matchDstMac 00:02:00:e2:00:00
+228 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:00:e3:00:00 matchDstMac 00:02:00:e3:00:00
+229 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:00:e4:00:00 matchDstMac 00:02:00:e4:00:00
+230 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:00:e5:00:00 matchDstMac 00:02:00:e5:00:00
+231 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:e6:00:00 matchDstMac 00:02:00:e6:00:00
+232 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:e7:00:00 matchDstMac 00:02:00:e7:00:00
+233 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:e8:00:00 matchDstMac 00:02:00:e8:00:00
+234 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:00:e9:00:00 matchDstMac 00:02:00:e9:00:00
+235 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:00:ea:00:00 matchDstMac 00:02:00:ea:00:00
+236 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:00:eb:00:00 matchDstMac 00:02:00:eb:00:00
+237 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:00:ec:00:00 matchDstMac 00:02:00:ec:00:00
+238 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:00:ed:00:00 matchDstMac 00:02:00:ed:00:00
+239 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:00:ee:00:00 matchDstMac 00:02:00:ee:00:00
+240 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:00:ef:00:00 matchDstMac 00:02:00:ef:00:00
+241 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:00:f0:00:00 matchDstMac 00:02:00:f0:00:00
+242 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:00:f1:00:00 matchDstMac 00:02:00:f1:00:00
+243 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:00:f2:00:00 matchDstMac 00:02:00:f2:00:00
+244 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:00:f3:00:00 matchDstMac 00:02:00:f3:00:00
+245 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:00:f4:00:00 matchDstMac 00:02:00:f4:00:00
+246 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:00:f5:00:00 matchDstMac 00:02:00:f5:00:00
+247 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:00:f6:00:00 matchDstMac 00:02:00:f6:00:00
+248 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:00:f7:00:00 matchDstMac 00:02:00:f7:00:00
+249 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:00:f8:00:00 matchDstMac 00:02:00:f8:00:00
+250 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:00:f9:00:00 matchDstMac 00:02:00:f9:00:00
+251 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:00:fa:00:00 matchDstMac 00:02:00:fa:00:00
+252 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:00:fb:00:00 matchDstMac 00:02:00:fb:00:00
+253 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:00:fc:00:00 matchDstMac 00:02:00:fc:00:00
+254 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:fd:00:00 matchDstMac 00:02:00:fd:00:00
+255 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:fe:00:00 matchDstMac 00:02:00:fe:00:00
+256 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:01:00:00:00 matchDstMac 00:02:01:00:00:00
+257 FOOBAR 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:01:01:00:00 matchDstMac 00:02:01:01:00:00
+258 FOOBAR 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:01:02:00:00 matchDstMac 00:02:01:02:00:00
+259 FOOBAR 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:01:03:00:00 matchDstMac 00:02:01:03:00:00
+260 FOOBAR 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:01:04:00:00 matchDstMac 00:02:01:04:00:00
+261 FOOBAR 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:01:05:00:00 matchDstMac 00:02:01:05:00:00
+262 FOOBAR 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:01:06:00:00 matchDstMac 00:02:01:06:00:00
+263 FOOBAR 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:01:07:00:00 matchDstMac 00:02:01:07:00:00
+264 FOOBAR 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:01:08:00:00 matchDstMac 00:02:01:08:00:00
+265 FOOBAR 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:01:09:00:00 matchDstMac 00:02:01:09:00:00
+266 FOOBAR 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:01:0a:00:00 matchDstMac 00:02:01:0a:00:00
+267 FOOBAR 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:01:0b:00:00 matchDstMac 00:02:01:0b:00:00
+268 FOOBAR 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:01:0c:00:00 matchDstMac 00:02:01:0c:00:00
+269 FOOBAR 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:01:0d:00:00 matchDstMac 00:02:01:0d:00:00
+270 FOOBAR 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:01:0e:00:00 matchDstMac 00:02:01:0e:00:00
+271 FOOBAR 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:01:0f:00:00 matchDstMac 00:02:01:0f:00:00
+272 FOOBAR 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:01:10:00:00 matchDstMac 00:02:01:10:00:00
+273 FOOBAR 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:01:11:00:00 matchDstMac 00:02:01:11:00:00
+274 FOOBAR 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:01:12:00:00 matchDstMac 00:02:01:12:00:00
+275 FOOBAR 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:01:13:00:00 matchDstMac 00:02:01:13:00:00
+276 FOOBAR 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:01:14:00:00 matchDstMac 00:02:01:14:00:00
+277 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:01:15:00:00 matchDstMac 00:02:01:15:00:00
+278 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:01:16:00:00 matchDstMac 00:02:01:16:00:00
+279 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:01:17:00:00 matchDstMac 00:02:01:17:00:00
+280 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:01:18:00:00 matchDstMac 00:02:01:18:00:00
+281 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:01:19:00:00 matchDstMac 00:02:01:19:00:00
+282 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:01:1a:00:00 matchDstMac 00:02:01:1a:00:00
+283 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:01:1b:00:00 matchDstMac 00:02:01:1b:00:00
+284 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:01:1c:00:00 matchDstMac 00:02:01:1c:00:00
+285 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:01:1d:00:00 matchDstMac 00:02:01:1d:00:00
+286 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:01:1e:00:00 matchDstMac 00:02:01:1e:00:00
+287 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:01:1f:00:00 matchDstMac 00:02:01:1f:00:00
+288 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:01:20:00:00 matchDstMac 00:02:01:20:00:00
+289 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:01:21:00:00 matchDstMac 00:02:01:21:00:00
+290 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:01:22:00:00 matchDstMac 00:02:01:22:00:00
+291 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:01:23:00:00 matchDstMac 00:02:01:23:00:00
+292 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:01:24:00:00 matchDstMac 00:02:01:24:00:00
+293 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:01:25:00:00 matchDstMac 00:02:01:25:00:00
+294 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:01:26:00:00 matchDstMac 00:02:01:26:00:00
+295 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:01:27:00:00 matchDstMac 00:02:01:27:00:00
+296 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:01:28:00:00 matchDstMac 00:02:01:28:00:00
+297 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:01:29:00:00 matchDstMac 00:02:01:29:00:00
+298 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:01:2a:00:00 matchDstMac 00:02:01:2a:00:00
+299 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:01:2b:00:00 matchDstMac 00:02:01:2b:00:00
+300 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:01:2c:00:00 matchDstMac 00:02:01:2c:00:00
+301 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:01:2d:00:00 matchDstMac 00:02:01:2d:00:00
+302 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:01:2e:00:00 matchDstMac 00:02:01:2e:00:00
+303 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:01:2f:00:00 matchDstMac 00:02:01:2f:00:00
+304 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:01:30:00:00 matchDstMac 00:02:01:30:00:00
+305 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:01:31:00:00 matchDstMac 00:02:01:31:00:00
+306 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:01:32:00:00 matchDstMac 00:02:01:32:00:00
+307 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:01:33:00:00 matchDstMac 00:02:01:33:00:00
+308 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:01:34:00:00 matchDstMac 00:02:01:34:00:00
+309 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:01:35:00:00 matchDstMac 00:02:01:35:00:00
+310 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:01:36:00:00 matchDstMac 00:02:01:36:00:00
+311 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:01:37:00:00 matchDstMac 00:02:01:37:00:00
+312 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:01:38:00:00 matchDstMac 00:02:01:38:00:00
+313 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:01:39:00:00 matchDstMac 00:02:01:39:00:00
+314 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:01:3a:00:00 matchDstMac 00:02:01:3a:00:00
+315 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:01:3b:00:00 matchDstMac 00:02:01:3b:00:00
+316 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:01:3c:00:00 matchDstMac 00:02:01:3c:00:00
+317 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:01:3d:00:00 matchDstMac 00:02:01:3d:00:00
+318 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:01:3e:00:00 matchDstMac 00:02:01:3e:00:00
+319 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:01:3f:00:00 matchDstMac 00:02:01:3f:00:00
+320 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:01:40:00:00 matchDstMac 00:02:01:40:00:00
+321 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:01:41:00:00 matchDstMac 00:02:01:41:00:00
+322 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:01:42:00:00 matchDstMac 00:02:01:42:00:00
+323 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:01:43:00:00 matchDstMac 00:02:01:43:00:00
+324 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:01:44:00:00 matchDstMac 00:02:01:44:00:00
+325 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:01:45:00:00 matchDstMac 00:02:01:45:00:00
+326 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:01:46:00:00 matchDstMac 00:02:01:46:00:00
+327 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:01:47:00:00 matchDstMac 00:02:01:47:00:00
+328 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:01:48:00:00 matchDstMac 00:02:01:48:00:00
+329 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:01:49:00:00 matchDstMac 00:02:01:49:00:00
+330 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:01:4a:00:00 matchDstMac 00:02:01:4a:00:00
+331 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:01:4b:00:00 matchDstMac 00:02:01:4b:00:00
+332 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:01:4c:00:00 matchDstMac 00:02:01:4c:00:00
+333 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:01:4d:00:00 matchDstMac 00:02:01:4d:00:00
+334 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:01:4e:00:00 matchDstMac 00:02:01:4e:00:00
+335 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:01:4f:00:00 matchDstMac 00:02:01:4f:00:00
+336 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:01:50:00:00 matchDstMac 00:02:01:50:00:00
+337 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:01:51:00:00 matchDstMac 00:02:01:51:00:00
+338 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:01:52:00:00 matchDstMac 00:02:01:52:00:00
+339 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:01:53:00:00 matchDstMac 00:02:01:53:00:00
+340 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:01:54:00:00 matchDstMac 00:02:01:54:00:00
+341 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:01:55:00:00 matchDstMac 00:02:01:55:00:00
+342 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:01:56:00:00 matchDstMac 00:02:01:56:00:00
+343 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:01:57:00:00 matchDstMac 00:02:01:57:00:00
+344 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:01:58:00:00 matchDstMac 00:02:01:58:00:00
+345 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:01:59:00:00 matchDstMac 00:02:01:59:00:00
+346 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:01:5a:00:00 matchDstMac 00:02:01:5a:00:00
+347 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:01:5b:00:00 matchDstMac 00:02:01:5b:00:00
+348 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:01:5c:00:00 matchDstMac 00:02:01:5c:00:00
+349 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:01:5d:00:00 matchDstMac 00:02:01:5d:00:00
+350 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:01:5e:00:00 matchDstMac 00:02:01:5e:00:00
+351 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:01:5f:00:00 matchDstMac 00:02:01:5f:00:00
+352 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:01:60:00:00 matchDstMac 00:02:01:60:00:00
+353 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:01:61:00:00 matchDstMac 00:02:01:61:00:00
+354 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:01:62:00:00 matchDstMac 00:02:01:62:00:00
+355 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:01:63:00:00 matchDstMac 00:02:01:63:00:00
+356 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:01:64:00:00 matchDstMac 00:02:01:64:00:00
+357 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:01:65:00:00 matchDstMac 00:02:01:65:00:00
+358 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:01:66:00:00 matchDstMac 00:02:01:66:00:00
+359 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:01:67:00:00 matchDstMac 00:02:01:67:00:00
+360 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:01:68:00:00 matchDstMac 00:02:01:68:00:00
+361 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:01:69:00:00 matchDstMac 00:02:01:69:00:00
+362 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:01:6a:00:00 matchDstMac 00:02:01:6a:00:00
+363 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:01:6b:00:00 matchDstMac 00:02:01:6b:00:00
+364 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:01:6c:00:00 matchDstMac 00:02:01:6c:00:00
+365 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:01:6d:00:00 matchDstMac 00:02:01:6d:00:00
+366 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:01:6e:00:00 matchDstMac 00:02:01:6e:00:00
+367 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:01:6f:00:00 matchDstMac 00:02:01:6f:00:00
+368 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:01:70:00:00 matchDstMac 00:02:01:70:00:00
+369 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:01:71:00:00 matchDstMac 00:02:01:71:00:00
+370 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:01:72:00:00 matchDstMac 00:02:01:72:00:00
+371 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:01:73:00:00 matchDstMac 00:02:01:73:00:00
+372 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:01:74:00:00 matchDstMac 00:02:01:74:00:00
+373 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:01:75:00:00 matchDstMac 00:02:01:75:00:00
+374 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:01:76:00:00 matchDstMac 00:02:01:76:00:00
+375 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:01:77:00:00 matchDstMac 00:02:01:77:00:00
+376 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:01:78:00:00 matchDstMac 00:02:01:78:00:00
+377 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:01:79:00:00 matchDstMac 00:02:01:79:00:00
+378 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:01:7a:00:00 matchDstMac 00:02:01:7a:00:00
+379 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:01:7b:00:00 matchDstMac 00:02:01:7b:00:00
+380 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:01:7c:00:00 matchDstMac 00:02:01:7c:00:00
+381 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:01:7d:00:00 matchDstMac 00:02:01:7d:00:00
+382 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:01:7e:00:00 matchDstMac 00:02:01:7e:00:00
+383 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:01:7f:00:00 matchDstMac 00:02:01:7f:00:00
+384 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:01:80:00:00 matchDstMac 00:02:01:80:00:00
+385 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:01:81:00:00 matchDstMac 00:02:01:81:00:00
+386 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:01:82:00:00 matchDstMac 00:02:01:82:00:00
+387 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:01:83:00:00 matchDstMac 00:02:01:83:00:00
+388 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:01:84:00:00 matchDstMac 00:02:01:84:00:00
+389 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:01:85:00:00 matchDstMac 00:02:01:85:00:00
+390 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:01:86:00:00 matchDstMac 00:02:01:86:00:00
+391 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:01:87:00:00 matchDstMac 00:02:01:87:00:00
+392 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:01:88:00:00 matchDstMac 00:02:01:88:00:00
+393 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:01:89:00:00 matchDstMac 00:02:01:89:00:00
+394 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:01:8a:00:00 matchDstMac 00:02:01:8a:00:00
+395 FOOBAR 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:01:8b:00:00 matchDstMac 00:02:01:8b:00:00
+396 FOOBAR 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:01:8c:00:00 matchDstMac 00:02:01:8c:00:00
+397 FOOBAR 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:01:8d:00:00 matchDstMac 00:02:01:8d:00:00
+398 FOOBAR 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:01:8e:00:00 matchDstMac 00:02:01:8e:00:00
+399 FOOBAR 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:01:8f:00:00 matchDstMac 00:02:01:8f:00:00
+400 FOOBAR 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:01:90:00:00 matchDstMac 00:02:01:90:00:00
+401 FOOBAR 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:01:91:00:00 matchDstMac 00:02:01:91:00:00
+402 FOOBAR 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:01:92:00:00 matchDstMac 00:02:01:92:00:00
+403 FOOBAR 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:01:93:00:00 matchDstMac 00:02:01:93:00:00
+404 FOOBAR 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:01:94:00:00 matchDstMac 00:02:01:94:00:00
+405 FOOBAR 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:01:95:00:00 matchDstMac 00:02:01:95:00:00
+406 FOOBAR 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:01:96:00:00 matchDstMac 00:02:01:96:00:00
+407 FOOBAR 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:01:97:00:00 matchDstMac 00:02:01:97:00:00
+408 FOOBAR 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:01:98:00:00 matchDstMac 00:02:01:98:00:00
+409 FOOBAR 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:01:99:00:00 matchDstMac 00:02:01:99:00:00
+410 FOOBAR 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:01:9a:00:00 matchDstMac 00:02:01:9a:00:00
+411 FOOBAR 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:01:9b:00:00 matchDstMac 00:02:01:9b:00:00
+412 FOOBAR 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:01:9c:00:00 matchDstMac 00:02:01:9c:00:00
+413 FOOBAR 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:01:9d:00:00 matchDstMac 00:02:01:9d:00:00
+414 FOOBAR 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:01:9e:00:00 matchDstMac 00:02:01:9e:00:00
+415 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:01:9f:00:00 matchDstMac 00:02:01:9f:00:00
+416 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:01:a0:00:00 matchDstMac 00:02:01:a0:00:00
+417 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:01:a1:00:00 matchDstMac 00:02:01:a1:00:00
+418 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:01:a2:00:00 matchDstMac 00:02:01:a2:00:00
+419 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:01:a3:00:00 matchDstMac 00:02:01:a3:00:00
+420 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:01:a4:00:00 matchDstMac 00:02:01:a4:00:00
+421 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:01:a5:00:00 matchDstMac 00:02:01:a5:00:00
+422 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:01:a6:00:00 matchDstMac 00:02:01:a6:00:00
+423 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:01:a7:00:00 matchDstMac 00:02:01:a7:00:00
+424 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:01:a8:00:00 matchDstMac 00:02:01:a8:00:00
+425 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:01:a9:00:00 matchDstMac 00:02:01:a9:00:00
+426 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:01:aa:00:00 matchDstMac 00:02:01:aa:00:00
+427 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:01:ab:00:00 matchDstMac 00:02:01:ab:00:00
+428 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:01:ac:00:00 matchDstMac 00:02:01:ac:00:00
+429 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:01:ad:00:00 matchDstMac 00:02:01:ad:00:00
+430 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:01:ae:00:00 matchDstMac 00:02:01:ae:00:00
+431 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:01:af:00:00 matchDstMac 00:02:01:af:00:00
+432 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:01:b0:00:00 matchDstMac 00:02:01:b0:00:00
+433 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:01:b1:00:00 matchDstMac 00:02:01:b1:00:00
+434 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:01:b2:00:00 matchDstMac 00:02:01:b2:00:00
+435 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:01:b3:00:00 matchDstMac 00:02:01:b3:00:00
+436 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:01:b4:00:00 matchDstMac 00:02:01:b4:00:00
+437 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:01:b5:00:00 matchDstMac 00:02:01:b5:00:00
+438 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:01:b6:00:00 matchDstMac 00:02:01:b6:00:00
+439 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:01:b7:00:00 matchDstMac 00:02:01:b7:00:00
+440 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:01:b8:00:00 matchDstMac 00:02:01:b8:00:00
+441 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:01:b9:00:00 matchDstMac 00:02:01:b9:00:00
+442 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:01:ba:00:00 matchDstMac 00:02:01:ba:00:00
+443 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:01:bb:00:00 matchDstMac 00:02:01:bb:00:00
+444 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:01:bc:00:00 matchDstMac 00:02:01:bc:00:00
+445 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:01:bd:00:00 matchDstMac 00:02:01:bd:00:00
+446 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:01:be:00:00 matchDstMac 00:02:01:be:00:00
+447 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:01:bf:00:00 matchDstMac 00:02:01:bf:00:00
+448 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:01:c0:00:00 matchDstMac 00:02:01:c0:00:00
+449 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:01:c1:00:00 matchDstMac 00:02:01:c1:00:00
+450 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:01:c2:00:00 matchDstMac 00:02:01:c2:00:00
+451 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:01:c3:00:00 matchDstMac 00:02:01:c3:00:00
+452 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:01:c4:00:00 matchDstMac 00:02:01:c4:00:00
+453 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:01:c5:00:00 matchDstMac 00:02:01:c5:00:00
+454 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:01:c6:00:00 matchDstMac 00:02:01:c6:00:00
+455 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:01:c7:00:00 matchDstMac 00:02:01:c7:00:00
+456 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:01:c8:00:00 matchDstMac 00:02:01:c8:00:00
+457 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:01:c9:00:00 matchDstMac 00:02:01:c9:00:00
+458 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:01:ca:00:00 matchDstMac 00:02:01:ca:00:00
+459 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:01:cb:00:00 matchDstMac 00:02:01:cb:00:00
+460 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:01:cc:00:00 matchDstMac 00:02:01:cc:00:00
+461 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:01:cd:00:00 matchDstMac 00:02:01:cd:00:00
+462 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:01:ce:00:00 matchDstMac 00:02:01:ce:00:00
+463 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:01:cf:00:00 matchDstMac 00:02:01:cf:00:00
+464 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:01:d0:00:00 matchDstMac 00:02:01:d0:00:00
+465 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:01:d1:00:00 matchDstMac 00:02:01:d1:00:00
+466 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:01:d2:00:00 matchDstMac 00:02:01:d2:00:00
+467 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:01:d3:00:00 matchDstMac 00:02:01:d3:00:00
+468 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:01:d4:00:00 matchDstMac 00:02:01:d4:00:00
+469 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:01:d5:00:00 matchDstMac 00:02:01:d5:00:00
+470 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:01:d6:00:00 matchDstMac 00:02:01:d6:00:00
+471 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:01:d7:00:00 matchDstMac 00:02:01:d7:00:00
+472 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:01:d8:00:00 matchDstMac 00:02:01:d8:00:00
+473 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:01:d9:00:00 matchDstMac 00:02:01:d9:00:00
+474 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:01:da:00:00 matchDstMac 00:02:01:da:00:00
+475 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:01:db:00:00 matchDstMac 00:02:01:db:00:00
+476 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:01:dc:00:00 matchDstMac 00:02:01:dc:00:00
+477 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:01:dd:00:00 matchDstMac 00:02:01:dd:00:00
+478 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:01:de:00:00 matchDstMac 00:02:01:de:00:00
+479 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:01:df:00:00 matchDstMac 00:02:01:df:00:00
+480 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:01:e0:00:00 matchDstMac 00:02:01:e0:00:00
+481 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:01:e1:00:00 matchDstMac 00:02:01:e1:00:00
+482 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:01:e2:00:00 matchDstMac 00:02:01:e2:00:00
+483 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:01:e3:00:00 matchDstMac 00:02:01:e3:00:00
+484 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:01:e4:00:00 matchDstMac 00:02:01:e4:00:00
+485 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:01:e5:00:00 matchDstMac 00:02:01:e5:00:00
+486 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:01:e6:00:00 matchDstMac 00:02:01:e6:00:00
+487 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:01:e7:00:00 matchDstMac 00:02:01:e7:00:00
+488 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:01:e8:00:00 matchDstMac 00:02:01:e8:00:00
+489 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:01:e9:00:00 matchDstMac 00:02:01:e9:00:00
+490 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:01:ea:00:00 matchDstMac 00:02:01:ea:00:00
+491 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:01:eb:00:00 matchDstMac 00:02:01:eb:00:00
+492 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:01:ec:00:00 matchDstMac 00:02:01:ec:00:00
+493 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:01:ed:00:00 matchDstMac 00:02:01:ed:00:00
+494 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:01:ee:00:00 matchDstMac 00:02:01:ee:00:00
+495 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:01:ef:00:00 matchDstMac 00:02:01:ef:00:00
+496 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:01:f0:00:00 matchDstMac 00:02:01:f0:00:00
+497 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:01:f1:00:00 matchDstMac 00:02:01:f1:00:00
+498 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:01:f2:00:00 matchDstMac 00:02:01:f2:00:00
+499 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:01:f3:00:00 matchDstMac 00:02:01:f3:00:00
+500 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:01:f4:00:00 matchDstMac 00:02:01:f4:00:00
+501 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:01:f5:00:00 matchDstMac 00:02:01:f5:00:00
+502 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:01:f6:00:00 matchDstMac 00:02:01:f6:00:00
+503 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:01:f7:00:00 matchDstMac 00:02:01:f7:00:00
+504 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:01:f8:00:00 matchDstMac 00:02:01:f8:00:00
+505 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:01:f9:00:00 matchDstMac 00:02:01:f9:00:00
+506 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:01:fa:00:00 matchDstMac 00:02:01:fa:00:00
+507 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:01:fb:00:00 matchDstMac 00:02:01:fb:00:00
+508 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:01:fc:00:00 matchDstMac 00:02:01:fc:00:00
+509 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:01:fd:00:00 matchDstMac 00:02:01:fd:00:00
+510 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:01:fe:00:00 matchDstMac 00:02:01:fe:00:00
+511 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:02:00:00:00 matchDstMac 00:02:02:00:00:00
+512 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:02:01:00:00 matchDstMac 00:02:02:01:00:00
+513 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:02:02:00:00 matchDstMac 00:02:02:02:00:00
+514 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:02:03:00:00 matchDstMac 00:02:02:03:00:00
+515 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:02:04:00:00 matchDstMac 00:02:02:04:00:00
+516 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:02:05:00:00 matchDstMac 00:02:02:05:00:00
+517 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:02:06:00:00 matchDstMac 00:02:02:06:00:00
+518 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:02:07:00:00 matchDstMac 00:02:02:07:00:00
+519 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:02:08:00:00 matchDstMac 00:02:02:08:00:00
+520 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:02:09:00:00 matchDstMac 00:02:02:09:00:00
+521 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:02:0a:00:00 matchDstMac 00:02:02:0a:00:00
+522 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:02:0b:00:00 matchDstMac 00:02:02:0b:00:00
+523 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:02:0c:00:00 matchDstMac 00:02:02:0c:00:00
+524 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:02:0d:00:00 matchDstMac 00:02:02:0d:00:00
+525 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:02:0e:00:00 matchDstMac 00:02:02:0e:00:00
+526 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:02:0f:00:00 matchDstMac 00:02:02:0f:00:00
+527 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:02:10:00:00 matchDstMac 00:02:02:10:00:00
+528 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:02:11:00:00 matchDstMac 00:02:02:11:00:00
+529 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:02:12:00:00 matchDstMac 00:02:02:12:00:00
+530 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:02:13:00:00 matchDstMac 00:02:02:13:00:00
+531 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:02:14:00:00 matchDstMac 00:02:02:14:00:00
+532 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:02:15:00:00 matchDstMac 00:02:02:15:00:00
+533 FOOBAR 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:02:16:00:00 matchDstMac 00:02:02:16:00:00
+534 FOOBAR 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:02:17:00:00 matchDstMac 00:02:02:17:00:00
+535 FOOBAR 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:02:18:00:00 matchDstMac 00:02:02:18:00:00
+536 FOOBAR 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:02:19:00:00 matchDstMac 00:02:02:19:00:00
+537 FOOBAR 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:02:1a:00:00 matchDstMac 00:02:02:1a:00:00
+538 FOOBAR 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:02:1b:00:00 matchDstMac 00:02:02:1b:00:00
+539 FOOBAR 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:02:1c:00:00 matchDstMac 00:02:02:1c:00:00
+540 FOOBAR 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:02:1d:00:00 matchDstMac 00:02:02:1d:00:00
+541 FOOBAR 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:02:1e:00:00 matchDstMac 00:02:02:1e:00:00
+542 FOOBAR 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:02:1f:00:00 matchDstMac 00:02:02:1f:00:00
+543 FOOBAR 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:02:20:00:00 matchDstMac 00:02:02:20:00:00
+544 FOOBAR 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:02:21:00:00 matchDstMac 00:02:02:21:00:00
+545 FOOBAR 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:02:22:00:00 matchDstMac 00:02:02:22:00:00
+546 FOOBAR 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:02:23:00:00 matchDstMac 00:02:02:23:00:00
+547 FOOBAR 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:02:24:00:00 matchDstMac 00:02:02:24:00:00
+548 FOOBAR 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:02:25:00:00 matchDstMac 00:02:02:25:00:00
+549 FOOBAR 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:02:26:00:00 matchDstMac 00:02:02:26:00:00
+550 FOOBAR 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:02:27:00:00 matchDstMac 00:02:02:27:00:00
+551 FOOBAR 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:02:28:00:00 matchDstMac 00:02:02:28:00:00
+552 FOOBAR 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:02:29:00:00 matchDstMac 00:02:02:29:00:00
+553 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:02:2a:00:00 matchDstMac 00:02:02:2a:00:00
+554 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:02:2b:00:00 matchDstMac 00:02:02:2b:00:00
+555 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:02:2c:00:00 matchDstMac 00:02:02:2c:00:00
+556 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:02:2d:00:00 matchDstMac 00:02:02:2d:00:00
+557 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:02:2e:00:00 matchDstMac 00:02:02:2e:00:00
+558 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:02:2f:00:00 matchDstMac 00:02:02:2f:00:00
+559 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:02:30:00:00 matchDstMac 00:02:02:30:00:00
+560 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:02:31:00:00 matchDstMac 00:02:02:31:00:00
+561 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:02:32:00:00 matchDstMac 00:02:02:32:00:00
+562 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:02:33:00:00 matchDstMac 00:02:02:33:00:00
+563 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:02:34:00:00 matchDstMac 00:02:02:34:00:00
+564 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:02:35:00:00 matchDstMac 00:02:02:35:00:00
+565 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:02:36:00:00 matchDstMac 00:02:02:36:00:00
+566 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:02:37:00:00 matchDstMac 00:02:02:37:00:00
+567 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:02:38:00:00 matchDstMac 00:02:02:38:00:00
+568 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:02:39:00:00 matchDstMac 00:02:02:39:00:00
+569 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:02:3a:00:00 matchDstMac 00:02:02:3a:00:00
+570 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:02:3b:00:00 matchDstMac 00:02:02:3b:00:00
+571 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:02:3c:00:00 matchDstMac 00:02:02:3c:00:00
+572 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:02:3d:00:00 matchDstMac 00:02:02:3d:00:00
+573 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:02:3e:00:00 matchDstMac 00:02:02:3e:00:00
+574 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:02:3f:00:00 matchDstMac 00:02:02:3f:00:00
+575 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:02:40:00:00 matchDstMac 00:02:02:40:00:00
+576 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:02:41:00:00 matchDstMac 00:02:02:41:00:00
+577 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:02:42:00:00 matchDstMac 00:02:02:42:00:00
+578 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:02:43:00:00 matchDstMac 00:02:02:43:00:00
+579 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:02:44:00:00 matchDstMac 00:02:02:44:00:00
+580 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:02:45:00:00 matchDstMac 00:02:02:45:00:00
+581 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:02:46:00:00 matchDstMac 00:02:02:46:00:00
+582 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:02:47:00:00 matchDstMac 00:02:02:47:00:00
+583 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:02:48:00:00 matchDstMac 00:02:02:48:00:00
+584 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:02:49:00:00 matchDstMac 00:02:02:49:00:00
+585 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:02:4a:00:00 matchDstMac 00:02:02:4a:00:00
+586 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:02:4b:00:00 matchDstMac 00:02:02:4b:00:00
+587 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:02:4c:00:00 matchDstMac 00:02:02:4c:00:00
+588 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:02:4d:00:00 matchDstMac 00:02:02:4d:00:00
+589 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:02:4e:00:00 matchDstMac 00:02:02:4e:00:00
+590 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:02:4f:00:00 matchDstMac 00:02:02:4f:00:00
+591 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:02:50:00:00 matchDstMac 00:02:02:50:00:00
+592 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:02:51:00:00 matchDstMac 00:02:02:51:00:00
+593 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:02:52:00:00 matchDstMac 00:02:02:52:00:00
+594 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:02:53:00:00 matchDstMac 00:02:02:53:00:00
+595 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:02:54:00:00 matchDstMac 00:02:02:54:00:00
+596 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:02:55:00:00 matchDstMac 00:02:02:55:00:00
+597 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:02:56:00:00 matchDstMac 00:02:02:56:00:00
+598 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:02:57:00:00 matchDstMac 00:02:02:57:00:00
+599 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:02:58:00:00 matchDstMac 00:02:02:58:00:00
+600 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:02:59:00:00 matchDstMac 00:02:02:59:00:00
+601 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:02:5a:00:00 matchDstMac 00:02:02:5a:00:00
+602 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:02:5b:00:00 matchDstMac 00:02:02:5b:00:00
+603 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:02:5c:00:00 matchDstMac 00:02:02:5c:00:00
+604 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:02:5d:00:00 matchDstMac 00:02:02:5d:00:00
+605 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:02:5e:00:00 matchDstMac 00:02:02:5e:00:00
+606 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:02:5f:00:00 matchDstMac 00:02:02:5f:00:00
+607 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:02:60:00:00 matchDstMac 00:02:02:60:00:00
+608 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:02:61:00:00 matchDstMac 00:02:02:61:00:00
+609 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:02:62:00:00 matchDstMac 00:02:02:62:00:00
+610 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:02:63:00:00 matchDstMac 00:02:02:63:00:00
+611 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:02:64:00:00 matchDstMac 00:02:02:64:00:00
+612 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:02:65:00:00 matchDstMac 00:02:02:65:00:00
+613 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:02:66:00:00 matchDstMac 00:02:02:66:00:00
+614 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:02:67:00:00 matchDstMac 00:02:02:67:00:00
+615 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:02:68:00:00 matchDstMac 00:02:02:68:00:00
+616 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:02:69:00:00 matchDstMac 00:02:02:69:00:00
+617 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:02:6a:00:00 matchDstMac 00:02:02:6a:00:00
+618 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:02:6b:00:00 matchDstMac 00:02:02:6b:00:00
+619 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:02:6c:00:00 matchDstMac 00:02:02:6c:00:00
+620 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:02:6d:00:00 matchDstMac 00:02:02:6d:00:00
+621 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:02:6e:00:00 matchDstMac 00:02:02:6e:00:00
+622 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:02:6f:00:00 matchDstMac 00:02:02:6f:00:00
+623 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:02:70:00:00 matchDstMac 00:02:02:70:00:00
+624 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:02:71:00:00 matchDstMac 00:02:02:71:00:00
+625 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:02:72:00:00 matchDstMac 00:02:02:72:00:00
+626 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:02:73:00:00 matchDstMac 00:02:02:73:00:00
+627 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:02:74:00:00 matchDstMac 00:02:02:74:00:00
+628 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:02:75:00:00 matchDstMac 00:02:02:75:00:00
+629 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:02:76:00:00 matchDstMac 00:02:02:76:00:00
+630 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:02:77:00:00 matchDstMac 00:02:02:77:00:00
+631 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:02:78:00:00 matchDstMac 00:02:02:78:00:00
+632 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:02:79:00:00 matchDstMac 00:02:02:79:00:00
+633 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:02:7a:00:00 matchDstMac 00:02:02:7a:00:00
+634 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:02:7b:00:00 matchDstMac 00:02:02:7b:00:00
+635 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:02:7c:00:00 matchDstMac 00:02:02:7c:00:00
+636 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:02:7d:00:00 matchDstMac 00:02:02:7d:00:00
+637 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:02:7e:00:00 matchDstMac 00:02:02:7e:00:00
+638 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:02:7f:00:00 matchDstMac 00:02:02:7f:00:00
+639 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:02:80:00:00 matchDstMac 00:02:02:80:00:00
+640 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:02:81:00:00 matchDstMac 00:02:02:81:00:00
+641 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:02:82:00:00 matchDstMac 00:02:02:82:00:00
+642 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:02:83:00:00 matchDstMac 00:02:02:83:00:00
+643 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:02:84:00:00 matchDstMac 00:02:02:84:00:00
+644 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:02:85:00:00 matchDstMac 00:02:02:85:00:00
+645 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:02:86:00:00 matchDstMac 00:02:02:86:00:00
+646 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:02:87:00:00 matchDstMac 00:02:02:87:00:00
+647 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:02:88:00:00 matchDstMac 00:02:02:88:00:00
+648 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:02:89:00:00 matchDstMac 00:02:02:89:00:00
+649 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:02:8a:00:00 matchDstMac 00:02:02:8a:00:00
+650 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:02:8b:00:00 matchDstMac 00:02:02:8b:00:00
+651 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:02:8c:00:00 matchDstMac 00:02:02:8c:00:00
+652 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:02:8d:00:00 matchDstMac 00:02:02:8d:00:00
+653 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:02:8e:00:00 matchDstMac 00:02:02:8e:00:00
+654 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:02:8f:00:00 matchDstMac 00:02:02:8f:00:00
+655 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:02:90:00:00 matchDstMac 00:02:02:90:00:00
+656 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:02:91:00:00 matchDstMac 00:02:02:91:00:00
+657 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:02:92:00:00 matchDstMac 00:02:02:92:00:00
+658 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:02:93:00:00 matchDstMac 00:02:02:93:00:00
+659 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:02:94:00:00 matchDstMac 00:02:02:94:00:00
+660 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:02:95:00:00 matchDstMac 00:02:02:95:00:00
+661 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:02:96:00:00 matchDstMac 00:02:02:96:00:00
+662 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:02:97:00:00 matchDstMac 00:02:02:97:00:00
+663 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:02:98:00:00 matchDstMac 00:02:02:98:00:00
+664 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:02:99:00:00 matchDstMac 00:02:02:99:00:00
+665 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:02:9a:00:00 matchDstMac 00:02:02:9a:00:00
+666 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:02:9b:00:00 matchDstMac 00:02:02:9b:00:00
+667 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:02:9c:00:00 matchDstMac 00:02:02:9c:00:00
+668 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:02:9d:00:00 matchDstMac 00:02:02:9d:00:00
+669 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:02:9e:00:00 matchDstMac 00:02:02:9e:00:00
+670 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:02:9f:00:00 matchDstMac 00:02:02:9f:00:00
+671 FOOBAR 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:02:a0:00:00 matchDstMac 00:02:02:a0:00:00
+672 FOOBAR 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:02:a1:00:00 matchDstMac 00:02:02:a1:00:00
+673 FOOBAR 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:02:a2:00:00 matchDstMac 00:02:02:a2:00:00
+674 FOOBAR 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:02:a3:00:00 matchDstMac 00:02:02:a3:00:00
+675 FOOBAR 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:02:a4:00:00 matchDstMac 00:02:02:a4:00:00
+676 FOOBAR 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:02:a5:00:00 matchDstMac 00:02:02:a5:00:00
+677 FOOBAR 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:02:a6:00:00 matchDstMac 00:02:02:a6:00:00
+678 FOOBAR 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:02:a7:00:00 matchDstMac 00:02:02:a7:00:00
+679 FOOBAR 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:02:a8:00:00 matchDstMac 00:02:02:a8:00:00
+680 FOOBAR 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:02:a9:00:00 matchDstMac 00:02:02:a9:00:00
+681 FOOBAR 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:02:aa:00:00 matchDstMac 00:02:02:aa:00:00
+682 FOOBAR 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:02:ab:00:00 matchDstMac 00:02:02:ab:00:00
+683 FOOBAR 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:02:ac:00:00 matchDstMac 00:02:02:ac:00:00
+684 FOOBAR 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:02:ad:00:00 matchDstMac 00:02:02:ad:00:00
+685 FOOBAR 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:02:ae:00:00 matchDstMac 00:02:02:ae:00:00
+686 FOOBAR 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:02:af:00:00 matchDstMac 00:02:02:af:00:00
+687 FOOBAR 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:02:b0:00:00 matchDstMac 00:02:02:b0:00:00
+688 FOOBAR 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:02:b1:00:00 matchDstMac 00:02:02:b1:00:00
+689 FOOBAR 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:02:b2:00:00 matchDstMac 00:02:02:b2:00:00
+690 FOOBAR 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:02:b3:00:00 matchDstMac 00:02:02:b3:00:00
+691 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:02:b4:00:00 matchDstMac 00:02:02:b4:00:00
+692 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:02:b5:00:00 matchDstMac 00:02:02:b5:00:00
+693 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:02:b6:00:00 matchDstMac 00:02:02:b6:00:00
+694 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:02:b7:00:00 matchDstMac 00:02:02:b7:00:00
+695 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:02:b8:00:00 matchDstMac 00:02:02:b8:00:00
+696 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:02:b9:00:00 matchDstMac 00:02:02:b9:00:00
+697 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:02:ba:00:00 matchDstMac 00:02:02:ba:00:00
+698 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:02:bb:00:00 matchDstMac 00:02:02:bb:00:00
+699 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:02:bc:00:00 matchDstMac 00:02:02:bc:00:00
+700 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:02:bd:00:00 matchDstMac 00:02:02:bd:00:00
+701 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:02:be:00:00 matchDstMac 00:02:02:be:00:00
+702 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:02:bf:00:00 matchDstMac 00:02:02:bf:00:00
+703 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:02:c0:00:00 matchDstMac 00:02:02:c0:00:00
+704 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:02:c1:00:00 matchDstMac 00:02:02:c1:00:00
+705 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:02:c2:00:00 matchDstMac 00:02:02:c2:00:00
+706 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:02:c3:00:00 matchDstMac 00:02:02:c3:00:00
+707 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:02:c4:00:00 matchDstMac 00:02:02:c4:00:00
+708 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:02:c5:00:00 matchDstMac 00:02:02:c5:00:00
+709 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:02:c6:00:00 matchDstMac 00:02:02:c6:00:00
+710 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:02:c7:00:00 matchDstMac 00:02:02:c7:00:00
+711 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:02:c8:00:00 matchDstMac 00:02:02:c8:00:00
+712 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:02:c9:00:00 matchDstMac 00:02:02:c9:00:00
+713 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:02:ca:00:00 matchDstMac 00:02:02:ca:00:00
+714 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:02:cb:00:00 matchDstMac 00:02:02:cb:00:00
+715 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:02:cc:00:00 matchDstMac 00:02:02:cc:00:00
+716 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:02:cd:00:00 matchDstMac 00:02:02:cd:00:00
+717 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:02:ce:00:00 matchDstMac 00:02:02:ce:00:00
+718 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:02:cf:00:00 matchDstMac 00:02:02:cf:00:00
+719 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:02:d0:00:00 matchDstMac 00:02:02:d0:00:00
+720 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:02:d1:00:00 matchDstMac 00:02:02:d1:00:00
+721 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:02:d2:00:00 matchDstMac 00:02:02:d2:00:00
+722 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:02:d3:00:00 matchDstMac 00:02:02:d3:00:00
+723 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:02:d4:00:00 matchDstMac 00:02:02:d4:00:00
+724 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:02:d5:00:00 matchDstMac 00:02:02:d5:00:00
+725 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:02:d6:00:00 matchDstMac 00:02:02:d6:00:00
+726 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:02:d7:00:00 matchDstMac 00:02:02:d7:00:00
+727 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:02:d8:00:00 matchDstMac 00:02:02:d8:00:00
+728 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:02:d9:00:00 matchDstMac 00:02:02:d9:00:00
+729 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:02:da:00:00 matchDstMac 00:02:02:da:00:00
+730 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:02:db:00:00 matchDstMac 00:02:02:db:00:00
+731 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:02:dc:00:00 matchDstMac 00:02:02:dc:00:00
+732 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:02:dd:00:00 matchDstMac 00:02:02:dd:00:00
+733 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:02:de:00:00 matchDstMac 00:02:02:de:00:00
+734 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:02:df:00:00 matchDstMac 00:02:02:df:00:00
+735 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:02:e0:00:00 matchDstMac 00:02:02:e0:00:00
+736 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:02:e1:00:00 matchDstMac 00:02:02:e1:00:00
+737 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:02:e2:00:00 matchDstMac 00:02:02:e2:00:00
+738 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:02:e3:00:00 matchDstMac 00:02:02:e3:00:00
+739 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:02:e4:00:00 matchDstMac 00:02:02:e4:00:00
+740 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:02:e5:00:00 matchDstMac 00:02:02:e5:00:00
+741 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:02:e6:00:00 matchDstMac 00:02:02:e6:00:00
+742 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:02:e7:00:00 matchDstMac 00:02:02:e7:00:00
+743 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:02:e8:00:00 matchDstMac 00:02:02:e8:00:00
+744 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:02:e9:00:00 matchDstMac 00:02:02:e9:00:00
+745 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:02:ea:00:00 matchDstMac 00:02:02:ea:00:00
+746 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:02:eb:00:00 matchDstMac 00:02:02:eb:00:00
+747 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:02:ec:00:00 matchDstMac 00:02:02:ec:00:00
+748 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:02:ed:00:00 matchDstMac 00:02:02:ed:00:00
+749 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:02:ee:00:00 matchDstMac 00:02:02:ee:00:00
+750 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:02:ef:00:00 matchDstMac 00:02:02:ef:00:00
+751 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:02:f0:00:00 matchDstMac 00:02:02:f0:00:00
+752 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:02:f1:00:00 matchDstMac 00:02:02:f1:00:00
+753 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:02:f2:00:00 matchDstMac 00:02:02:f2:00:00
+754 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:02:f3:00:00 matchDstMac 00:02:02:f3:00:00
+755 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:02:f4:00:00 matchDstMac 00:02:02:f4:00:00
+756 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:02:f5:00:00 matchDstMac 00:02:02:f5:00:00
+757 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:02:f6:00:00 matchDstMac 00:02:02:f6:00:00
+758 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:02:f7:00:00 matchDstMac 00:02:02:f7:00:00
+759 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:02:f8:00:00 matchDstMac 00:02:02:f8:00:00
+760 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:02:f9:00:00 matchDstMac 00:02:02:f9:00:00
+761 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:02:fa:00:00 matchDstMac 00:02:02:fa:00:00
+762 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:02:fb:00:00 matchDstMac 00:02:02:fb:00:00
+763 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:02:fc:00:00 matchDstMac 00:02:02:fc:00:00
+764 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:02:fd:00:00 matchDstMac 00:02:02:fd:00:00
+765 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:02:fe:00:00 matchDstMac 00:02:02:fe:00:00
+766 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:03:00:00:00 matchDstMac 00:02:03:00:00:00
+767 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:03:01:00:00 matchDstMac 00:02:03:01:00:00
+768 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:03:02:00:00 matchDstMac 00:02:03:02:00:00
+769 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:03:03:00:00 matchDstMac 00:02:03:03:00:00
+770 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:03:04:00:00 matchDstMac 00:02:03:04:00:00
+771 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:03:05:00:00 matchDstMac 00:02:03:05:00:00
+772 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:03:06:00:00 matchDstMac 00:02:03:06:00:00
+773 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:03:07:00:00 matchDstMac 00:02:03:07:00:00
+774 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:03:08:00:00 matchDstMac 00:02:03:08:00:00
+775 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:03:09:00:00 matchDstMac 00:02:03:09:00:00
+776 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:03:0a:00:00 matchDstMac 00:02:03:0a:00:00
+777 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:03:0b:00:00 matchDstMac 00:02:03:0b:00:00
+778 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:03:0c:00:00 matchDstMac 00:02:03:0c:00:00
+779 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:03:0d:00:00 matchDstMac 00:02:03:0d:00:00
+780 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:03:0e:00:00 matchDstMac 00:02:03:0e:00:00
+781 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:03:0f:00:00 matchDstMac 00:02:03:0f:00:00
+782 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:03:10:00:00 matchDstMac 00:02:03:10:00:00
+783 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:03:11:00:00 matchDstMac 00:02:03:11:00:00
+784 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:03:12:00:00 matchDstMac 00:02:03:12:00:00
+785 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:03:13:00:00 matchDstMac 00:02:03:13:00:00
+786 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:03:14:00:00 matchDstMac 00:02:03:14:00:00
+787 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:03:15:00:00 matchDstMac 00:02:03:15:00:00
+788 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:03:16:00:00 matchDstMac 00:02:03:16:00:00
+789 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:03:17:00:00 matchDstMac 00:02:03:17:00:00
+790 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:03:18:00:00 matchDstMac 00:02:03:18:00:00
+791 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:03:19:00:00 matchDstMac 00:02:03:19:00:00
+792 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:03:1a:00:00 matchDstMac 00:02:03:1a:00:00
+793 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:03:1b:00:00 matchDstMac 00:02:03:1b:00:00
+794 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:03:1c:00:00 matchDstMac 00:02:03:1c:00:00
+795 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:03:1d:00:00 matchDstMac 00:02:03:1d:00:00
+796 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:03:1e:00:00 matchDstMac 00:02:03:1e:00:00
+797 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:03:1f:00:00 matchDstMac 00:02:03:1f:00:00
+798 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:03:20:00:00 matchDstMac 00:02:03:20:00:00
+799 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:03:21:00:00 matchDstMac 00:02:03:21:00:00
+800 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:03:22:00:00 matchDstMac 00:02:03:22:00:00
+801 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:03:23:00:00 matchDstMac 00:02:03:23:00:00
+802 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:03:24:00:00 matchDstMac 00:02:03:24:00:00
+803 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:03:25:00:00 matchDstMac 00:02:03:25:00:00
+804 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:03:26:00:00 matchDstMac 00:02:03:26:00:00
+805 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:03:27:00:00 matchDstMac 00:02:03:27:00:00
+806 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:03:28:00:00 matchDstMac 00:02:03:28:00:00
+807 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:03:29:00:00 matchDstMac 00:02:03:29:00:00
+808 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:03:2a:00:00 matchDstMac 00:02:03:2a:00:00
+809 FOOBAR 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:01:03:2b:00:00 matchDstMac 00:02:03:2b:00:00
+810 FOOBAR 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:01:03:2c:00:00 matchDstMac 00:02:03:2c:00:00
+811 FOOBAR 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:01:03:2d:00:00 matchDstMac 00:02:03:2d:00:00
+812 FOOBAR 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:01:03:2e:00:00 matchDstMac 00:02:03:2e:00:00
+813 FOOBAR 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:01:03:2f:00:00 matchDstMac 00:02:03:2f:00:00
+814 FOOBAR 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:01:03:30:00:00 matchDstMac 00:02:03:30:00:00
+815 FOOBAR 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:01:03:31:00:00 matchDstMac 00:02:03:31:00:00
+816 FOOBAR 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:01:03:32:00:00 matchDstMac 00:02:03:32:00:00
+817 FOOBAR 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:01:03:33:00:00 matchDstMac 00:02:03:33:00:00
+818 FOOBAR 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:01:03:34:00:00 matchDstMac 00:02:03:34:00:00
+819 FOOBAR 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:01:03:35:00:00 matchDstMac 00:02:03:35:00:00
+820 FOOBAR 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:01:03:36:00:00 matchDstMac 00:02:03:36:00:00
+821 FOOBAR 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:01:03:37:00:00 matchDstMac 00:02:03:37:00:00
+822 FOOBAR 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:01:03:38:00:00 matchDstMac 00:02:03:38:00:00
+823 FOOBAR 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:01:03:39:00:00 matchDstMac 00:02:03:39:00:00
+824 FOOBAR 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:01:03:3a:00:00 matchDstMac 00:02:03:3a:00:00
+825 FOOBAR 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:01:03:3b:00:00 matchDstMac 00:02:03:3b:00:00
+826 FOOBAR 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:01:03:3c:00:00 matchDstMac 00:02:03:3c:00:00
+827 FOOBAR 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:01:03:3d:00:00 matchDstMac 00:02:03:3d:00:00
+828 FOOBAR 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:01:03:3e:00:00 matchDstMac 00:02:03:3e:00:00
+829 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:03:3f:00:00 matchDstMac 00:02:03:3f:00:00
+830 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:03:40:00:00 matchDstMac 00:02:03:40:00:00
+831 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:03:41:00:00 matchDstMac 00:02:03:41:00:00
+832 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:01:03:42:00:00 matchDstMac 00:02:03:42:00:00
+833 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:01:03:43:00:00 matchDstMac 00:02:03:43:00:00
+834 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:01:03:44:00:00 matchDstMac 00:02:03:44:00:00
+835 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:01:03:45:00:00 matchDstMac 00:02:03:45:00:00
+836 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:01:03:46:00:00 matchDstMac 00:02:03:46:00:00
+837 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:01:03:47:00:00 matchDstMac 00:02:03:47:00:00
+838 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:01:03:48:00:00 matchDstMac 00:02:03:48:00:00
+839 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:01:03:49:00:00 matchDstMac 00:02:03:49:00:00
+840 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:01:03:4a:00:00 matchDstMac 00:02:03:4a:00:00
+841 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:01:03:4b:00:00 matchDstMac 00:02:03:4b:00:00
+842 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:01:03:4c:00:00 matchDstMac 00:02:03:4c:00:00
+843 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:01:03:4d:00:00 matchDstMac 00:02:03:4d:00:00
+844 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:01:03:4e:00:00 matchDstMac 00:02:03:4e:00:00
+845 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:01:03:4f:00:00 matchDstMac 00:02:03:4f:00:00
+846 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:01:03:50:00:00 matchDstMac 00:02:03:50:00:00
+847 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:01:03:51:00:00 matchDstMac 00:02:03:51:00:00
+848 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:01:03:52:00:00 matchDstMac 00:02:03:52:00:00
+849 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:01:03:53:00:00 matchDstMac 00:02:03:53:00:00
+850 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:01:03:54:00:00 matchDstMac 00:02:03:54:00:00
+851 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:01:03:55:00:00 matchDstMac 00:02:03:55:00:00
+852 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:03:56:00:00 matchDstMac 00:02:03:56:00:00
+853 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:03:57:00:00 matchDstMac 00:02:03:57:00:00
+854 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:03:58:00:00 matchDstMac 00:02:03:58:00:00
+855 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:01:03:59:00:00 matchDstMac 00:02:03:59:00:00
+856 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:01:03:5a:00:00 matchDstMac 00:02:03:5a:00:00
+857 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:01:03:5b:00:00 matchDstMac 00:02:03:5b:00:00
+858 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:01:03:5c:00:00 matchDstMac 00:02:03:5c:00:00
+859 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:01:03:5d:00:00 matchDstMac 00:02:03:5d:00:00
+860 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:01:03:5e:00:00 matchDstMac 00:02:03:5e:00:00
+861 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:01:03:5f:00:00 matchDstMac 00:02:03:5f:00:00
+862 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:01:03:60:00:00 matchDstMac 00:02:03:60:00:00
+863 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:01:03:61:00:00 matchDstMac 00:02:03:61:00:00
+864 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:01:03:62:00:00 matchDstMac 00:02:03:62:00:00
+865 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:01:03:63:00:00 matchDstMac 00:02:03:63:00:00
+866 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:01:03:64:00:00 matchDstMac 00:02:03:64:00:00
+867 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:01:03:65:00:00 matchDstMac 00:02:03:65:00:00
+868 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:01:03:66:00:00 matchDstMac 00:02:03:66:00:00
+869 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:01:03:67:00:00 matchDstMac 00:02:03:67:00:00
+870 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:01:03:68:00:00 matchDstMac 00:02:03:68:00:00
+871 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:01:03:69:00:00 matchDstMac 00:02:03:69:00:00
+872 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:01:03:6a:00:00 matchDstMac 00:02:03:6a:00:00
+873 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:01:03:6b:00:00 matchDstMac 00:02:03:6b:00:00
+874 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:01:03:6c:00:00 matchDstMac 00:02:03:6c:00:00
+875 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:03:6d:00:00 matchDstMac 00:02:03:6d:00:00
+876 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:03:6e:00:00 matchDstMac 00:02:03:6e:00:00
+877 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:03:6f:00:00 matchDstMac 00:02:03:6f:00:00
+878 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:01:03:70:00:00 matchDstMac 00:02:03:70:00:00
+879 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:01:03:71:00:00 matchDstMac 00:02:03:71:00:00
+880 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:01:03:72:00:00 matchDstMac 00:02:03:72:00:00
+881 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:01:03:73:00:00 matchDstMac 00:02:03:73:00:00
+882 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:01:03:74:00:00 matchDstMac 00:02:03:74:00:00
+883 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:01:03:75:00:00 matchDstMac 00:02:03:75:00:00
+884 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:01:03:76:00:00 matchDstMac 00:02:03:76:00:00
+885 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:01:03:77:00:00 matchDstMac 00:02:03:77:00:00
+886 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:01:03:78:00:00 matchDstMac 00:02:03:78:00:00
+887 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:01:03:79:00:00 matchDstMac 00:02:03:79:00:00
+888 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:01:03:7a:00:00 matchDstMac 00:02:03:7a:00:00
+889 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:01:03:7b:00:00 matchDstMac 00:02:03:7b:00:00
+890 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:01:03:7c:00:00 matchDstMac 00:02:03:7c:00:00
+891 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:01:03:7d:00:00 matchDstMac 00:02:03:7d:00:00
+892 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:01:03:7e:00:00 matchDstMac 00:02:03:7e:00:00
+893 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:01:03:7f:00:00 matchDstMac 00:02:03:7f:00:00
+894 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:01:03:80:00:00 matchDstMac 00:02:03:80:00:00
+895 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:01:03:81:00:00 matchDstMac 00:02:03:81:00:00
+896 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:01:03:82:00:00 matchDstMac 00:02:03:82:00:00
+897 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:01:03:83:00:00 matchDstMac 00:02:03:83:00:00
+898 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:03:84:00:00 matchDstMac 00:02:03:84:00:00
+899 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:03:85:00:00 matchDstMac 00:02:03:85:00:00
+900 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:03:86:00:00 matchDstMac 00:02:03:86:00:00
+901 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:01:03:87:00:00 matchDstMac 00:02:03:87:00:00
+902 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:01:03:88:00:00 matchDstMac 00:02:03:88:00:00
+903 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:01:03:89:00:00 matchDstMac 00:02:03:89:00:00
+904 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:01:03:8a:00:00 matchDstMac 00:02:03:8a:00:00
+905 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:01:03:8b:00:00 matchDstMac 00:02:03:8b:00:00
+906 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:01:03:8c:00:00 matchDstMac 00:02:03:8c:00:00
+907 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:01:03:8d:00:00 matchDstMac 00:02:03:8d:00:00
+908 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:01:03:8e:00:00 matchDstMac 00:02:03:8e:00:00
+909 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:01:03:8f:00:00 matchDstMac 00:02:03:8f:00:00
+910 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:01:03:90:00:00 matchDstMac 00:02:03:90:00:00
+911 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:01:03:91:00:00 matchDstMac 00:02:03:91:00:00
+912 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:01:03:92:00:00 matchDstMac 00:02:03:92:00:00
+913 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:01:03:93:00:00 matchDstMac 00:02:03:93:00:00
+914 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:01:03:94:00:00 matchDstMac 00:02:03:94:00:00
+915 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:01:03:95:00:00 matchDstMac 00:02:03:95:00:00
+916 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:01:03:96:00:00 matchDstMac 00:02:03:96:00:00
+917 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:01:03:97:00:00 matchDstMac 00:02:03:97:00:00
+918 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:01:03:98:00:00 matchDstMac 00:02:03:98:00:00
+919 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:01:03:99:00:00 matchDstMac 00:02:03:99:00:00
+920 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:01:03:9a:00:00 matchDstMac 00:02:03:9a:00:00
+921 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:03:9b:00:00 matchDstMac 00:02:03:9b:00:00
+922 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:03:9c:00:00 matchDstMac 00:02:03:9c:00:00
+923 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:03:9d:00:00 matchDstMac 00:02:03:9d:00:00
+924 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:01:03:9e:00:00 matchDstMac 00:02:03:9e:00:00
+925 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:01:03:9f:00:00 matchDstMac 00:02:03:9f:00:00
+926 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:01:03:a0:00:00 matchDstMac 00:02:03:a0:00:00
+927 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:01:03:a1:00:00 matchDstMac 00:02:03:a1:00:00
+928 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:01:03:a2:00:00 matchDstMac 00:02:03:a2:00:00
+929 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:01:03:a3:00:00 matchDstMac 00:02:03:a3:00:00
+930 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:01:03:a4:00:00 matchDstMac 00:02:03:a4:00:00
+931 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:01:03:a5:00:00 matchDstMac 00:02:03:a5:00:00
+932 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:01:03:a6:00:00 matchDstMac 00:02:03:a6:00:00
+933 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:01:03:a7:00:00 matchDstMac 00:02:03:a7:00:00
+934 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:01:03:a8:00:00 matchDstMac 00:02:03:a8:00:00
+935 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:01:03:a9:00:00 matchDstMac 00:02:03:a9:00:00
+936 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:01:03:aa:00:00 matchDstMac 00:02:03:aa:00:00
+937 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:01:03:ab:00:00 matchDstMac 00:02:03:ab:00:00
+938 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:01:03:ac:00:00 matchDstMac 00:02:03:ac:00:00
+939 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:01:03:ad:00:00 matchDstMac 00:02:03:ad:00:00
+940 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:01:03:ae:00:00 matchDstMac 00:02:03:ae:00:00
+941 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:01:03:af:00:00 matchDstMac 00:02:03:af:00:00
+942 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:01:03:b0:00:00 matchDstMac 00:02:03:b0:00:00
+943 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:01:03:b1:00:00 matchDstMac 00:02:03:b1:00:00
+944 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:03:b2:00:00 matchDstMac 00:02:03:b2:00:00
+945 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:03:b3:00:00 matchDstMac 00:02:03:b3:00:00
+946 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:03:b4:00:00 matchDstMac 00:02:03:b4:00:00
+947 FOOBAR 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:01:03:b5:00:00 matchDstMac 00:02:03:b5:00:00
+948 FOOBAR 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:01:03:b6:00:00 matchDstMac 00:02:03:b6:00:00
+949 FOOBAR 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:01:03:b7:00:00 matchDstMac 00:02:03:b7:00:00
+950 FOOBAR 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:01:03:b8:00:00 matchDstMac 00:02:03:b8:00:00
+951 FOOBAR 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:01:03:b9:00:00 matchDstMac 00:02:03:b9:00:00
+952 FOOBAR 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:01:03:ba:00:00 matchDstMac 00:02:03:ba:00:00
+953 FOOBAR 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:01:03:bb:00:00 matchDstMac 00:02:03:bb:00:00
+954 FOOBAR 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:01:03:bc:00:00 matchDstMac 00:02:03:bc:00:00
+955 FOOBAR 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:01:03:bd:00:00 matchDstMac 00:02:03:bd:00:00
+956 FOOBAR 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:01:03:be:00:00 matchDstMac 00:02:03:be:00:00
+957 FOOBAR 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:01:03:bf:00:00 matchDstMac 00:02:03:bf:00:00
+958 FOOBAR 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:01:03:c0:00:00 matchDstMac 00:02:03:c0:00:00
+959 FOOBAR 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:01:03:c1:00:00 matchDstMac 00:02:03:c1:00:00
+960 FOOBAR 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:01:03:c2:00:00 matchDstMac 00:02:03:c2:00:00
+961 FOOBAR 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:01:03:c3:00:00 matchDstMac 00:02:03:c3:00:00
+962 FOOBAR 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:01:03:c4:00:00 matchDstMac 00:02:03:c4:00:00
+963 FOOBAR 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:01:03:c5:00:00 matchDstMac 00:02:03:c5:00:00
+964 FOOBAR 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:01:03:c6:00:00 matchDstMac 00:02:03:c6:00:00
+965 FOOBAR 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:01:03:c7:00:00 matchDstMac 00:02:03:c7:00:00
+966 FOOBAR 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:01:03:c8:00:00 matchDstMac 00:02:03:c8:00:00
diff --git a/test-network/flows/test2_ons_flows_126.txt b/test-network/flows/test2_ons_flows_126.txt
new file mode 100644
index 0000000..05d6e16
--- /dev/null
+++ b/test-network/flows/test2_ons_flows_126.txt
@@ -0,0 +1,126 @@
+1 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:00:00:00 matchDstMac 00:02:00:00:00:00
+2 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:01:00:00 matchDstMac 00:02:00:01:00:00
+3 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:02:00:00 matchDstMac 00:02:00:02:00:00
+4 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:03:00:00 matchDstMac 00:02:00:03:00:00
+5 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:04:00:00 matchDstMac 00:02:00:04:00:00
+6 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:05:00:00 matchDstMac 00:02:00:05:00:00
+7 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:06:00:00 matchDstMac 00:02:00:06:00:00
+8 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:07:00:00 matchDstMac 00:02:00:07:00:00
+9 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:08:00:00 matchDstMac 00:02:00:08:00:00
+10 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:09:00:00 matchDstMac 00:02:00:09:00:00
+11 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:0a:00:00 matchDstMac 00:02:00:0a:00:00
+12 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:0b:00:00 matchDstMac 00:02:00:0b:00:00
+13 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:0c:00:00 matchDstMac 00:02:00:0c:00:00
+14 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:0d:00:00 matchDstMac 00:02:00:0d:00:00
+15 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:0e:00:00 matchDstMac 00:02:00:0e:00:00
+16 FOOBAR 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:0f:00:00 matchDstMac 00:02:00:0f:00:00
+17 FOOBAR 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:10:00:00 matchDstMac 00:02:00:10:00:00
+18 FOOBAR 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:11:00:00 matchDstMac 00:02:00:11:00:00
+19 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:12:00:00 matchDstMac 00:02:00:12:00:00
+20 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:13:00:00 matchDstMac 00:02:00:13:00:00
+21 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:14:00:00 matchDstMac 00:02:00:14:00:00
+22 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:15:00:00 matchDstMac 00:02:00:15:00:00
+23 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:16:00:00 matchDstMac 00:02:00:16:00:00
+24 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:17:00:00 matchDstMac 00:02:00:17:00:00
+25 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:18:00:00 matchDstMac 00:02:00:18:00:00
+26 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:19:00:00 matchDstMac 00:02:00:19:00:00
+27 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:1a:00:00 matchDstMac 00:02:00:1a:00:00
+28 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:1b:00:00 matchDstMac 00:02:00:1b:00:00
+29 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:1c:00:00 matchDstMac 00:02:00:1c:00:00
+30 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:1d:00:00 matchDstMac 00:02:00:1d:00:00
+31 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:1e:00:00 matchDstMac 00:02:00:1e:00:00
+32 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:1f:00:00 matchDstMac 00:02:00:1f:00:00
+33 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:20:00:00 matchDstMac 00:02:00:20:00:00
+34 FOOBAR 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:21:00:00 matchDstMac 00:02:00:21:00:00
+35 FOOBAR 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:22:00:00 matchDstMac 00:02:00:22:00:00
+36 FOOBAR 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:23:00:00 matchDstMac 00:02:00:23:00:00
+37 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:24:00:00 matchDstMac 00:02:00:24:00:00
+38 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:25:00:00 matchDstMac 00:02:00:25:00:00
+39 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:26:00:00 matchDstMac 00:02:00:26:00:00
+40 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:27:00:00 matchDstMac 00:02:00:27:00:00
+41 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:28:00:00 matchDstMac 00:02:00:28:00:00
+42 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:29:00:00 matchDstMac 00:02:00:29:00:00
+43 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:2a:00:00 matchDstMac 00:02:00:2a:00:00
+44 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:2b:00:00 matchDstMac 00:02:00:2b:00:00
+45 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:2c:00:00 matchDstMac 00:02:00:2c:00:00
+46 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:2d:00:00 matchDstMac 00:02:00:2d:00:00
+47 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:2e:00:00 matchDstMac 00:02:00:2e:00:00
+48 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:2f:00:00 matchDstMac 00:02:00:2f:00:00
+49 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:30:00:00 matchDstMac 00:02:00:30:00:00
+50 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:31:00:00 matchDstMac 00:02:00:31:00:00
+51 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:32:00:00 matchDstMac 00:02:00:32:00:00
+52 FOOBAR 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:33:00:00 matchDstMac 00:02:00:33:00:00
+53 FOOBAR 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:34:00:00 matchDstMac 00:02:00:34:00:00
+54 FOOBAR 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:35:00:00 matchDstMac 00:02:00:35:00:00
+55 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:36:00:00 matchDstMac 00:02:00:36:00:00
+56 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:37:00:00 matchDstMac 00:02:00:37:00:00
+57 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:38:00:00 matchDstMac 00:02:00:38:00:00
+58 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:39:00:00 matchDstMac 00:02:00:39:00:00
+59 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:3a:00:00 matchDstMac 00:02:00:3a:00:00
+60 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:3b:00:00 matchDstMac 00:02:00:3b:00:00
+61 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:3c:00:00 matchDstMac 00:02:00:3c:00:00
+62 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:3d:00:00 matchDstMac 00:02:00:3d:00:00
+63 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:3e:00:00 matchDstMac 00:02:00:3e:00:00
+64 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:3f:00:00 matchDstMac 00:02:00:3f:00:00
+65 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:40:00:00 matchDstMac 00:02:00:40:00:00
+66 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:41:00:00 matchDstMac 00:02:00:41:00:00
+67 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:42:00:00 matchDstMac 00:02:00:42:00:00
+68 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:43:00:00 matchDstMac 00:02:00:43:00:00
+69 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:44:00:00 matchDstMac 00:02:00:44:00:00
+70 FOOBAR 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:45:00:00 matchDstMac 00:02:00:45:00:00
+71 FOOBAR 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:46:00:00 matchDstMac 00:02:00:46:00:00
+72 FOOBAR 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:47:00:00 matchDstMac 00:02:00:47:00:00
+73 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:48:00:00 matchDstMac 00:02:00:48:00:00
+74 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:49:00:00 matchDstMac 00:02:00:49:00:00
+75 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:4a:00:00 matchDstMac 00:02:00:4a:00:00
+76 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:4b:00:00 matchDstMac 00:02:00:4b:00:00
+77 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:4c:00:00 matchDstMac 00:02:00:4c:00:00
+78 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:4d:00:00 matchDstMac 00:02:00:4d:00:00
+79 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:4e:00:00 matchDstMac 00:02:00:4e:00:00
+80 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:4f:00:00 matchDstMac 00:02:00:4f:00:00
+81 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:50:00:00 matchDstMac 00:02:00:50:00:00
+82 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:51:00:00 matchDstMac 00:02:00:51:00:00
+83 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:52:00:00 matchDstMac 00:02:00:52:00:00
+84 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:53:00:00 matchDstMac 00:02:00:53:00:00
+85 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:54:00:00 matchDstMac 00:02:00:54:00:00
+86 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:55:00:00 matchDstMac 00:02:00:55:00:00
+87 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:56:00:00 matchDstMac 00:02:00:56:00:00
+88 FOOBAR 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:57:00:00 matchDstMac 00:02:00:57:00:00
+89 FOOBAR 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:58:00:00 matchDstMac 00:02:00:58:00:00
+90 FOOBAR 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:59:00:00 matchDstMac 00:02:00:59:00:00
+91 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:5a:00:00 matchDstMac 00:02:00:5a:00:00
+92 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:5b:00:00 matchDstMac 00:02:00:5b:00:00
+93 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:5c:00:00 matchDstMac 00:02:00:5c:00:00
+94 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:5d:00:00 matchDstMac 00:02:00:5d:00:00
+95 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:5e:00:00 matchDstMac 00:02:00:5e:00:00
+96 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:5f:00:00 matchDstMac 00:02:00:5f:00:00
+97 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:60:00:00 matchDstMac 00:02:00:60:00:00
+98 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:61:00:00 matchDstMac 00:02:00:61:00:00
+99 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:62:00:00 matchDstMac 00:02:00:62:00:00
+100 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:63:00:00 matchDstMac 00:02:00:63:00:00
+101 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:64:00:00 matchDstMac 00:02:00:64:00:00
+102 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:65:00:00 matchDstMac 00:02:00:65:00:00
+103 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:66:00:00 matchDstMac 00:02:00:66:00:00
+104 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:67:00:00 matchDstMac 00:02:00:67:00:00
+105 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:68:00:00 matchDstMac 00:02:00:68:00:00
+106 FOOBAR 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:01:00:69:00:00 matchDstMac 00:02:00:69:00:00
+107 FOOBAR 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:01:00:6a:00:00 matchDstMac 00:02:00:6a:00:00
+108 FOOBAR 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:01:00:6b:00:00 matchDstMac 00:02:00:6b:00:00
+109 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:01:00:6c:00:00 matchDstMac 00:02:00:6c:00:00
+110 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:01:00:6d:00:00 matchDstMac 00:02:00:6d:00:00
+111 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:01:00:6e:00:00 matchDstMac 00:02:00:6e:00:00
+112 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:01:00:6f:00:00 matchDstMac 00:02:00:6f:00:00
+113 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:01:00:70:00:00 matchDstMac 00:02:00:70:00:00
+114 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:01:00:71:00:00 matchDstMac 00:02:00:71:00:00
+115 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:01:00:72:00:00 matchDstMac 00:02:00:72:00:00
+116 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:01:00:73:00:00 matchDstMac 00:02:00:73:00:00
+117 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:01:00:74:00:00 matchDstMac 00:02:00:74:00:00
+118 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:01:00:75:00:00 matchDstMac 00:02:00:75:00:00
+119 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:01:00:76:00:00 matchDstMac 00:02:00:76:00:00
+120 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:01:00:77:00:00 matchDstMac 00:02:00:77:00:00
+121 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:01:00:78:00:00 matchDstMac 00:02:00:78:00:00
+122 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:01:00:79:00:00 matchDstMac 00:02:00:79:00:00
+123 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:01:00:7a:00:00 matchDstMac 00:02:00:7a:00:00
+124 FOOBAR 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:01:00:7b:00:00 matchDstMac 00:02:00:7b:00:00
+125 FOOBAR 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:01:00:7c:00:00 matchDstMac 00:02:00:7c:00:00
+126 FOOBAR 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:01:00:7d:00:00 matchDstMac 00:02:00:7d:00:00
diff --git a/test-network/mininet/dev_network.py b/test-network/mininet/dev_network.py
new file mode 100755
index 0000000..0eb519a
--- /dev/null
+++ b/test-network/mininet/dev_network.py
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+NR_NODES=10 #; Switches per rigonal networks
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+ switches=[]
+ for n in range(2, 9):
+ NWID=n
+ switch = []
+ host = []
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (n,int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+ switches.append(switch)
+
+ self.addLink(switches[8-2][0],sw1)
+ self.addLink(switches[2-2][0],sw2)
+ self.addLink(switches[3-2][0],sw3)
+ self.addLink(switches[4-2][0],sw4)
+ self.addLink(switches[5-2][0],sw4)
+ self.addLink(switches[6-2][0],sw5)
+ self.addLink(switches[7-2][0],sw6)
+
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+# host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ hosts = []
+ for n in range(2, 9):
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (n, int(i)+1) ))
+ hosts.append(host)
+
+ net.start()
+
+ for n in range(2, 9):
+ for i in range (NR_NODES):
+ hosts[n-2][i].defaultIntf().setIP('192.168.%d.%d/16' % (n,(int(i)+1)))
+ hosts[n-2][i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for k in range (2,9):
+ for h in range (NR_NODES):
+ hosts[n-2][i].setARP('192.168.%d.%d' % (k, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,k,(int(h)+1)))
+
+ stopsshd ()
+ for n in range(2, 9):
+ startsshds ( hosts[n-2] )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/dev_network_core.py b/test-network/mininet/dev_network_core.py
new file mode 100755
index 0000000..a0e184e
--- /dev/null
+++ b/test-network/mininet/dev_network_core.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ host1 = self.addHost( 'host1' )
+ host2 = self.addHost( 'host2' )
+ host3 = self.addHost( 'host3' )
+ host4 = self.addHost( 'host4' )
+ host5 = self.addHost( 'host5' )
+ host6 = self.addHost( 'host6' )
+
+ self.addLink( host1, sw1 )
+ self.addLink( host2, sw2 )
+ self.addLink( host3, sw3 )
+ self.addLink( host4, sw4 )
+ self.addLink( host5, sw5 )
+ self.addLink( host6, sw6 )
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+
+ host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ net.start()
+
+ sw2.attach('tap01_2')
+ sw3.attach('tap01_3')
+ sw4.attach('tap01_4')
+ sw4.attach('tap01_5')
+ sw5.attach('tap01_6')
+ sw6.attach('tap01_7')
+ sw1.attach('tap01_8')
+
+ host1.defaultIntf().setIP('192.168.100.141/16')
+ host2.defaultIntf().setIP('192.168.100.142/16')
+ host3.defaultIntf().setIP('192.168.100.143/16')
+ host4.defaultIntf().setIP('192.168.100.144/16')
+ host5.defaultIntf().setIP('192.168.100.145/16')
+ host6.defaultIntf().setIP('192.168.100.146/16')
+
+ hosts = [ host1, host2, host3, host4, host5, host6 ]
+ stopsshd ()
+ startsshds ( hosts )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/dev_network_core_1.py b/test-network/mininet/dev_network_core_1.py
new file mode 100755
index 0000000..a0e184e
--- /dev/null
+++ b/test-network/mininet/dev_network_core_1.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ host1 = self.addHost( 'host1' )
+ host2 = self.addHost( 'host2' )
+ host3 = self.addHost( 'host3' )
+ host4 = self.addHost( 'host4' )
+ host5 = self.addHost( 'host5' )
+ host6 = self.addHost( 'host6' )
+
+ self.addLink( host1, sw1 )
+ self.addLink( host2, sw2 )
+ self.addLink( host3, sw3 )
+ self.addLink( host4, sw4 )
+ self.addLink( host5, sw5 )
+ self.addLink( host6, sw6 )
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+
+ host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ net.start()
+
+ sw2.attach('tap01_2')
+ sw3.attach('tap01_3')
+ sw4.attach('tap01_4')
+ sw4.attach('tap01_5')
+ sw5.attach('tap01_6')
+ sw6.attach('tap01_7')
+ sw1.attach('tap01_8')
+
+ host1.defaultIntf().setIP('192.168.100.141/16')
+ host2.defaultIntf().setIP('192.168.100.142/16')
+ host3.defaultIntf().setIP('192.168.100.143/16')
+ host4.defaultIntf().setIP('192.168.100.144/16')
+ host5.defaultIntf().setIP('192.168.100.145/16')
+ host6.defaultIntf().setIP('192.168.100.146/16')
+
+ hosts = [ host1, host2, host3, host4, host5, host6 ]
+ stopsshd ()
+ startsshds ( hosts )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/dev_network_edge.py b/test-network/mininet/dev_network_edge.py
new file mode 100755
index 0000000..29be6ad
--- /dev/null
+++ b/test-network/mininet/dev_network_edge.py
@@ -0,0 +1,155 @@
+#!/usr/bin/python
+import sys
+
+Controllers=[{"ip":"127.0.0.1", "port":6633}]
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ switch = []
+ host = []
+
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (NWID,int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def startiperf( host ):
+ host.cmd( '/usr/bin/iperf', '-s &' )
+
+def startiperfs ( hosts ):
+ for h in hosts:
+ startiperf( h )
+
+def stopiperf( ):
+ quietRun( "pkill -9 iperf" )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+ #net = Mininet( topo=topo, link=TCLink, build=False)
+ #controllers=[]
+ #for c in Controllers:
+ # rc = RemoteController('c%d' % Controllers.index(c), ip=c['ip'],port=c['port'])
+ # print "controller ip %s port %s" % (c['ip'], c['port'])
+ # controllers.append(rc)
+
+ #net.controllers=controllers
+ net.build()
+
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (NWID,int(i)+1) ))
+
+ net.start()
+
+ sw=net.get('sw%02x.%02x' % (NWID,1))
+ print "center sw", sw
+ sw.attach('tap%02x_1' % NWID)
+
+ for i in range (NR_NODES):
+ host[i].defaultIntf().setIP('192.168.%d.%d/16' % (NWID,(int(i)+1)))
+ host[i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,NWID,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for n in range (2,9):
+ for h in range (NR_NODES):
+ host[i].setARP('192.168.%d.%d' % (n, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(h)+1)))
+
+ stopsshd ()
+# stopiperf ()
+ startsshds ( host )
+# startiperfs ( host )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 3:
+ NWID=int(sys.argv[1])
+ NR_NODES=int(sys.argv[2])
+ sdnnet("nocli")
+ else:
+ print "%s <NWID> <NR_NODES>" % sys.argv[0]
+ sys.exit(1)
diff --git a/test-network/mininet/dev_network_edge_2.py b/test-network/mininet/dev_network_edge_2.py
new file mode 100755
index 0000000..50dc00c
--- /dev/null
+++ b/test-network/mininet/dev_network_edge_2.py
@@ -0,0 +1,156 @@
+#!/usr/bin/python
+import sys
+
+Controllers=[{"ip":"127.0.0.1", "port":6633}]
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ switch = []
+ host = []
+
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (NWID,int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def startiperf( host ):
+ host.cmd( '/usr/bin/iperf', '-s &' )
+
+def startiperfs ( hosts ):
+ for h in hosts:
+ startiperf( h )
+
+def stopiperf( ):
+ quietRun( "pkill -9 iperf" )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+ #net = Mininet( topo=topo, link=TCLink, build=False)
+ #controllers=[]
+ #for c in Controllers:
+ # rc = RemoteController('c%d' % Controllers.index(c), ip=c['ip'],port=c['port'])
+ # print "controller ip %s port %s" % (c['ip'], c['port'])
+ # controllers.append(rc)
+
+ #net.controllers=controllers
+ net.build()
+
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (NWID,int(i)+1) ))
+
+ net.start()
+
+ sw=net.get('sw%02x.%02x' % (NWID,1))
+ print "center sw", sw
+ sw.attach('tap%02x_1' % NWID)
+ sw.attach('tap%02x_2' % NWID)
+
+ for i in range (NR_NODES):
+ host[i].defaultIntf().setIP('192.168.%d.%d/16' % (NWID,(int(i)+1)))
+ host[i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,NWID,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for n in range (2,9):
+ for h in range (NR_NODES):
+ host[i].setARP('192.168.%d.%d' % (n, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(h)+1)))
+
+ stopsshd ()
+# stopiperf ()
+ startsshds ( host )
+# startiperfs ( host )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 3:
+ NWID=int(sys.argv[1])
+ NR_NODES=int(sys.argv[2])
+ sdnnet("nocli")
+ else:
+ print "%s <NWID> <NR_NODES>" % sys.argv[0]
+ sys.exit(1)
diff --git a/test-network/mininet/dev_network_single.py b/test-network/mininet/dev_network_single.py
new file mode 100755
index 0000000..0eb519a
--- /dev/null
+++ b/test-network/mininet/dev_network_single.py
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+NR_NODES=10 #; Switches per rigonal networks
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+ switches=[]
+ for n in range(2, 9):
+ NWID=n
+ switch = []
+ host = []
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (n,int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+ switches.append(switch)
+
+ self.addLink(switches[8-2][0],sw1)
+ self.addLink(switches[2-2][0],sw2)
+ self.addLink(switches[3-2][0],sw3)
+ self.addLink(switches[4-2][0],sw4)
+ self.addLink(switches[5-2][0],sw4)
+ self.addLink(switches[6-2][0],sw5)
+ self.addLink(switches[7-2][0],sw6)
+
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+# host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ hosts = []
+ for n in range(2, 9):
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (n, int(i)+1) ))
+ hosts.append(host)
+
+ net.start()
+
+ for n in range(2, 9):
+ for i in range (NR_NODES):
+ hosts[n-2][i].defaultIntf().setIP('192.168.%d.%d/16' % (n,(int(i)+1)))
+ hosts[n-2][i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for k in range (2,9):
+ for h in range (NR_NODES):
+ hosts[n-2][i].setARP('192.168.%d.%d' % (k, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,k,(int(h)+1)))
+
+ stopsshd ()
+ for n in range(2, 9):
+ startsshds ( hosts[n-2] )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/dev_network_tunnel_1.sh b/test-network/mininet/dev_network_tunnel_1.sh
new file mode 100755
index 0000000..4f9767f
--- /dev/null
+++ b/test-network/mininet/dev_network_tunnel_1.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+onosdev1=192.168.56.11
+onosdev2=192.168.56.12
+onosdev3=192.168.56.13
+onosdev4=192.168.56.14
+
+dir=`dirname $0`
+TUNNEL=("2 2 onosdev2" "3 3 onosdev3" "4 4 onosdev4" "5 5 onosdev2")
+NW_ID=01
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ ifconfig tap${NW_ID}_${ifnr}
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "$dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo $dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/test-network/mininet/dev_network_tunnel_2.sh b/test-network/mininet/dev_network_tunnel_2.sh
new file mode 100755
index 0000000..d183d88
--- /dev/null
+++ b/test-network/mininet/dev_network_tunnel_2.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+onosdev1=192.168.56.11
+onosdev2=192.168.56.12
+onosdev3=192.168.56.13
+onosdev4=192.168.56.14
+
+dir=`dirname $0`
+
+TUNNEL=("1 2 onosdev1" "2 5 onosdev1")
+NW_ID=02
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ ifconfig tap${NW_ID}_${ifnr}
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "$dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo $dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/test-network/mininet/dev_network_tunnel_3.sh b/test-network/mininet/dev_network_tunnel_3.sh
new file mode 100755
index 0000000..a74a53b
--- /dev/null
+++ b/test-network/mininet/dev_network_tunnel_3.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+onosdev1=192.168.56.11
+onosdev2=192.168.56.12
+onosdev3=192.168.56.13
+onosdev4=192.168.56.14
+
+dir=`dirname $0`
+
+TUNNEL=("1 3 onosdev1")
+NW_ID=03
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ ifconfig tap${NW_ID}_${ifnr}
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "$dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo $dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/test-network/mininet/dev_network_tunnel_4.sh b/test-network/mininet/dev_network_tunnel_4.sh
new file mode 100755
index 0000000..1367b75
--- /dev/null
+++ b/test-network/mininet/dev_network_tunnel_4.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+onosdev1=192.168.56.11
+onosdev2=192.168.56.12
+onosdev3=192.168.56.13
+onosdev4=192.168.56.14
+
+dir=`dirname $0`
+
+TUNNEL=("1 4 onosdev1")
+NW_ID=04
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ echo "ifconfig tap${NW_ID}_${ifnr}"
+ ifconfig tap${NW_ID}_${ifnr}
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}_${ifnr}"
+ sudo tunctl -t tap${NW_ID}_${ifnr}
+ fi
+ echo "$dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}_${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo $dir/capsulator -v -d -t eth1 -f ${tun_end} -vb tap${NW_ID}_${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/test-network/mininet/mrun b/test-network/mininet/mrun
new file mode 100755
index 0000000..8bcd141
--- /dev/null
+++ b/test-network/mininet/mrun
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Attach to a Mininet host and run a command
+
+if [ -z $1 ]; then
+ echo "usage: $0 host cmd [args...]"
+ exit 1
+else
+ host=$1
+fi
+
+pid=`pgrep -f ${host}.banner`
+if [ "$pid" == "" ]; then
+ echo "Could not find Mininet host $host"
+ exit 2
+fi
+
+if [ -z $2 ]; then
+ cmd='bash'
+else
+ shift
+ cmd=$*
+fi
+
+cgroup=/sys/fs/cgroup/cpu/$host
+if [ -d "$cgroup" ]; then
+ cg="-g $host"
+fi
+
+exec sudo mnexec -a $pid $cg $cmd
diff --git a/test-network/mininet/net.sprint5-templete.py b/test-network/mininet/net.sprint5-templete.py
new file mode 100755
index 0000000..0fc96f1
--- /dev/null
+++ b/test-network/mininet/net.sprint5-templete.py
@@ -0,0 +1,153 @@
+#!/usr/bin/python
+
+NWID=1
+NR_NODES=20
+#Controllers=[{"ip":'127.0.0.1', "port":6633}, {"ip":'10.0.1.28', "port":6633}]
+Controllers=[{"ip":'10.0.1.28', "port":6633}]
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ switch = []
+ host = []
+ root = []
+
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % i
+ dpid_suffix = '%02x' % NWID + '%02x' % i
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d' % i ))
+
+ for i in range (NR_NODES):
+ root.append(self.addHost( 'root%d' % i, inNamespace=False ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+ for i in range (NR_NODES):
+ self.addLink(root[i], host[i])
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+ #net = Mininet( topo=topo, controller=MyController, link=TCLink)
+ net = Mininet( topo=topo, link=TCLink, build=False)
+ controllers=[]
+ for c in Controllers:
+ rc = RemoteController('c%d' % Controllers.index(c), ip=c['ip'],port=c['port'])
+ print "controller ip %s port %s" % (c['ip'], c['port'])
+ controllers.append(rc)
+
+ net.controllers=controllers
+ net.build()
+
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d' % i ))
+
+ net.start()
+
+ sw=net.get('sw01.00')
+ print "center sw", sw
+ sw.attach('tapa0')
+
+ for i in range (NR_NODES):
+ host[i].defaultIntf().setIP('192.168.%d.%d/16' % (NWID,i))
+
+ root = []
+ for i in range (NR_NODES):
+ root.append(net.get( 'root%d' % i ))
+
+ for i in range (NR_NODES):
+ host[i].intf('host%d-eth1' % i).setIP('1.1.%d.1/24' % i)
+ root[i].intf('root%d-eth0' % i).setIP('1.1.%d.2/24' % i)
+
+ stopsshd ()
+ startsshds ( host )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/net.sprint5.template.py b/test-network/mininet/net.sprint5.template.py
new file mode 100755
index 0000000..52e3184
--- /dev/null
+++ b/test-network/mininet/net.sprint5.template.py
@@ -0,0 +1,160 @@
+#!/usr/bin/python
+
+NWID=3
+NR_NODES=20
+#Controllers=[{"ip":'127.0.0.1', "port":6633}, {"ip":'10.0.1.28', "port":6633}]
+Controllers=[{"ip":'10.0.1.223', "port":6633}]
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+
+ switch = []
+ host = []
+ root = []
+
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % i
+ dpid_suffix = '%02x' % NWID + '%02x' % i
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d' % i ))
+
+ for i in range (NR_NODES):
+ root.append(self.addHost( 'root%d' % i, inNamespace=False ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+ for i in range (NR_NODES):
+ self.addLink(root[i], host[i])
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+ #net = Mininet( topo=topo, controller=MyController, link=TCLink)
+ net = Mininet( topo=topo, link=TCLink, build=False)
+ controllers=[]
+ for c in Controllers:
+ rc = RemoteController('c%d' % Controllers.index(c), ip=c['ip'],port=c['port'])
+ print "controller ip %s port %s" % (c['ip'], c['port'])
+ controllers.append(rc)
+
+ net.controllers=controllers
+ net.build()
+
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d' % i ))
+
+ net.start()
+
+ sw=net.get('sw03.00')
+ print "center sw", sw
+ sw.attach('tapc0')
+
+ for i in range (NR_NODES):
+ host[i].defaultIntf().setIP('192.168.%d.%d/16' % (NWID,i))
+ host[i].defaultIntf().setMAC('00:00:00:00:%02x:%02x' % (NWID,i))
+
+ for i in range (NR_NODES):
+ for n in range (3):
+ for h in range (10):
+ host[i].setARP('192.168.%d.%d' % (n, h), '00:00:00:00:%02x:%02x' % (n,h))
+
+
+ root = []
+ for i in range (NR_NODES):
+ root.append(net.get( 'root%d' % i ))
+
+ for i in range (NR_NODES):
+ host[i].intf('host%d-eth1' % i).setIP('1.1.%d.1/24' % i)
+ root[i].intf('root%d-eth0' % i).setIP('1.1.%d.2/24' % i)
+
+ stopsshd ()
+ startsshds ( host )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/network.py b/test-network/mininet/network.py
new file mode 100755
index 0000000..0eb519a
--- /dev/null
+++ b/test-network/mininet/network.py
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+NR_NODES=10 #; Switches per rigonal networks
+
+class MyController( Controller ):
+ def __init__( self, name, ip='127.0.0.1', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
+
+ self.addLink( sw1, sw2 )
+ self.addLink( sw1, sw6 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw3, sw4 )
+ self.addLink( sw3, sw6 )
+ self.addLink( sw4, sw5 )
+ self.addLink( sw5, sw6 )
+ self.addLink( sw4, sw6 )
+
+ switches=[]
+ for n in range(2, 9):
+ NWID=n
+ switch = []
+ host = []
+ for i in range (NR_NODES):
+ name_suffix = '%02d' % NWID + "." + '%02d' % (int(i)+1)
+ dpid_suffix = '%02x' % NWID + '%02x' % (int(i)+1)
+ dpid = '0000' + '0000' + '0000' + dpid_suffix
+ sw = self.addSwitch('sw'+name_suffix, dpid=dpid)
+ switch.append(sw)
+
+ for i in range (NR_NODES):
+ host.append(self.addHost( 'host%d.%d' % (n,int(i)+1) ))
+
+ for i in range (NR_NODES):
+ self.addLink(host[i], switch[i])
+
+ for i in range (1, NR_NODES):
+ self.addLink(switch[0], switch[i])
+
+ switches.append(switch)
+
+ self.addLink(switches[8-2][0],sw1)
+ self.addLink(switches[2-2][0],sw2)
+ self.addLink(switches[3-2][0],sw3)
+ self.addLink(switches[4-2][0],sw4)
+ self.addLink(switches[5-2][0],sw4)
+ self.addLink(switches[6-2][0],sw5)
+ self.addLink(switches[7-2][0],sw6)
+
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+# host1, host2, host3, host4, host5, host6 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5', 'host6')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw1')
+ sw2 = net.get('sw2')
+ sw3 = net.get('sw3')
+ sw4 = net.get('sw4')
+ sw5 = net.get('sw5')
+ sw6 = net.get('sw6')
+
+ hosts = []
+ for n in range(2, 9):
+ host = []
+ for i in range (NR_NODES):
+ host.append(net.get( 'host%d.%d' % (n, int(i)+1) ))
+ hosts.append(host)
+
+ net.start()
+
+ for n in range(2, 9):
+ for i in range (NR_NODES):
+ hosts[n-2][i].defaultIntf().setIP('192.168.%d.%d/16' % (n,(int(i)+1)))
+ hosts[n-2][i].defaultIntf().setMAC('00:00:%02x:%02x:%02x:%02x' % (192,168,n,(int(i)+1)))
+
+ for i in range (NR_NODES):
+ for k in range (2,9):
+ for h in range (NR_NODES):
+ hosts[n-2][i].setARP('192.168.%d.%d' % (k, (int(h)+1)), '00:00:%02x:%02x:%02x:%02x' % (192,168,k,(int(h)+1)))
+
+ stopsshd ()
+ for n in range(2, 9):
+ startsshds ( hosts[n-2] )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/ctrl-local.sh b/testbed-ctrl-add-ext.sh
similarity index 61%
copy from ctrl-local.sh
copy to testbed-ctrl-add-ext.sh
index 79b421b..110eeff 100755
--- a/ctrl-local.sh
+++ b/testbed-ctrl-add-ext.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-controller="localhost"
-switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+controller="10.128.4.12 10.128.4.13 10.128.4.14 10.128.4.15 10.128.4.16"
+switches=`ifconfig -a | grep "^s" |grep -v eth | awk '{print $1}'`
function host2ip (){
ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
@@ -9,7 +9,7 @@
url=""
for c in $controller; do
- url="$url tcp:`host2ip $c`:6633"
+ url="$url tcp:$c:6633"
done
echo $url
for s in $switches; do
diff --git a/ctrl-local.sh b/testbed-ctrl-none.sh
similarity index 77%
copy from ctrl-local.sh
copy to testbed-ctrl-none.sh
index 79b421b..e09835b 100755
--- a/ctrl-local.sh
+++ b/testbed-ctrl-none.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-controller="localhost"
-switches=`ifconfig -a | grep sw |grep -v eth | awk '{print $1}'`
+controller=""
+switches=`ifconfig -a | grep "^s" |grep -v eth | awk '{print $1}'`
function host2ip (){
ip=`grep $1 /etc/hosts |grep -v "ip6"| awk '{print $1}'`
diff --git a/titan/gremlin.sh b/titan/gremlin.sh
index c7155ac..55354e3 100755
--- a/titan/gremlin.sh
+++ b/titan/gremlin.sh
@@ -1,6 +1,21 @@
#!/bin/bash
-CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g')
+if [ -z "${MVN}" ]; then
+ MVN="mvn"
+fi
+
+BASE_DIR=`dirname $0`
+ONOS_DIR="`dirname $0`/.."
+#CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g')
+#CP=`${MVN} -f ${ONOS_DIR}/pom.xml dependency:build-classpath -Dmdep.outputFile=/dev/stdout -l /dev/stderr`
+
+# Use a python script to parse the classpath out of the .classpath file
+CP=`${BASE_DIR}/../scripts/parse-classpath.py`
+
+if [[ "$CP" == *"Error reading classpath file"* ]]; then
+ echo $CP
+ exit 1
+fi
# Find Java
if [ "$JAVA_HOME" = "" ] ; then
@@ -30,7 +45,9 @@
if [ "$1" = "-v" ]; then
$JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version
else
+ pushd $BASE_DIR >/dev/null
$JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console
+ popd >/dev/null
fi
fi
diff --git a/titan/listDevices b/titan/listDevices
new file mode 100644
index 0000000..ea57f41
--- /dev/null
+++ b/titan/listDevices
@@ -0,0 +1,2 @@
+g.stopTransaction(SUCCESS);
+g.V('type', 'device').map;
\ No newline at end of file
diff --git a/titan/listFlow b/titan/listFlow
new file mode 100644
index 0000000..6b23be5
--- /dev/null
+++ b/titan/listFlow
@@ -0,0 +1,2 @@
+g.stopTransaction(SUCCESS);
+g.V('type', 'flow').map;
diff --git a/titan/listFlowEntry b/titan/listFlowEntry
new file mode 100644
index 0000000..42dc50f
--- /dev/null
+++ b/titan/listFlowEntry
@@ -0,0 +1,2 @@
+g.stopTransaction(SUCCESS);
+g.V('type', 'flow_entry').map;
diff --git a/titan/listNotUpdated b/titan/listNotUpdated
new file mode 100644
index 0000000..a44c458
--- /dev/null
+++ b/titan/listNotUpdated
@@ -0,0 +1,4 @@
+g.stopTransaction(SUCCESS)
+g.V('type', 'flow_entry').each{
+if (it.switch_state.equals("FE_SWITCH_NOT_UPDATED")) println it.map.next()
+}
\ No newline at end of file
diff --git a/titan/open b/titan/open
index 4442c0f..6efe890 100644
--- a/titan/open
+++ b/titan/open
@@ -1 +1 @@
-g = TitanFactory.open('cassandra.local')
\ No newline at end of file
+g = TitanFactory.open('/tmp/cassandra.titan')
\ No newline at end of file
diff --git a/titan/schema/dbapi-testdata.graphml b/titan/schema/dbapi-testdata.graphml
index fbf7e2b..952a62a 100644
--- a/titan/schema/dbapi-testdata.graphml
+++ b/titan/schema/dbapi-testdata.graphml
@@ -1 +1 @@
-<?xml version=\"1.0\" ?><graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"> <key id=\"id\" for=\"node\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"type\" for=\"node\" attr.name=\"type\" attr.type=\"string\"></key> <key id=\"dpid\" for=\"node\" attr.name=\"dpid\" attr.type=\"string\"></key> <key id=\"desc\" for=\"node\" attr.name=\"desc\" attr.type=\"string\"></key> <key id=\"number\" for=\"node\" attr.name=\"number\" attr.type=\"int\"></key> <key id=\"dl_addr\" for=\"node\" attr.name=\"dl_addr\" attr.type=\"string\"></key> <key id=\"nw_addr\" for=\"node\" attr.name=\"nw_addr\" attr.type=\"string\"></key> <key id=\"id\" for=\"edge\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"source\" for=\"edge\" attr.name=\"source\" attr.type=\"string\"></key> <key id=\"target\" for=\"edge\" attr.name=\"target\" attr.type=\"string\"></key> <key id=\"label\" for=\"edge\" attr.name=\"label\" attr.type=\"string\"></key> <graph id=\"G\" edgedefault=\"directed\"> <node id=\"1\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:01</data> <data key=\"desc\">OpenFlow Switch at SEA</data> </node> <node id=\"2\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:02</data> <data key=\"desc\">OpenFlow Switch at LAX</data> </node> <node id=\"3\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:03</data> <data key=\"desc\">OpenFlow Switch at CHI</data> </node> <node id=\"4\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:04</data> <data key=\"desc\">OpenFlow Switch at IAH</data> </node> <node id=\"5\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:05</data> <data key=\"desc\">OpenFlow Switch at NYC</data> </node> <node id=\"6\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:06</data> <data key=\"desc\">OpenFlow Switch at ATL</data> </node> <node id=\"100\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at SEA Switch</data> </node> <node id=\"101\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at SEA Switch</data> </node> <node id=\"102\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at SEA Switch</data> </node> <node id=\"103\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at SEA Switch</data> </node> <node id=\"104\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at LAX Switch</data> </node> <node id=\"105\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at LAX Switch</data> </node> <node id=\"106\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at LAX Switch</data> </node> <node id=\"107\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at CHI Switch</data> </node> <node id=\"108\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at CHI Switch</data> </node> <node id=\"109\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at CHI Switch</data> </node> <node id=\"110\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at CHI Switch</data> </node> <node id=\"111\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at IAH Switch</data> </node> <node id=\"112\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at IAH Switch</data> </node> <node id=\"113\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at IAH Switch</data> </node> <node id=\"114\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at NYC Switch</data> </node> <node id=\"115\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at NYC Switch</data> </node> <node id=\"116\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at NYC Switch</data> </node> <node id=\"117\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at ATL Switch</data> </node> <node id=\"118\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at ATL Switch</data> </node> <node id=\"119\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at ATL Switch</data> </node> <node id=\"1000\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:73</data> <data key=\"nw_addr\">192.168.10.101</data> </node> <node id=\"1001\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:62</data> <data key=\"nw_addr\">192.168.20.101</data> </node> <node id=\"1002\"> <data key=\"type\">device</data> <data key=\"dl_addr\">10:40:f3:e6:8d:55</data> <data key=\"nw_addr\">192.168.10.1</data> </node> <node id=\"1003\"> <data key=\"type\">device</data> <data key=\"dl_addr\">a0:b3:cc:9c:c6:88</data> <data key=\"nw_addr\">192.168.20.1</data> </node> <node id=\"1004\"> <data key=\"type\">device</data> <data key=\"dl_addr\">00:04:20:e2:50:a2</data> <data key=\"nw_addr\">192.168.30.1</data> </node> <node id=\"1005\"> <data key=\"type\">device</data> <data key=\"dl_addr\">58:55:ca:c4:1b:a0</data> <data key=\"nw_addr\">192.168.40.1</data> </node> <edge id=\"10000\" source=\"1\" target=\"101\" label=\"on\"></edge> <edge id=\"10001\" source=\"1\" target=\"102\" label=\"on\"></edge> <edge id=\"10002\" source=\"1\" target=\"103\" label=\"on\"></edge> <edge id=\"10003\" source=\"2\" target=\"104\" label=\"on\"></edge> <edge id=\"10004\" source=\"2\" target=\"105\" label=\"on\"></edge> <edge id=\"10005\" source=\"2\" target=\"106\" label=\"on\"></edge> <edge id=\"10006\" source=\"3\" target=\"107\" label=\"on\"></edge> <edge id=\"10007\" source=\"3\" target=\"108\" label=\"on\"></edge> <edge id=\"10008\" source=\"3\" target=\"109\" label=\"on\"></edge> <edge id=\"10009\" source=\"3\" target=\"110\" label=\"on\"></edge> <edge id=\"10010\" source=\"4\" target=\"111\" label=\"on\"></edge> <edge id=\"10011\" source=\"4\" target=\"112\" label=\"on\"></edge> <edge id=\"10012\" source=\"4\" target=\"113\" label=\"on\"></edge> <edge id=\"10013\" source=\"5\" target=\"114\" label=\"on\"></edge> <edge id=\"10014\" source=\"5\" target=\"115\" label=\"on\"></edge> <edge id=\"10015\" source=\"5\" target=\"116\" label=\"on\"></edge> <edge id=\"10016\" source=\"6\" target=\"117\" label=\"on\"></edge> <edge id=\"10017\" source=\"6\" target=\"118\" label=\"on\"></edge> <edge id=\"10018\" source=\"6\" target=\"119\" label=\"on\"></edge> <edge id=\"11000\" source=\"101\" target=\"107\" label=\"link\"></edge> <edge id=\"11003\" source=\"105\" target=\"111\" label=\"link\"></edge> <edge id=\"11004\" source=\"107\" target=\"101\" label=\"link\"></edge> <edge id=\"11005\" source=\"108\" target=\"112\" label=\"link\"></edge> <edge id=\"11006\" source=\"109\" target=\"114\" label=\"link\"></edge> <edge id=\"11007\" source=\"111\" target=\"105\" label=\"link\"></edge> <edge id=\"11008\" source=\"112\" target=\"108\" label=\"link\"></edge> <edge id=\"11009\" source=\"113\" target=\"117\" label=\"link\"></edge> <edge id=\"11010\" source=\"114\" target=\"109\" label=\"link\"></edge> <edge id=\"11011\" source=\"115\" target=\"118\" label=\"link\"></edge> <edge id=\"11012\" source=\"117\" target=\"113\" label=\"link\"></edge> <edge id=\"11013\" source=\"118\" target=\"115\" label=\"link\"></edge> <edge id=\"12000\" source=\"103\" target=\"1000\" label=\"host\"></edge> <edge id=\"12001\" source=\"103\" target=\"1001\" label=\"host\"></edge> <edge id=\"12002\" source=\"110\" target=\"1002\" label=\"host\"></edge> <edge id=\"12003\" source=\"116\" target=\"1003\" label=\"host\"></edge> <edge id=\"12004\" source=\"106\" target=\"1004\" label=\"host\"></edge> <edge id=\"12005\" source=\"119\" target=\"1005\" label=\"host\"></edge> </graph> </graphml>
\ No newline at end of file
+<?xml version=\"1.0\" ?><graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"> <key id=\"id\" for=\"node\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"type\" for=\"node\" attr.name=\"type\" attr.type=\"string\"></key> <key id=\"dpid\" for=\"node\" attr.name=\"dpid\" attr.type=\"string\"></key> <key id=\"desc\" for=\"node\" attr.name=\"desc\" attr.type=\"string\"></key> <key id=\"number\" for=\"node\" attr.name=\"number\" attr.type=\"int\"></key> <key id=\"dl_add\" for=\"node\" attr.name=\"dl_addr\" attr.type=\"string\"></key> <key id=\"nw_addr\" for=\"node\" attr.name=\"nw_addr\" attr.type=\"string\"></key> <key id=\"id\" for=\"edge\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"source\" for=\"edge\" attr.name=\"source\" attr.type=\"string\"></key> <key id=\"target\" for=\"edge\" attr.name=\"target\" attr.type=\"string\"></key> <key id=\"label\" for=\"edge\" attr.name=\"label\" attr.type=\"string\"></key> <graph id=\"G\" edgedefault=\"directed\"> <node id=\"1\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:01</data> <data key=\"desc\">OpenFlow Switch at SEA</data> </node> <node id=\"2\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:02</data> <data key=\"desc\">OpenFlow Switch at LAX</data> </node> <node id=\"3\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:03</data> <data key=\"desc\">OpenFlow Switch at CHI</data> </node> <node id=\"4\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:04</data> <data key=\"desc\">OpenFlow Switch at IAH</data> </node> <node id=\"5\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:05</data> <data key=\"desc\">OpenFlow Switch at NYC</data> </node> <node id=\"6\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:06</data> <data key=\"desc\">OpenFlow Switch at ATL</data> </node> <node id=\"100\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at SEA Switch</data> </node> <node id=\"101\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at SEA Switch</data> </node> <node id=\"102\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at SEA Switch</data> </node> <node id=\"103\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at SEA Switch</data> </node> <node id=\"104\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at LAX Switch</data> </node> <node id=\"105\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at LAX Switch</data> </node> <node id=\"106\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at LAX Switch</data> </node> <node id=\"107\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at CHI Switch</data> </node> <node id=\"108\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at CHI Switch</data> </node> <node id=\"109\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at CHI Switch</data> </node> <node id=\"110\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at CHI Switch</data> </node> <node id=\"111\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at IAH Switch</data> </node> <node id=\"112\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at IAH Switch</data> </node> <node id=\"113\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at IAH Switch</data> </node> <node id=\"114\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at NYC Switch</data> </node> <node id=\"115\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at NYC Switch</data> </node> <node id=\"116\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at NYC Switch</data> </node> <node id=\"117\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at ATL Switch</data> </node> <node id=\"118\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at ATL Switch</data> </node> <node id=\"119\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at ATL Switch</data> </node> <node id=\"1000\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:73</data> <data key=\"nw_addr\">192.168.10.101</data> </node> <node id=\"1001\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:62</data> <data key=\"nw_addr\">192.168.20.101</data> </node> <node id=\"1002\"> <data key=\"type\">device</data> <data key=\"dl_addr\">10:40:f3:e6:8d:55</data> <data key=\"nw_addr\">192.168.10.1</data> </node> <node id=\"1003\"> <data key=\"type\">device</data> <data key=\"dl_addr\">a0:b3:cc:9c:c6:88</data> <data key=\"nw_addr\">192.168.20.1</data> </node> <node id=\"1004\"> <data key=\"type\">device</data> <data key=\"dl_addr\">00:04:20:e2:50:a2</data> <data key=\"nw_addr\">192.168.30.1</data> </node> <node id=\"1005\"> <data key=\"type\">device</data> <data key=\"dl_addr\">58:55:ca:c4:1b:a0</data> <data key=\"nw_addr\">192.168.40.1</data> </node> <edge id=\"10000\" source=\"1\" target=\"101\" label=\"on\"></edge> <edge id=\"10001\" source=\"1\" target=\"102\" label=\"on\"></edge> <edge id=\"10002\" source=\"1\" target=\"103\" label=\"on\"></edge> <edge id=\"10003\" source=\"2\" target=\"104\" label=\"on\"></edge> <edge id=\"10004\" source=\"2\" target=\"105\" label=\"on\"></edge> <edge id=\"10005\" source=\"2\" target=\"106\" label=\"on\"></edge> <edge id=\"10006\" source=\"3\" target=\"107\" label=\"on\"></edge> <edge id=\"10007\" source=\"3\" target=\"108\" label=\"on\"></edge> <edge id=\"10008\" source=\"3\" target=\"109\" label=\"on\"></edge> <edge id=\"10009\" source=\"3\" target=\"110\" label=\"on\"></edge> <edge id=\"10010\" source=\"4\" target=\"111\" label=\"on\"></edge> <edge id=\"10011\" source=\"4\" target=\"112\" label=\"on\"></edge> <edge id=\"10012\" source=\"4\" target=\"113\" label=\"on\"></edge> <edge id=\"10013\" source=\"5\" target=\"114\" label=\"on\"></edge> <edge id=\"10014\" source=\"5\" target=\"115\" label=\"on\"></edge> <edge id=\"10015\" source=\"5\" target=\"116\" label=\"on\"></edge> <edge id=\"10016\" source=\"6\" target=\"117\" label=\"on\"></edge> <edge id=\"10017\" source=\"6\" target=\"118\" label=\"on\"></edge> <edge id=\"10018\" source=\"6\" target=\"119\" label=\"on\"></edge> <edge id=\"11000\" source=\"101\" target=\"107\" label=\"link\"></edge> <edge id=\"11003\" source=\"105\" target=\"111\" label=\"link\"></edge> <edge id=\"11004\" source=\"107\" target=\"101\" label=\"link\"></edge> <edge id=\"11005\" source=\"108\" target=\"112\" label=\"link\"></edge> <edge id=\"11006\" source=\"109\" target=\"114\" label=\"link\"></edge> <edge id=\"11007\" source=\"111\" target=\"105\" label=\"link\"></edge> <edge id=\"11008\" source=\"112\" target=\"108\" label=\"link\"></edge> <edge id=\"11009\" source=\"113\" target=\"117\" label=\"link\"></edge> <edge id=\"11010\" source=\"114\" target=\"109\" label=\"link\"></edge> <edge id=\"11011\" source=\"115\" target=\"118\" label=\"link\"></edge> <edge id=\"11012\" source=\"117\" target=\"113\" label=\"link\"></edge> <edge id=\"11013\" source=\"118\" target=\"115\" label=\"link\"></edge> <edge id=\"12000\" source=\"103\" target=\"1000\" label=\"host\"></edge> <edge id=\"12001\" source=\"103\" target=\"1001\" label=\"host\"></edge> <edge id=\"12002\" source=\"110\" target=\"1002\" label=\"host\"></edge> <edge id=\"12003\" source=\"116\" target=\"1003\" label=\"host\"></edge> <edge id=\"12004\" source=\"106\" target=\"1004\" label=\"host\"></edge> <edge id=\"12005\" source=\"119\" target=\"1005\" label=\"host\"></edge> </graph> </graphml>
diff --git a/titan/schema/test-network.xml b/titan/schema/test-network.xml
index a03a99c..2c3b993 100644
--- a/titan/schema/test-network.xml
+++ b/titan/schema/test-network.xml
@@ -3,6 +3,7 @@
<key id="id" for="node" attr.name="id" attr.type="string"></key>
<key id="type" for="node" attr.name="type" attr.type="string"></key>
+ <key id="state" for="node" attr.name="state" attr.type="string"></key>
<key id="dpid" for="node" attr.name="dpid" attr.type="string"></key>
<key id="desc" for="node" attr.name="desc" attr.type="string"></key>
<key id="number" for="node" attr.name="number" attr.type="int"></key>
@@ -17,137 +18,163 @@
<node id="1">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:01</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at SEA</data>
</node>
<node id="2">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:02</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at LAX</data>
</node>
<node id="3">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:03</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at CHI</data>
</node>
<node id="4">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:04</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at IAH</data>
</node>
<node id="5">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:05</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at NYC</data>
</node>
<node id="6">
<data key="type">switch</data>
<data key="dpid">00:00:00:00:00:00:0a:06</data>
+ <data key="state">ACTIVE</data>
<data key="desc">OpenFlow Switch at ATL</data>
</node>
<node id="100">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at SEA Switch</data>
</node>
<node id="101">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at SEA Switch</data>
</node>
<node id="102">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at SEA Switch</data>
</node>
<node id="103">
<data key="type">port</data>
<data key="number">4</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 4 at SEA Switch</data>
</node>
<node id="104">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at LAX Switch</data>
</node>
<node id="105">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at LAX Switch</data>
</node>
<node id="106">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at LAX Switch</data>
</node>
<node id="107">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at CHI Switch</data>
</node>
<node id="108">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at CHI Switch</data>
</node>
<node id="109">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at CHI Switch</data>
</node>
<node id="110">
<data key="type">port</data>
<data key="number">4</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 4 at CHI Switch</data>
</node>
<node id="111">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at IAH Switch</data>
</node>
<node id="112">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at IAH Switch</data>
</node>
<node id="113">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at IAH Switch</data>
</node>
<node id="114">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at NYC Switch</data>
</node>
<node id="115">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at NYC Switch</data>
</node>
<node id="116">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at NYC Switch</data>
</node>
<node id="117">
<data key="type">port</data>
<data key="number">1</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 1 at ATL Switch</data>
</node>
<node id="118">
<data key="type">port</data>
<data key="number">2</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 2 at ATL Switch</data>
</node>
<node id="119">
<data key="type">port</data>
<data key="number">3</data>
+ <data key="state">ACTIVE</data>
<data key="desc">port 3 at ATL Switch</data>
</node>
@@ -234,4 +261,4 @@
<edge id="12004" source="106" target="1004" label="host"></edge>
<edge id="12005" source="119" target="1005" label="host"></edge>
</graph>
-</graphml>
\ No newline at end of file
+</graphml>
diff --git a/web/README b/web/README
index 7ddf463..ae08682 100644
--- a/web/README
+++ b/web/README
@@ -10,6 +10,7 @@
DBName="titanexample"
2> install Flask python library (apt-get install python-flask)
+MacOS: sudo pip install Flask
3> Run from commandline
diff --git a/web/add_flow.py b/web/add_flow.py
index 18846b7..c621c30 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -1,6 +1,7 @@
#! /usr/bin/env python
# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+import copy
import pprint
import os
import sys
@@ -17,8 +18,11 @@
#
## Global Var ##
-ControllerIP="127.0.0.1"
-ControllerPort=8080
+ControllerIP = "127.0.0.1"
+ControllerPort = 8080
+MonitoringEnabled = False
+MonitoringByOnos = False
+ReadFromFile = ""
DEBUG=0
pp = pprint.PrettyPrinter(indent=4)
@@ -42,38 +46,43 @@
try:
command = "curl -s http://%s:%s/wm/topology/route/%s/%s/%s/%s/json" % (ControllerIP, ControllerPort, v1, p1, v2, p2)
debug("shortest_path %s" % command)
+ parsedResult = []
result = os.popen(command).read()
debug("result %s" % result)
if len(result) == 0:
- log_error("No Path found")
- exit(1);
-
- parsedResult = json.loads(result)
- debug("parsed %s" % parsedResult)
+ log_error("No Path found from %s/%s to %s/%s" % (v1, p1, v2, p2))
+ else:
+ parsedResult = json.loads(result)
+ debug("parsed %s" % parsedResult)
except:
- log_error("Controller IF has issue")
- exit(1)
-
- srcSwitch = parsedResult['srcPort']['dpid']['value'];
- srcPort = parsedResult['srcPort']['port']['value'];
- dstSwitch = parsedResult['dstPort']['dpid']['value'];
- dstPort = parsedResult['dstPort']['port']['value'];
-
- print "DataPath: (src = %s/%s dst = %s/%s)" % (srcSwitch, srcPort, dstSwitch, dstPort);
-
- for f in parsedResult['flowEntries']:
- inPort = f['inPort']['value'];
- outPort = f['outPort']['value'];
- dpid = f['dpid']['value']
- print "FlowEntry: (%s, %s, %s)" % (inPort, dpid, outPort)
+ log_error("Controller IF has issue: No Path found from %s/%s to %s/%s" % (v1, p1, v2, p2))
return parsedResult
+def print_data_path(data_path):
+ if len(data_path) == 0:
+ return
+
+ srcSwitch = data_path['srcPort']['dpid']['value'];
+ srcPort = data_path['srcPort']['port']['value'];
+ dstSwitch = data_path['dstPort']['dpid']['value'];
+ dstPort = data_path['dstPort']['port']['value'];
+
+ print "DataPath: (src = %s/%s dst = %s/%s)" % (srcSwitch, srcPort, dstSwitch, dstPort);
+
+ for f in data_path['flowEntries']:
+ inPort = f['inPort']['value'];
+ outPort = f['outPort']['value'];
+ dpid = f['dpid']['value']
+ print " FlowEntry: (%s, %s, %s)" % (inPort, dpid, outPort)
+
def add_flow_path(flow_path):
+ flow_path_json = json.dumps(flow_path)
+
try:
- command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/flow/add/json" % (flow_path, ControllerIP, ControllerPort)
+ command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/flow/add/json" % (flow_path_json, ControllerIP, ControllerPort)
debug("add_flow_path %s" % command)
result = os.popen(command).read()
debug("result %s" % result)
@@ -83,8 +92,448 @@
log_error("Controller IF has issue")
exit(1)
+def add_shortest_path_flow(flow_path):
+ flow_path_json = json.dumps(flow_path)
+
+ try:
+ command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/flow/add-shortest-path/json" % (flow_path_json, ControllerIP, ControllerPort)
+ debug("add_shortest_path_flow %s" % command)
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ # parsedResult = json.loads(result)
+ # debug("parsed %s" % parsedResult)
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+def delete_flow_path(flow_id):
+ command = "curl -s \"http://%s:%s/wm/flow/delete/%s/json\"" % (ControllerIP, ControllerPort, flow_id)
+ debug("delete_flow_path %s" % command)
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ # parsedResult = json.loads(result)
+ # debug("parsed %s" % parsedResult)
+
+def extract_flow_args(my_args):
+ # Check the arguments
+ if len(my_args) < 6:
+ log_error(usage_msg)
+ exit(1)
+
+ # Extract the mandatory arguments
+ my_flow_id = my_args[0]
+ my_installer_id = my_args[1]
+ my_src_dpid = my_args[2]
+ my_src_port = my_args[3]
+ my_dst_dpid = my_args[4]
+ my_dst_port = my_args[5]
+
+ #
+ # Extract the "flowPathFlags", "match" and "action" arguments
+ #
+ flowPathFlags = 0L
+ match = {}
+ matchInPortEnabled = True # NOTE: Enabled by default
+ actions = []
+ actionOutputEnabled = True # NOTE: Enabled by default
+ idx = 6
+ while idx < len(my_args):
+ action = {}
+ arg1 = my_args[idx]
+ idx = idx + 1
+ # Extract the second argument
+ if idx >= len(my_args):
+ error_arg = "ERROR: Missing or invalid '" + arg1 + "' argument"
+ log_error(error_arg)
+ log_error(usage_msg)
+ exit(1)
+ arg2 = my_args[idx]
+ idx = idx + 1
+
+ if arg1 == "flowPathFlags":
+ if "DISCARD_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x1
+ if "KEEP_ONLY_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x2
+ elif arg1 == "matchInPort":
+ # Just mark whether inPort matching is enabled
+ matchInPortEnabled = arg2 in ['True', 'true']
+ # inPort = {}
+ # inPort['value'] = int(arg2, 0)
+ # match['inPort'] = inPort
+ ## match['matchInPort'] = True
+ elif arg1 == "matchSrcMac":
+ srcMac = {}
+ srcMac['value'] = arg2
+ match['srcMac'] = srcMac
+ # match['matchSrcMac'] = True
+ elif arg1 == "matchDstMac":
+ dstMac = {}
+ dstMac['value'] = arg2
+ match['dstMac'] = dstMac
+ # match['matchDstMac'] = True
+ elif arg1 == "matchEthernetFrameType":
+ match['ethernetFrameType'] = int(arg2, 0)
+ # match['matchEthernetFrameType'] = True
+ elif arg1 == "matchVlanId":
+ match['vlanId'] = int(arg2, 0)
+ # match['matchVlanId'] = True
+ elif arg1 == "matchVlanPriority":
+ match['vlanPriority'] = int(arg2, 0)
+ # match['matchVlanPriority'] = True
+ elif arg1 == "matchSrcIPv4Net":
+ srcIPv4Net = {}
+ srcIPv4Net['value'] = arg2
+ match['srcIPv4Net'] = srcIPv4Net
+ # match['matchSrcIPv4Net'] = True
+ elif arg1 == "matchDstIPv4Net":
+ dstIPv4Net = {}
+ dstIPv4Net['value'] = arg2
+ match['dstIPv4Net'] = dstIPv4Net
+ # match['matchDstIPv4Net'] = True
+ elif arg1 == "matchIpProto":
+ match['ipProto'] = int(arg2, 0)
+ # match['matchIpProto'] = True
+ elif arg1 == "matchIpToS":
+ match['ipToS'] = int(arg2, 0)
+ # match['matchIpToS'] = True
+ elif arg1 == "matchSrcTcpUdpPort":
+ match['srcTcpUdpPort'] = int(arg2, 0)
+ # match['matchSrcTcpUdpPort'] = True
+ elif arg1 == "matchDstTcpUdpPort":
+ match['dstTcpUdpPort'] = int(arg2, 0)
+ # match['matchDstTcpUdpPort'] = True
+ elif arg1 == "actionOutput":
+ # Mark whether ACTION_OUTPUT action is enabled
+ actionOutputEnabled = arg2 in ['True', 'true']
+ # If ACTION_OUTPUT is explicitly enabled, add an entry with a fake
+ # port number. We need this entry to preserve the action ordering.
+ if actionOutputEnabled == True:
+ actionOutput = {}
+ outPort = {}
+ outPort['value'] = 0xffff
+ actionOutput['port'] = outPort
+ actionOutput['maxLen'] = 0
+ action['actionOutput'] = actionOutput
+ # action['actionType'] = 'ACTION_OUTPUT'
+ actions.append(action)
+ #
+ elif arg1 == "actionSetVlanId":
+ vlanId = {}
+ vlanId['vlanId'] = int(arg2, 0)
+ action['actionSetVlanId'] = vlanId
+ # action['actionType'] = 'ACTION_SET_VLAN_VID'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetVlanPriority":
+ vlanPriority = {}
+ vlanPriority['vlanPriority'] = int(arg2, 0)
+ action['actionSetVlanPriority'] = vlanPriority
+ # action['actionType'] = 'ACTION_SET_VLAN_PCP'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionStripVlan":
+ stripVlan = {}
+ stripVlan['stripVlan'] = arg2 in ['True', 'true']
+ action['actionStripVlan'] = stripVlan
+ # action['actionType'] = 'ACTION_STRIP_VLAN'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetEthernetSrcAddr":
+ ethernetSrcAddr = {}
+ ethernetSrcAddr['value'] = arg2
+ setEthernetSrcAddr = {}
+ setEthernetSrcAddr['addr'] = ethernetSrcAddr
+ action['actionSetEthernetSrcAddr'] = setEthernetSrcAddr
+ # action['actionType'] = 'ACTION_SET_DL_SRC'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetEthernetDstAddr":
+ ethernetDstAddr = {}
+ ethernetDstAddr['value'] = arg2
+ setEthernetDstAddr = {}
+ setEthernetDstAddr['addr'] = ethernetDstAddr
+ action['actionSetEthernetDstAddr'] = setEthernetDstAddr
+ # action['actionType'] = 'ACTION_SET_DL_DST'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetIPv4SrcAddr":
+ IPv4SrcAddr = {}
+ IPv4SrcAddr['value'] = arg2
+ setIPv4SrcAddr = {}
+ setIPv4SrcAddr['addr'] = IPv4SrcAddr
+ action['actionSetIPv4SrcAddr'] = setIPv4SrcAddr
+ # action['actionType'] = 'ACTION_SET_NW_SRC'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetIPv4DstAddr":
+ IPv4DstAddr = {}
+ IPv4DstAddr['value'] = arg2
+ setIPv4DstAddr = {}
+ setIPv4DstAddr['addr'] = IPv4DstAddr
+ action['actionSetIPv4DstAddr'] = setIPv4DstAddr
+ # action['actionType'] = 'ACTION_SET_NW_DST'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetIpToS":
+ ipToS = {}
+ ipToS['ipToS'] = int(arg2, 0)
+ action['actionSetIpToS'] = ipToS
+ # action['actionType'] = 'ACTION_SET_NW_TOS'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpSrcPort":
+ tcpUdpSrcPort = {}
+ tcpUdpSrcPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
+ # action['actionType'] = 'ACTION_SET_TP_SRC'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpDstPort":
+ tcpUdpDstPort = {}
+ tcpUdpDstPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
+ # action['actionType'] = 'ACTION_SET_TP_DST'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionEnqueue":
+ # TODO: Implement ACTION_ENQUEUE
+ actionEnqueue = {}
+ # actionEnqueue['queueId'] = int(arg2, 0)
+ # enqueuePort = {}
+ # enqueuePort['value'] = int(arg3, 0)
+ # actionEnqueue['port'] = enqueuePort
+ # action['actionEnqueue'] = actionEnqueue
+ # # action['actionType'] = 'ACTION_ENQUEUE'
+ # actions.append(copy.deepcopy(action))
+ #
+ else:
+ log_error("ERROR: Unknown argument '%s'" % (arg1))
+ log_error(usage_msg)
+ exit(1)
+
+ return {
+ 'my_flow_id' : my_flow_id,
+ 'my_installer_id' : my_installer_id,
+ 'my_src_dpid' : my_src_dpid,
+ 'my_src_port' : my_src_port,
+ 'my_dst_dpid' : my_dst_dpid,
+ 'my_dst_port' : my_dst_port,
+ 'flowPathFlags' : flowPathFlags,
+ 'match' : match,
+ 'matchInPortEnabled' : matchInPortEnabled,
+ 'actions' : actions,
+ 'actionOutputEnabled' : actionOutputEnabled
+ }
+
+def compute_data_path(parsed_args):
+
+ my_src_dpid = parsed_args['my_src_dpid']
+ my_src_port = parsed_args['my_src_port']
+ my_dst_dpid = parsed_args['my_dst_dpid']
+ my_dst_port = parsed_args['my_dst_port']
+
+ # Compute the shortest path
+ data_path = shortest_path(my_src_dpid, my_src_port, my_dst_dpid, my_dst_port)
+
+ debug("Data Path: %s" % data_path)
+ return data_path
+
+def compute_flow_path(parsed_args, data_path):
+
+ my_flow_id = parsed_args['my_flow_id']
+ my_installer_id = parsed_args['my_installer_id']
+ myFlowPathFlags = parsed_args['flowPathFlags']
+ match = parsed_args['match']
+ matchInPortEnabled = parsed_args['matchInPortEnabled']
+ actions = parsed_args['actions']
+ actionOutputEnabled = parsed_args['actionOutputEnabled']
+ my_data_path = copy.deepcopy(data_path)
+
+ flow_id = {}
+ flow_id['value'] = my_flow_id
+ installer_id = {}
+ installer_id['value'] = my_installer_id
+ flowPathFlags = {}
+ flowPathFlags['flags'] = myFlowPathFlags
+
+ flowEntryActions = {}
+
+ flow_path = {}
+ flow_path['flowId'] = flow_id
+ flow_path['installerId'] = installer_id
+ # NOTE: The 'flowPathType' might be rewritten later
+ flow_path['flowPathType'] = 'FP_TYPE_EXPLICIT_PATH'
+ flow_path['flowPathUserState'] = 'FP_USER_ADD'
+ flow_path['flowPathFlags'] = flowPathFlags
+
+ if (len(match) > 0):
+ flow_path['flowEntryMatch'] = copy.deepcopy(match)
+
+ #
+ # Add the match conditions to each flow entry
+ #
+ if (len(match) > 0) or matchInPortEnabled:
+ idx = 0
+ while idx < len(my_data_path['flowEntries']):
+ if matchInPortEnabled:
+ inPort = my_data_path['flowEntries'][idx]['inPort']
+ match['inPort'] = copy.deepcopy(inPort)
+ # match['matchInPort'] = True
+ my_data_path['flowEntries'][idx]['flowEntryMatch'] = copy.deepcopy(match)
+ idx = idx + 1
+
+
+ if (len(actions) > 0):
+ flowEntryActions['actions'] = copy.deepcopy(actions)
+ flow_path['flowEntryActions'] = flowEntryActions
+
+ #
+ # Set the actions for each flow entry
+ # NOTE: The actions from the command line are aplied
+ # ONLY to the first flow entry.
+ #
+ # If ACTION_OUTPUT action is enabled, then apply it
+ # to each flow entry.
+ #
+ if (len(actions) > 0) or actionOutputEnabled:
+ idx = 0
+ while idx < len(my_data_path['flowEntries']):
+ if idx > 0:
+ actions = [] # Reset the actions for all but first entry
+ action = {}
+ outPort = my_data_path['flowEntries'][idx]['outPort']
+ actionOutput = {}
+ actionOutput['port'] = copy.deepcopy(outPort)
+ # actionOutput['maxLen'] = 0 # TODO: not used for now
+ action['actionOutput'] = copy.deepcopy(actionOutput)
+ # action['actionType'] = 'ACTION_OUTPUT'
+ actions.append(copy.deepcopy(action))
+ flowEntryActions = {}
+ flowEntryActions['actions'] = copy.deepcopy(actions)
+
+ my_data_path['flowEntries'][idx]['flowEntryActions'] = flowEntryActions
+ idx = idx + 1
+
+ flow_path['dataPath'] = my_data_path
+ debug("Flow Path: %s" % flow_path)
+ return flow_path
+
+def exec_monitoring_by_onos(parsed_args):
+ idx = 0
+ while idx < len(parsed_args):
+ data_path = {}
+ src_dpid = {}
+ src_port = {}
+ dst_dpid = {}
+ dst_port = {}
+ src_switch_port = {}
+ dst_switch_port = {}
+ flow_entries = []
+
+ src_dpid['value'] = parsed_args[idx]['my_src_dpid']
+ src_port['value'] = parsed_args[idx]['my_src_port']
+ dst_dpid['value'] = parsed_args[idx]['my_dst_dpid']
+ dst_port['value'] = parsed_args[idx]['my_dst_port']
+ src_switch_port['dpid'] = src_dpid
+ src_switch_port['port'] = src_port
+ dst_switch_port['dpid'] = dst_dpid
+ dst_switch_port['port'] = dst_port
+
+ data_path['srcPort'] = copy.deepcopy(src_switch_port)
+ data_path['dstPort'] = copy.deepcopy(dst_switch_port)
+ data_path['flowEntries'] = copy.deepcopy(flow_entries)
+
+ #
+ # XXX: Explicitly disable the InPort matching, and
+ # the Output action, because they get in the way
+ # during the compute_flow_path() processing.
+ #
+ parsed_args[idx]['matchInPortEnabled'] = False
+ parsed_args[idx]['actionOutputEnabled'] = False
+
+ flow_path = compute_flow_path(parsed_args[idx], data_path)
+ flow_path['flowPathType'] = 'FP_TYPE_SHORTEST_PATH'
+
+ add_shortest_path_flow(flow_path)
+
+ idx = idx + 1
+
+
+def exec_processing_by_script(parsed_args):
+ #
+ # Initialization
+ #
+ last_data_paths = []
+ idx = 0
+ while idx < len(parsed_args):
+ last_data_path = []
+ last_data_paths.append(copy.deepcopy(last_data_path))
+ idx = idx + 1
+
+ #
+ # Do the work: install and/or periodically monitor each flow
+ #
+ while True:
+ idx = 0
+ while idx < len(parsed_args):
+ last_data_path = last_data_paths[idx]
+ my_flow_id = parsed_args[idx]['my_flow_id']
+ data_path = compute_data_path(parsed_args[idx])
+ if data_path != last_data_path:
+ print_data_path(data_path)
+ if len(last_data_path) > 0:
+ delete_flow_path(my_flow_id)
+ if len(data_path) > 0:
+ flow_path = compute_flow_path(parsed_args[idx], data_path)
+ add_flow_path(flow_path)
+ last_data_paths[idx] = copy.deepcopy(data_path)
+ idx = idx + 1
+
+ if MonitoringEnabled != True:
+ break
+ time.sleep(1)
+
+
if __name__ == "__main__":
- usage_msg = "Usage: %s <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port>" % (sys.argv[0])
+ usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " <flow-id> The Flow ID, or -1 if it should be assigned by ONOS\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Flags:\n"
+ usage_msg = usage_msg + " -m [monitorname] Monitor and maintain the installed shortest path(s)\n"
+ usage_msg = usage_msg + " If 'monitorname' is specified and is set to 'ONOS'\n"
+ usage_msg = usage_msg + " (case insensitive), then the flow generation and\n"
+ usage_msg = usage_msg + " maintanenance is done by ONOS itself.\n"
+ usage_msg = usage_msg + " Otherwise, it is done by this script.\n"
+ usage_msg = usage_msg + " -f <filename> Read the flow(s) to install from a file\n"
+ usage_msg = usage_msg + " File format: one line per flow starting with <flow-id>\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Flow Path Flags:\n"
+ usage_msg = usage_msg + " flowPathFlags <Flags> (flag names separated by ',')\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Known flags:\n"
+ usage_msg = usage_msg + " DISCARD_FIRST_HOP_ENTRY : Discard the first-hop flow entry\n"
+ usage_msg = usage_msg + " KEEP_ONLY_FIRST_HOP_ENTRY : Keep only the first-hop flow entry\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Match Conditions:\n"
+ usage_msg = usage_msg + " matchInPort <True|False> (default to True)\n"
+ usage_msg = usage_msg + " matchSrcMac <source MAC address>\n"
+ usage_msg = usage_msg + " matchDstMac <destination MAC address>\n"
+ usage_msg = usage_msg + " matchEthernetFrameType <Ethernet frame type>\n"
+ usage_msg = usage_msg + " matchVlanId <VLAN ID>\n"
+ usage_msg = usage_msg + " matchVlanPriority <VLAN priority>\n"
+ usage_msg = usage_msg + " matchSrcIPv4Net <source IPv4 network address>\n"
+ usage_msg = usage_msg + " matchDstIPv4Net <destination IPv4 network address>\n"
+ usage_msg = usage_msg + " matchIpProto <IP protocol>\n"
+ usage_msg = usage_msg + " matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
+ usage_msg = usage_msg + " matchSrcTcpUdpPort <source TCP/UDP port>\n"
+ usage_msg = usage_msg + " matchDstTcpUdpPort <destination TCP/UDP port>\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Actions:\n"
+ usage_msg = usage_msg + " actionOutput <True|False> (default to True)\n"
+ usage_msg = usage_msg + " actionSetVlanId <VLAN ID>\n"
+ usage_msg = usage_msg + " actionSetVlanPriority <VLAN priority>\n"
+ usage_msg = usage_msg + " actionStripVlan <True|False>\n"
+ usage_msg = usage_msg + " actionSetEthernetSrcAddr <source MAC address>\n"
+ usage_msg = usage_msg + " actionSetEthernetDstAddr <destination MAC address>\n"
+ usage_msg = usage_msg + " actionSetIPv4SrcAddr <source IPv4 address>\n"
+ usage_msg = usage_msg + " actionSetIPv4DstAddr <destination IPv4 address>\n"
+ usage_msg = usage_msg + " actionSetIpToS <IP ToS (DSCP field, 6 bits)>\n"
+ usage_msg = usage_msg + " actionSetTcpUdpSrcPort <source TCP/UDP port>\n"
+ usage_msg = usage_msg + " actionSetTcpUdpDstPort <destination TCP/UDP port>\n"
+ usage_msg = usage_msg + " Actions (not implemented yet):\n"
+ usage_msg = usage_msg + " actionEnqueue <dummy argument>\n"
# app.debug = False;
@@ -93,29 +542,72 @@
print(usage_msg)
exit(0)
- # Check arguments
- if len(sys.argv) < 7:
- log_error(usage_msg)
- exit(1)
+ #
+ # Check the flags
+ #
+ start_argv_index = 1
+ idx = 1
+ while idx < len(sys.argv):
+ arg1 = sys.argv[idx]
+ idx = idx + 1
+ if arg1 == "-m":
+ MonitoringEnabled = True
+ if idx < len(sys.argv):
+ arg2 = sys.argv[idx]
+ if arg2.lower() == "onos":
+ MonitoringByOnos = True
+ idx = idx + 1
+ start_argv_index = idx
+ elif arg1 == "-f":
+ if idx >= len(sys.argv):
+ error_arg = "ERROR: Missing or invalid '" + arg1 + "' argument"
+ log_error(error_arg)
+ log_error(usage_msg)
+ exit(1)
+ ReadFromFile = sys.argv[idx]
+ idx = idx + 1
+ start_argv_index = idx
+ else:
+ break;
- # Do the work
- my_flow_id = sys.argv[1]
- my_installer_id = sys.argv[2]; # 'ONOS-Path-Computation-Python'
- data_path = shortest_path(sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6])
+ #
+ # Read the arguments from a file or from the remaining command line options
+ #
+ my_lines = []
+ if len(ReadFromFile) > 0:
+ f = open(ReadFromFile, "rt")
+ my_line = f.readline()
+ while my_line:
+ if len(my_line.rstrip()) > 0 and my_line[0] != "#":
+ my_token_line = my_line.rstrip().split()
+ my_lines.append(my_token_line)
+ my_line = f.readline()
+ else:
+ my_lines.append(copy.deepcopy(sys.argv[start_argv_index:]))
- debug("Data Path: %s" % data_path)
+ #
+ # Initialization
+ #
+ last_data_paths = []
+ parsed_args = []
+ idx = 0
+ while idx < len(my_lines):
+ last_data_path = []
+ last_data_paths.append(copy.deepcopy(last_data_path))
+ #
+ # Parse the flow arguments
+ #
+ my_args = my_lines[idx]
+ parsed_args.append(copy.deepcopy(extract_flow_args(my_args)))
+ # Cleanup leftover state
+ my_flow_id = parsed_args[idx]['my_flow_id']
+ delete_flow_path(my_flow_id)
- flow_id = {}
- flow_id['value'] = my_flow_id
- installer_id = {}
- installer_id['value'] = my_installer_id
+ idx = idx + 1
- flow_path = {}
- flow_path['flowId'] = flow_id
- flow_path['installerId'] = installer_id
- flow_path['dataPath'] = data_path
+ #
+ if MonitoringByOnos == True:
+ exec_monitoring_by_onos(parsed_args)
+ else:
+ exec_processing_by_script(parsed_args)
- flow_path_json = json.dumps(flow_path)
- debug("Flow Path: %s" % flow_path_json)
-
- add_flow_path(flow_path_json)
diff --git a/web/clear_core.py b/web/clear_core.py
new file mode 100755
index 0000000..ea3e964
--- /dev/null
+++ b/web/clear_core.py
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+
+import os
+import json
+
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+
+def read_config():
+ global LB, TESTBED, controllers, core_switches, ONOS_GUI3_HOST, ONOS_GUI3_CONTROL_HOST
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ LB = conf['LB']
+ TESTBED = conf['TESTBED']
+ controllers = conf['controllers']
+ core_switches=conf['core_switches']
+ ONOS_GUI3_HOST=conf['ONOS_GUI3_HOST']
+ ONOS_GUI3_CONTROL_HOST=conf['ONOS_GUI3_CONTROL_HOST']
+ f.close()
+
+if __name__ == "__main__":
+ onos_rest_port = 8080
+ read_config()
+
+ try:
+ sw_list = json.dumps(core_switches)
+ command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/core/clearflowtable/json" % (sw_list, controllers[0], onos_rest_port)
+
+ print command
+ result = os.popen(command).read()
+ print result
+ except:
+ print "REST IF has issue"
+ exit
diff --git a/web/config.json.dev.1node b/web/config.json.dev.1node
new file mode 100644
index 0000000..580a136
--- /dev/null
+++ b/web/config.json.dev.1node
@@ -0,0 +1,26 @@
+{
+ "LB": false,
+ "TESTBED": "sw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://localhost:9000",
+ "ONOS_GUI3_HOST": "http://localhost:9000",
+ "cluster_basename": "onosdev",
+ "controllers": [
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1",
+ "onosdev1"
+ ],
+ "core_switches": [
+ "00:00:00:00:00:00:01:01",
+ "00:00:00:00:00:00:01:02",
+ "00:00:00:00:00:00:01:03",
+ "00:00:00:00:00:00:01:04",
+ "00:00:00:00:00:00:01:05",
+ "00:00:00:00:00:00:01:06"
+ ]
+}
diff --git a/web/config.json.devA b/web/config.json.devA
new file mode 100644
index 0000000..b20639e
--- /dev/null
+++ b/web/config.json.devA
@@ -0,0 +1,22 @@
+{
+ "LB": false,
+ "TESTBED": "sw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://10.128.4.51:9000",
+ "ONOS_GUI3_HOST": "http://10.128.4.51:9000",
+ "cluster_basename": "ONOS",
+ "controllers": [
+ "DevA-ONOS1",
+ "DevA-ONOS2",
+ "DevA-ONOS3",
+ "DevA-ONOS4"
+ ],
+ "core_switches": [
+ "00:00:00:00:ba:5e:ba:11",
+ "00:00:00:00:00:00:ba:12",
+ "00:00:20:4e:7f:51:8a:35",
+ "00:00:00:00:ba:5e:ba:13",
+ "00:00:00:08:a2:08:f9:01",
+ "00:00:00:16:97:08:9a:46"
+ ]
+}
diff --git a/web/config.json.hw b/web/config.json.hw
new file mode 100644
index 0000000..533bbee
--- /dev/null
+++ b/web/config.json.hw
@@ -0,0 +1,26 @@
+{
+ "LB": false,
+ "TESTBED": "hw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://10.128.4.11:9000",
+ "ONOS_GUI3_HOST": "http://10.128.4.11:9000",
+ "cluster_basename": "ONOS",
+ "controllers": [
+ "ONOS1",
+ "ONOS2",
+ "ONOS3",
+ "ONOS4",
+ "ONOS5",
+ "ONOS6",
+ "ONOS7",
+ "ONOS8"
+ ],
+ "core_switches": [
+ "00:00:00:00:ba:5e:ba:11",
+ "00:00:00:00:00:00:ba:12",
+ "00:00:20:4e:7f:51:8a:35",
+ "00:00:00:00:ba:5e:ba:13",
+ "00:00:00:08:a2:08:f9:01",
+ "00:01:00:16:97:08:9a:46"
+ ]
+}
diff --git a/web/config.json.sw b/web/config.json.sw
new file mode 100644
index 0000000..7c6e702
--- /dev/null
+++ b/web/config.json.sw
@@ -0,0 +1,26 @@
+{
+ "LB": false,
+ "TESTBED": "sw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://gui3.onlab.us:8081",
+ "ONOS_GUI3_HOST": "http://gui3.onlab.us:8080",
+ "cluster_basename": "onosgui",
+ "controllers": [
+ "onosgui1",
+ "onosgui2",
+ "onosgui3",
+ "onosgui4",
+ "onosgui5",
+ "onosgui6",
+ "onosgui7",
+ "onosgui8"
+ ],
+ "core_switches": [
+ "00:00:00:00:ba:5e:ba:11",
+ "00:00:00:00:00:00:ba:12",
+ "00:00:20:4e:7f:51:8a:35",
+ "00:00:00:00:ba:5e:ba:13",
+ "00:00:00:08:a2:08:f9:01",
+ "00:00:00:16:97:08:9a:46"
+ ]
+}
diff --git a/web/config.json.sw_dev b/web/config.json.sw_dev
new file mode 100644
index 0000000..bb89670
--- /dev/null
+++ b/web/config.json.sw_dev
@@ -0,0 +1,26 @@
+{
+ "LB": false,
+ "TESTBED": "sw",
+ "ONOS_DEFAULT_HOST": "localhost",
+ "ONOS_GUI3_CONTROL_HOST": "http://devy-gui.onlab.us:8080",
+ "ONOS_GUI3_HOST": "http://devy-gui.onlab.us:8080",
+ "cluster_basename": "onosdevy",
+ "controllers": [
+ "onosdevy1",
+ "onosdevy2",
+ "onosdevy3",
+ "onosdevy4",
+ "onosdevy5",
+ "onosdevy6",
+ "onosdevy7",
+ "onosdevy8"
+ ],
+ "core_switches": [
+ "00:00:00:00:00:00:01:01",
+ "00:00:00:00:00:00:01:02",
+ "00:00:00:00:00:00:01:03",
+ "00:00:00:00:00:00:01:04",
+ "00:00:00:00:00:00:01:05",
+ "00:00:00:00:00:00:01:06"
+ ]
+}
diff --git a/web/delete_flow.py b/web/delete_flow.py
index f6f3d39..fff9319 100755
--- a/web/delete_flow.py
+++ b/web/delete_flow.py
@@ -44,7 +44,14 @@
# debug("parsed %s" % parsedResult)
if __name__ == "__main__":
- usage_msg = "Usage: %s <flow_id>" % (sys.argv[0])
+ usage_msg = "Delete flow state from the ONOS Network Map and the switches\n"
+ usage_msg = usage_msg + "Usage: %s <begin-flow-id> <end-flow-id>\n" % (sys.argv[0])
+ usage_msg = usage_msg + " %s <flow-id>\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Arguments:\n"
+ usage_msg = usage_msg + " <begin-flow-id> <end-flow-id> Delete all flows in the flow ID range\n"
+ usage_msg = usage_msg + " <flow-id> Delete a single flow with the flow ID\n"
+ usage_msg = usage_msg + " all Delete all flows\n"
# app.debug = False;
@@ -58,5 +65,17 @@
log_error(usage_msg)
exit(1)
- # Do the work
- delete_flow_path(sys.argv[1]);
+ if (sys.argv[1] == "all"):
+ delete_flow_path(sys.argv[1])
+ else:
+ begin_flow_id = int(sys.argv[1], 0)
+ if len(sys.argv) >= 3:
+ end_flow_id = int(sys.argv[2], 0)
+ else:
+ end_flow_id = begin_flow_id
+
+ # Do the work
+ flow_id = begin_flow_id
+ while flow_id <= end_flow_id:
+ delete_flow_path(flow_id)
+ flow_id = flow_id + 1
diff --git a/web/e2eflow.sh b/web/e2eflow.sh
new file mode 100755
index 0000000..e0454ce
--- /dev/null
+++ b/web/e2eflow.sh
@@ -0,0 +1,4 @@
+#! /bin/sh
+./add_flow.py -m 1 host0101-host0301 00:00:00:00:00:00:01:01 1 00:00:00:00:00:00:03:01 1 matchSrcMac 00:00:00:00:01:01 matchDstMac 00:00:00:00:03:01 2>&1 > /dev/null &
+./add_flow.py -m 2 host0301-host0101 00:00:00:00:00:00:03:01 1 00:00:00:00:00:00:01:01 1 matchSrcMac 00:00:00:00:03:01 matchDstMac 00:00:00:00:01:01 2>&1 > /dev/null &
+#./get_flow.py all
diff --git a/web/flowdef_4node_144.txt b/web/flowdef_4node_144.txt
new file mode 100644
index 0000000..eb6342f
--- /dev/null
+++ b/web/flowdef_4node_144.txt
@@ -0,0 +1,145 @@
+# For 4 nodes cluster, 24 flows per network pair, total 144 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:03:08
+14 ps_7_2 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:02:08
+15 ps_8_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:03:09
+16 ps_8_2 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:02:09
+17 ps_9_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:03:0a
+18 ps_9_2 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:02:0a
+19 ps_10_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:03:0b
+20 ps_10_2 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:02:0b
+21 ps_11_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:03:0c
+22 ps_11_2 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:02:0c
+23 ps_12_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:03:0d
+24 ps_12_2 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:02:0d
+25 ps_13_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:03:0e
+26 ps_13_2 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:02:0e
+27 ps_14_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:03:0f
+28 ps_14_2 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:02:0f
+29 ps_15_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:03:10
+30 ps_15_2 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:02:10
+31 ps_16_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:03:11
+32 ps_16_2 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:02:11
+33 ps_17_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:03:12
+34 ps_17_2 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:02:12
+35 ps_18_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:03:13
+36 ps_18_2 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:02:13
+37 ps_19_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:03:14
+38 ps_19_2 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:02:14
+39 ps_20_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:03:15
+40 ps_20_2 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:02:15
+41 ps_21_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:03:16
+42 ps_21_2 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:02:16
+43 ps_22_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:03:17
+44 ps_22_2 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:02:17
+45 ps_23_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:03:18
+46 ps_23_2 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:02:18
+47 ps_24_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:03:19
+48 ps_24_2 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:02:19
+49 ps_25_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+50 ps_25_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+51 ps_26_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+52 ps_26_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+53 ps_27_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+54 ps_27_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+55 ps_28_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+56 ps_28_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+57 ps_29_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+58 ps_29_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+59 ps_30_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+60 ps_30_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+61 ps_31_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:04:08
+62 ps_31_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:02:08
+63 ps_32_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:04:09
+64 ps_32_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:02:09
+65 ps_33_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:04:0a
+66 ps_33_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:02:0a
+67 ps_34_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:04:0b
+68 ps_34_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:02:0b
+69 ps_35_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:04:0c
+70 ps_35_2 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:02:0c
+71 ps_36_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:04:0d
+72 ps_36_2 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:02:0d
+73 ps_37_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:04:0e
+74 ps_37_2 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:02:0e
+75 ps_38_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:04:0f
+76 ps_38_2 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:02:0f
+77 ps_39_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:04:10
+78 ps_39_2 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:02:10
+79 ps_40_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:04:11
+80 ps_40_2 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:02:11
+81 ps_41_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:04:12
+82 ps_41_2 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:02:12
+83 ps_42_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:04:13
+84 ps_42_2 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:02:13
+85 ps_43_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:04:14
+86 ps_43_2 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:02:14
+87 ps_44_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:04:15
+88 ps_44_2 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:02:15
+89 ps_45_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:04:16
+90 ps_45_2 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:02:16
+91 ps_46_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:04:17
+92 ps_46_2 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:02:17
+93 ps_47_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:04:18
+94 ps_47_2 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:02:18
+95 ps_48_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:04:19
+96 ps_48_2 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:02:19
+97 ps_49_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+98 ps_49_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+99 ps_50_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+100 ps_50_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+101 ps_51_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+102 ps_51_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+103 ps_52_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+104 ps_52_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+105 ps_53_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+106 ps_53_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+107 ps_54_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+108 ps_54_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+109 ps_55_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:04:08
+110 ps_55_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:03:08
+111 ps_56_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:04:09
+112 ps_56_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:03:09
+113 ps_57_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:04:0a
+114 ps_57_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:03:0a
+115 ps_58_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:04:0b
+116 ps_58_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:03:0b
+117 ps_59_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:04:0c
+118 ps_59_2 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:03:0c
+119 ps_60_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:04:0d
+120 ps_60_2 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:03:0d
+121 ps_61_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:04:0e
+122 ps_61_2 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:03:0e
+123 ps_62_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:04:0f
+124 ps_62_2 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:03:0f
+125 ps_63_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:04:10
+126 ps_63_2 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:03:10
+127 ps_64_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:04:11
+128 ps_64_2 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:03:11
+129 ps_65_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:04:12
+130 ps_65_2 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:03:12
+131 ps_66_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:04:13
+132 ps_66_2 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:03:13
+133 ps_67_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:04:14
+134 ps_67_2 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:03:14
+135 ps_68_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:04:15
+136 ps_68_2 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:03:15
+137 ps_69_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:04:16
+138 ps_69_2 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:03:16
+139 ps_70_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:04:17
+140 ps_70_2 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:03:17
+141 ps_71_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:04:18
+142 ps_71_2 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:03:18
+143 ps_72_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:04:19
+144 ps_72_2 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:03:19
diff --git a/web/flowdef_4node_48.txt b/web/flowdef_4node_48.txt
new file mode 100644
index 0000000..d7064b1
--- /dev/null
+++ b/web/flowdef_4node_48.txt
@@ -0,0 +1,49 @@
+# For 4 nodes cluster, 8 flows per network pair, total 48 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:03:08
+14 ps_7_2 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:02:08
+15 ps_8_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:03:09
+16 ps_8_2 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:02:09
+17 ps_9_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+18 ps_9_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+19 ps_10_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+20 ps_10_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+21 ps_11_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+22 ps_11_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+23 ps_12_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+24 ps_12_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+25 ps_13_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+26 ps_13_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+27 ps_14_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+28 ps_14_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+29 ps_15_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:04:08
+30 ps_15_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:02:08
+31 ps_16_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:04:09
+32 ps_16_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:02:09
+33 ps_17_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+34 ps_17_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+35 ps_18_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+36 ps_18_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+37 ps_19_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+38 ps_19_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+39 ps_20_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+40 ps_20_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+41 ps_21_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+42 ps_21_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+43 ps_22_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+44 ps_22_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+45 ps_23_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:04:08
+46 ps_23_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:03:08
+47 ps_24_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:04:09
+48 ps_24_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:03:09
diff --git a/web/flowdef_8node_1008.txt b/web/flowdef_8node_1008.txt
new file mode 100644
index 0000000..cc77bed
--- /dev/null
+++ b/web/flowdef_8node_1008.txt
@@ -0,0 +1,1009 @@
+# For 8 nodes cluster, 24 flows per network pair, total 1008 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:03:08
+14 ps_7_2 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:02:08
+15 ps_8_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:03:09
+16 ps_8_2 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:02:09
+17 ps_9_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:03:0a
+18 ps_9_2 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:02:0a
+19 ps_10_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:03:0b
+20 ps_10_2 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:02:0b
+21 ps_11_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:03:0c
+22 ps_11_2 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:02:0c
+23 ps_12_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:03:0d
+24 ps_12_2 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:02:0d
+25 ps_13_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:03:0e
+26 ps_13_2 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:02:0e
+27 ps_14_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:03:0f
+28 ps_14_2 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:02:0f
+29 ps_15_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:03:10
+30 ps_15_2 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:02:10
+31 ps_16_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:03:11
+32 ps_16_2 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:02:11
+33 ps_17_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:03:12
+34 ps_17_2 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:02:12
+35 ps_18_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:03:13
+36 ps_18_2 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:02:13
+37 ps_19_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:03:14
+38 ps_19_2 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:02:14
+39 ps_20_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:03:15
+40 ps_20_2 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:02:15
+41 ps_21_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:03:16
+42 ps_21_2 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:02:16
+43 ps_22_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:03:17
+44 ps_22_2 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:02:17
+45 ps_23_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:03:18
+46 ps_23_2 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:02:18
+47 ps_24_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:03:19
+48 ps_24_2 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:02:19
+49 ps_25_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+50 ps_25_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+51 ps_26_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+52 ps_26_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+53 ps_27_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+54 ps_27_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+55 ps_28_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+56 ps_28_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+57 ps_29_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+58 ps_29_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+59 ps_30_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+60 ps_30_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+61 ps_31_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:04:08
+62 ps_31_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:02:08
+63 ps_32_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:04:09
+64 ps_32_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:02:09
+65 ps_33_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:04:0a
+66 ps_33_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:02:0a
+67 ps_34_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:04:0b
+68 ps_34_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:02:0b
+69 ps_35_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:04:0c
+70 ps_35_2 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:02:0c
+71 ps_36_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:04:0d
+72 ps_36_2 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:02:0d
+73 ps_37_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:04:0e
+74 ps_37_2 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:02:0e
+75 ps_38_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:04:0f
+76 ps_38_2 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:02:0f
+77 ps_39_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:04:10
+78 ps_39_2 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:02:10
+79 ps_40_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:04:11
+80 ps_40_2 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:02:11
+81 ps_41_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:04:12
+82 ps_41_2 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:02:12
+83 ps_42_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:04:13
+84 ps_42_2 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:02:13
+85 ps_43_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:04:14
+86 ps_43_2 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:02:14
+87 ps_44_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:04:15
+88 ps_44_2 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:02:15
+89 ps_45_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:04:16
+90 ps_45_2 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:02:16
+91 ps_46_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:04:17
+92 ps_46_2 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:02:17
+93 ps_47_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:04:18
+94 ps_47_2 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:02:18
+95 ps_48_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:04:19
+96 ps_48_2 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:02:19
+97 ps_49_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+98 ps_49_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+99 ps_50_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:05:03
+100 ps_50_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:02:03
+101 ps_51_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:05:04
+102 ps_51_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:02:04
+103 ps_52_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:05:05
+104 ps_52_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:02:05
+105 ps_53_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:05:06
+106 ps_53_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:02:06
+107 ps_54_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:05:07
+108 ps_54_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:02:07
+109 ps_55_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:05:08
+110 ps_55_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:02:08
+111 ps_56_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:05:09
+112 ps_56_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:02:09
+113 ps_57_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:05:0a
+114 ps_57_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:02:0a
+115 ps_58_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:05:0b
+116 ps_58_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:02:0b
+117 ps_59_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:05:0c
+118 ps_59_2 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:02:0c
+119 ps_60_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:05:0d
+120 ps_60_2 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:02:0d
+121 ps_61_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:05:0e
+122 ps_61_2 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:02:0e
+123 ps_62_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:05:0f
+124 ps_62_2 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:02:0f
+125 ps_63_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:05:10
+126 ps_63_2 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:02:10
+127 ps_64_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:05:11
+128 ps_64_2 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:02:11
+129 ps_65_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:05:12
+130 ps_65_2 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:02:12
+131 ps_66_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:05:13
+132 ps_66_2 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:02:13
+133 ps_67_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:05:14
+134 ps_67_2 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:02:14
+135 ps_68_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:05:15
+136 ps_68_2 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:02:15
+137 ps_69_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:05:16
+138 ps_69_2 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:02:16
+139 ps_70_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:05:17
+140 ps_70_2 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:02:17
+141 ps_71_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:05:18
+142 ps_71_2 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:02:18
+143 ps_72_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:05:19
+144 ps_72_2 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:02:19
+145 ps_73_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+146 ps_73_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+147 ps_74_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:06:03
+148 ps_74_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:02:03
+149 ps_75_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:06:04
+150 ps_75_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:02:04
+151 ps_76_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:06:05
+152 ps_76_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:02:05
+153 ps_77_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:06:06
+154 ps_77_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:02:06
+155 ps_78_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:06:07
+156 ps_78_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:02:07
+157 ps_79_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:06:08
+158 ps_79_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:02:08
+159 ps_80_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:06:09
+160 ps_80_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:02:09
+161 ps_81_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:06:0a
+162 ps_81_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:02:0a
+163 ps_82_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:06:0b
+164 ps_82_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:02:0b
+165 ps_83_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:06:0c
+166 ps_83_2 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:02:0c
+167 ps_84_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:06:0d
+168 ps_84_2 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:02:0d
+169 ps_85_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:06:0e
+170 ps_85_2 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:02:0e
+171 ps_86_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:06:0f
+172 ps_86_2 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:02:0f
+173 ps_87_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:06:10
+174 ps_87_2 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:02:10
+175 ps_88_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:06:11
+176 ps_88_2 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:02:11
+177 ps_89_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:06:12
+178 ps_89_2 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:02:12
+179 ps_90_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:06:13
+180 ps_90_2 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:02:13
+181 ps_91_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:06:14
+182 ps_91_2 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:02:14
+183 ps_92_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:06:15
+184 ps_92_2 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:02:15
+185 ps_93_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:06:16
+186 ps_93_2 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:02:16
+187 ps_94_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:06:17
+188 ps_94_2 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:02:17
+189 ps_95_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:06:18
+190 ps_95_2 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:02:18
+191 ps_96_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:06:19
+192 ps_96_2 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:02:19
+193 ps_97_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+194 ps_97_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+195 ps_98_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:07:03
+196 ps_98_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:02:03
+197 ps_99_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:07:04
+198 ps_99_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:02:04
+199 ps_100_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:07:05
+200 ps_100_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:02:05
+201 ps_101_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:07:06
+202 ps_101_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:02:06
+203 ps_102_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:07:07
+204 ps_102_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:02:07
+205 ps_103_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:07:08
+206 ps_103_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:02:08
+207 ps_104_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:07:09
+208 ps_104_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:02:09
+209 ps_105_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:07:0a
+210 ps_105_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:02:0a
+211 ps_106_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:07:0b
+212 ps_106_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:02:0b
+213 ps_107_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:07:0c
+214 ps_107_2 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:02:0c
+215 ps_108_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:07:0d
+216 ps_108_2 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:02:0d
+217 ps_109_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:07:0e
+218 ps_109_2 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:02:0e
+219 ps_110_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:07:0f
+220 ps_110_2 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:02:0f
+221 ps_111_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:07:10
+222 ps_111_2 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:02:10
+223 ps_112_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:07:11
+224 ps_112_2 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:02:11
+225 ps_113_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:07:12
+226 ps_113_2 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:02:12
+227 ps_114_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:07:13
+228 ps_114_2 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:02:13
+229 ps_115_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:07:14
+230 ps_115_2 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:02:14
+231 ps_116_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:07:15
+232 ps_116_2 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:02:15
+233 ps_117_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:07:16
+234 ps_117_2 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:02:16
+235 ps_118_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:07:17
+236 ps_118_2 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:02:17
+237 ps_119_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:07:18
+238 ps_119_2 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:02:18
+239 ps_120_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:07:19
+240 ps_120_2 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:02:19
+241 ps_121_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+242 ps_121_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+243 ps_122_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:08:03
+244 ps_122_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:02:03
+245 ps_123_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:08:04
+246 ps_123_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:02:04
+247 ps_124_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:08:05
+248 ps_124_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:02:05
+249 ps_125_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:08:06
+250 ps_125_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:02:06
+251 ps_126_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:08:07
+252 ps_126_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:02:07
+253 ps_127_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:08:08
+254 ps_127_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:02:08
+255 ps_128_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:08:09
+256 ps_128_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:02:09
+257 ps_129_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:08:0a
+258 ps_129_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:02:0a
+259 ps_130_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:08:0b
+260 ps_130_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:02:0b
+261 ps_131_1 00:00:00:00:00:00:02:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:02:0c matchDstMac 00:00:c0:a8:08:0c
+262 ps_131_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:02:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:02:0c
+263 ps_132_1 00:00:00:00:00:00:02:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:02:0d matchDstMac 00:00:c0:a8:08:0d
+264 ps_132_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:02:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:02:0d
+265 ps_133_1 00:00:00:00:00:00:02:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:02:0e matchDstMac 00:00:c0:a8:08:0e
+266 ps_133_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:02:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:02:0e
+267 ps_134_1 00:00:00:00:00:00:02:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:02:0f matchDstMac 00:00:c0:a8:08:0f
+268 ps_134_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:02:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:02:0f
+269 ps_135_1 00:00:00:00:00:00:02:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:02:10 matchDstMac 00:00:c0:a8:08:10
+270 ps_135_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:02:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:02:10
+271 ps_136_1 00:00:00:00:00:00:02:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:02:11 matchDstMac 00:00:c0:a8:08:11
+272 ps_136_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:02:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:02:11
+273 ps_137_1 00:00:00:00:00:00:02:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:02:12 matchDstMac 00:00:c0:a8:08:12
+274 ps_137_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:02:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:02:12
+275 ps_138_1 00:00:00:00:00:00:02:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:02:13 matchDstMac 00:00:c0:a8:08:13
+276 ps_138_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:02:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:02:13
+277 ps_139_1 00:00:00:00:00:00:02:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:02:14 matchDstMac 00:00:c0:a8:08:14
+278 ps_139_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:02:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:02:14
+279 ps_140_1 00:00:00:00:00:00:02:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:02:15 matchDstMac 00:00:c0:a8:08:15
+280 ps_140_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:02:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:02:15
+281 ps_141_1 00:00:00:00:00:00:02:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:02:16 matchDstMac 00:00:c0:a8:08:16
+282 ps_141_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:02:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:02:16
+283 ps_142_1 00:00:00:00:00:00:02:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:02:17 matchDstMac 00:00:c0:a8:08:17
+284 ps_142_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:02:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:02:17
+285 ps_143_1 00:00:00:00:00:00:02:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:02:18 matchDstMac 00:00:c0:a8:08:18
+286 ps_143_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:02:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:02:18
+287 ps_144_1 00:00:00:00:00:00:02:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:02:19 matchDstMac 00:00:c0:a8:08:19
+288 ps_144_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:02:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:02:19
+289 ps_145_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+290 ps_145_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+291 ps_146_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+292 ps_146_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+293 ps_147_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+294 ps_147_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+295 ps_148_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+296 ps_148_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+297 ps_149_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+298 ps_149_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+299 ps_150_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+300 ps_150_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+301 ps_151_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:04:08
+302 ps_151_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:03:08
+303 ps_152_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:04:09
+304 ps_152_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:03:09
+305 ps_153_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:04:0a
+306 ps_153_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:03:0a
+307 ps_154_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:04:0b
+308 ps_154_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:03:0b
+309 ps_155_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:04:0c
+310 ps_155_2 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:03:0c
+311 ps_156_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:04:0d
+312 ps_156_2 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:03:0d
+313 ps_157_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:04:0e
+314 ps_157_2 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:03:0e
+315 ps_158_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:04:0f
+316 ps_158_2 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:03:0f
+317 ps_159_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:04:10
+318 ps_159_2 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:03:10
+319 ps_160_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:04:11
+320 ps_160_2 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:03:11
+321 ps_161_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:04:12
+322 ps_161_2 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:03:12
+323 ps_162_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:04:13
+324 ps_162_2 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:03:13
+325 ps_163_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:04:14
+326 ps_163_2 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:03:14
+327 ps_164_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:04:15
+328 ps_164_2 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:03:15
+329 ps_165_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:04:16
+330 ps_165_2 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:03:16
+331 ps_166_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:04:17
+332 ps_166_2 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:03:17
+333 ps_167_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:04:18
+334 ps_167_2 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:03:18
+335 ps_168_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:04:19
+336 ps_168_2 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:03:19
+337 ps_169_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+338 ps_169_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+339 ps_170_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:05:03
+340 ps_170_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:03:03
+341 ps_171_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:05:04
+342 ps_171_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:03:04
+343 ps_172_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:05:05
+344 ps_172_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:03:05
+345 ps_173_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:05:06
+346 ps_173_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:03:06
+347 ps_174_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:05:07
+348 ps_174_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:03:07
+349 ps_175_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:05:08
+350 ps_175_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:03:08
+351 ps_176_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:05:09
+352 ps_176_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:03:09
+353 ps_177_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:05:0a
+354 ps_177_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:03:0a
+355 ps_178_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:05:0b
+356 ps_178_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:03:0b
+357 ps_179_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:05:0c
+358 ps_179_2 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:03:0c
+359 ps_180_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:05:0d
+360 ps_180_2 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:03:0d
+361 ps_181_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:05:0e
+362 ps_181_2 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:03:0e
+363 ps_182_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:05:0f
+364 ps_182_2 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:03:0f
+365 ps_183_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:05:10
+366 ps_183_2 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:03:10
+367 ps_184_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:05:11
+368 ps_184_2 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:03:11
+369 ps_185_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:05:12
+370 ps_185_2 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:03:12
+371 ps_186_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:05:13
+372 ps_186_2 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:03:13
+373 ps_187_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:05:14
+374 ps_187_2 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:03:14
+375 ps_188_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:05:15
+376 ps_188_2 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:03:15
+377 ps_189_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:05:16
+378 ps_189_2 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:03:16
+379 ps_190_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:05:17
+380 ps_190_2 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:03:17
+381 ps_191_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:05:18
+382 ps_191_2 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:03:18
+383 ps_192_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:05:19
+384 ps_192_2 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:03:19
+385 ps_193_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+386 ps_193_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+387 ps_194_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:06:03
+388 ps_194_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:03:03
+389 ps_195_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:06:04
+390 ps_195_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:03:04
+391 ps_196_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:06:05
+392 ps_196_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:03:05
+393 ps_197_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:06:06
+394 ps_197_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:03:06
+395 ps_198_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:06:07
+396 ps_198_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:03:07
+397 ps_199_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:06:08
+398 ps_199_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:03:08
+399 ps_200_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:06:09
+400 ps_200_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:03:09
+401 ps_201_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:06:0a
+402 ps_201_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:03:0a
+403 ps_202_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:06:0b
+404 ps_202_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:03:0b
+405 ps_203_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:06:0c
+406 ps_203_2 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:03:0c
+407 ps_204_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:06:0d
+408 ps_204_2 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:03:0d
+409 ps_205_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:06:0e
+410 ps_205_2 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:03:0e
+411 ps_206_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:06:0f
+412 ps_206_2 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:03:0f
+413 ps_207_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:06:10
+414 ps_207_2 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:03:10
+415 ps_208_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:06:11
+416 ps_208_2 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:03:11
+417 ps_209_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:06:12
+418 ps_209_2 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:03:12
+419 ps_210_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:06:13
+420 ps_210_2 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:03:13
+421 ps_211_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:06:14
+422 ps_211_2 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:03:14
+423 ps_212_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:06:15
+424 ps_212_2 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:03:15
+425 ps_213_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:06:16
+426 ps_213_2 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:03:16
+427 ps_214_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:06:17
+428 ps_214_2 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:03:17
+429 ps_215_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:06:18
+430 ps_215_2 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:03:18
+431 ps_216_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:06:19
+432 ps_216_2 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:03:19
+433 ps_217_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+434 ps_217_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+435 ps_218_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:07:03
+436 ps_218_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:03:03
+437 ps_219_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:07:04
+438 ps_219_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:03:04
+439 ps_220_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:07:05
+440 ps_220_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:03:05
+441 ps_221_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:07:06
+442 ps_221_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:03:06
+443 ps_222_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:07:07
+444 ps_222_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:03:07
+445 ps_223_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:07:08
+446 ps_223_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:03:08
+447 ps_224_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:07:09
+448 ps_224_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:03:09
+449 ps_225_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:07:0a
+450 ps_225_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:03:0a
+451 ps_226_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:07:0b
+452 ps_226_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:03:0b
+453 ps_227_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:07:0c
+454 ps_227_2 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:03:0c
+455 ps_228_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:07:0d
+456 ps_228_2 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:03:0d
+457 ps_229_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:07:0e
+458 ps_229_2 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:03:0e
+459 ps_230_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:07:0f
+460 ps_230_2 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:03:0f
+461 ps_231_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:07:10
+462 ps_231_2 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:03:10
+463 ps_232_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:07:11
+464 ps_232_2 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:03:11
+465 ps_233_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:07:12
+466 ps_233_2 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:03:12
+467 ps_234_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:07:13
+468 ps_234_2 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:03:13
+469 ps_235_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:07:14
+470 ps_235_2 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:03:14
+471 ps_236_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:07:15
+472 ps_236_2 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:03:15
+473 ps_237_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:07:16
+474 ps_237_2 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:03:16
+475 ps_238_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:07:17
+476 ps_238_2 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:03:17
+477 ps_239_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:07:18
+478 ps_239_2 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:03:18
+479 ps_240_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:07:19
+480 ps_240_2 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:03:19
+481 ps_241_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+482 ps_241_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+483 ps_242_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:08:03
+484 ps_242_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:03:03
+485 ps_243_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:08:04
+486 ps_243_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:03:04
+487 ps_244_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:08:05
+488 ps_244_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:03:05
+489 ps_245_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:08:06
+490 ps_245_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:03:06
+491 ps_246_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:08:07
+492 ps_246_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:03:07
+493 ps_247_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:08:08
+494 ps_247_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:03:08
+495 ps_248_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:08:09
+496 ps_248_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:03:09
+497 ps_249_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:08:0a
+498 ps_249_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:03:0a
+499 ps_250_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:08:0b
+500 ps_250_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:03:0b
+501 ps_251_1 00:00:00:00:00:00:03:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:03:0c matchDstMac 00:00:c0:a8:08:0c
+502 ps_251_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:03:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:03:0c
+503 ps_252_1 00:00:00:00:00:00:03:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:03:0d matchDstMac 00:00:c0:a8:08:0d
+504 ps_252_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:03:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:03:0d
+505 ps_253_1 00:00:00:00:00:00:03:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:03:0e matchDstMac 00:00:c0:a8:08:0e
+506 ps_253_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:03:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:03:0e
+507 ps_254_1 00:00:00:00:00:00:03:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:03:0f matchDstMac 00:00:c0:a8:08:0f
+508 ps_254_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:03:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:03:0f
+509 ps_255_1 00:00:00:00:00:00:03:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:03:10 matchDstMac 00:00:c0:a8:08:10
+510 ps_255_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:03:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:03:10
+511 ps_256_1 00:00:00:00:00:00:03:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:03:11 matchDstMac 00:00:c0:a8:08:11
+512 ps_256_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:03:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:03:11
+513 ps_257_1 00:00:00:00:00:00:03:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:03:12 matchDstMac 00:00:c0:a8:08:12
+514 ps_257_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:03:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:03:12
+515 ps_258_1 00:00:00:00:00:00:03:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:03:13 matchDstMac 00:00:c0:a8:08:13
+516 ps_258_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:03:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:03:13
+517 ps_259_1 00:00:00:00:00:00:03:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:03:14 matchDstMac 00:00:c0:a8:08:14
+518 ps_259_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:03:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:03:14
+519 ps_260_1 00:00:00:00:00:00:03:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:03:15 matchDstMac 00:00:c0:a8:08:15
+520 ps_260_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:03:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:03:15
+521 ps_261_1 00:00:00:00:00:00:03:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:03:16 matchDstMac 00:00:c0:a8:08:16
+522 ps_261_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:03:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:03:16
+523 ps_262_1 00:00:00:00:00:00:03:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:03:17 matchDstMac 00:00:c0:a8:08:17
+524 ps_262_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:03:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:03:17
+525 ps_263_1 00:00:00:00:00:00:03:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:03:18 matchDstMac 00:00:c0:a8:08:18
+526 ps_263_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:03:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:03:18
+527 ps_264_1 00:00:00:00:00:00:03:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:03:19 matchDstMac 00:00:c0:a8:08:19
+528 ps_264_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:03:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:03:19
+529 ps_265_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+530 ps_265_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+531 ps_266_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:05:03
+532 ps_266_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:04:03
+533 ps_267_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:05:04
+534 ps_267_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:04:04
+535 ps_268_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:05:05
+536 ps_268_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:04:05
+537 ps_269_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:05:06
+538 ps_269_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:04:06
+539 ps_270_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:05:07
+540 ps_270_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:04:07
+541 ps_271_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:05:08
+542 ps_271_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:04:08
+543 ps_272_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:05:09
+544 ps_272_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:04:09
+545 ps_273_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:05:0a
+546 ps_273_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:04:0a
+547 ps_274_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:05:0b
+548 ps_274_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:04:0b
+549 ps_275_1 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:05:0c
+550 ps_275_2 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:04:0c
+551 ps_276_1 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:05:0d
+552 ps_276_2 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:04:0d
+553 ps_277_1 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:05:0e
+554 ps_277_2 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:04:0e
+555 ps_278_1 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:05:0f
+556 ps_278_2 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:04:0f
+557 ps_279_1 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:05:10
+558 ps_279_2 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:04:10
+559 ps_280_1 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:05:11
+560 ps_280_2 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:04:11
+561 ps_281_1 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:05:12
+562 ps_281_2 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:04:12
+563 ps_282_1 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:05:13
+564 ps_282_2 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:04:13
+565 ps_283_1 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:05:14
+566 ps_283_2 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:04:14
+567 ps_284_1 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:05:15
+568 ps_284_2 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:04:15
+569 ps_285_1 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:05:16
+570 ps_285_2 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:04:16
+571 ps_286_1 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:05:17
+572 ps_286_2 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:04:17
+573 ps_287_1 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:05:18
+574 ps_287_2 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:04:18
+575 ps_288_1 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:05:19
+576 ps_288_2 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:04:19
+577 ps_289_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+578 ps_289_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+579 ps_290_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:06:03
+580 ps_290_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:04:03
+581 ps_291_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:06:04
+582 ps_291_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:04:04
+583 ps_292_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:06:05
+584 ps_292_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:04:05
+585 ps_293_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:06:06
+586 ps_293_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:04:06
+587 ps_294_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:06:07
+588 ps_294_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:04:07
+589 ps_295_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:06:08
+590 ps_295_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:04:08
+591 ps_296_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:06:09
+592 ps_296_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:04:09
+593 ps_297_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:06:0a
+594 ps_297_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:04:0a
+595 ps_298_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:06:0b
+596 ps_298_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:04:0b
+597 ps_299_1 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:06:0c
+598 ps_299_2 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:04:0c
+599 ps_300_1 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:06:0d
+600 ps_300_2 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:04:0d
+601 ps_301_1 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:06:0e
+602 ps_301_2 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:04:0e
+603 ps_302_1 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:06:0f
+604 ps_302_2 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:04:0f
+605 ps_303_1 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:06:10
+606 ps_303_2 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:04:10
+607 ps_304_1 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:06:11
+608 ps_304_2 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:04:11
+609 ps_305_1 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:06:12
+610 ps_305_2 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:04:12
+611 ps_306_1 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:06:13
+612 ps_306_2 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:04:13
+613 ps_307_1 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:06:14
+614 ps_307_2 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:04:14
+615 ps_308_1 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:06:15
+616 ps_308_2 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:04:15
+617 ps_309_1 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:06:16
+618 ps_309_2 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:04:16
+619 ps_310_1 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:06:17
+620 ps_310_2 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:04:17
+621 ps_311_1 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:06:18
+622 ps_311_2 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:04:18
+623 ps_312_1 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:06:19
+624 ps_312_2 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:04:19
+625 ps_313_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+626 ps_313_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+627 ps_314_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:07:03
+628 ps_314_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:04:03
+629 ps_315_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:07:04
+630 ps_315_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:04:04
+631 ps_316_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:07:05
+632 ps_316_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:04:05
+633 ps_317_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:07:06
+634 ps_317_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:04:06
+635 ps_318_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:07:07
+636 ps_318_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:04:07
+637 ps_319_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:07:08
+638 ps_319_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:04:08
+639 ps_320_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:07:09
+640 ps_320_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:04:09
+641 ps_321_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:07:0a
+642 ps_321_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:04:0a
+643 ps_322_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:07:0b
+644 ps_322_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:04:0b
+645 ps_323_1 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:07:0c
+646 ps_323_2 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:04:0c
+647 ps_324_1 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:07:0d
+648 ps_324_2 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:04:0d
+649 ps_325_1 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:07:0e
+650 ps_325_2 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:04:0e
+651 ps_326_1 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:07:0f
+652 ps_326_2 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:04:0f
+653 ps_327_1 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:07:10
+654 ps_327_2 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:04:10
+655 ps_328_1 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:07:11
+656 ps_328_2 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:04:11
+657 ps_329_1 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:07:12
+658 ps_329_2 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:04:12
+659 ps_330_1 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:07:13
+660 ps_330_2 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:04:13
+661 ps_331_1 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:07:14
+662 ps_331_2 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:04:14
+663 ps_332_1 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:07:15
+664 ps_332_2 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:04:15
+665 ps_333_1 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:07:16
+666 ps_333_2 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:04:16
+667 ps_334_1 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:07:17
+668 ps_334_2 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:04:17
+669 ps_335_1 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:07:18
+670 ps_335_2 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:04:18
+671 ps_336_1 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:07:19
+672 ps_336_2 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:04:19
+673 ps_337_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+674 ps_337_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+675 ps_338_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:08:03
+676 ps_338_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:04:03
+677 ps_339_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:08:04
+678 ps_339_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:04:04
+679 ps_340_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:08:05
+680 ps_340_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:04:05
+681 ps_341_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:08:06
+682 ps_341_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:04:06
+683 ps_342_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:08:07
+684 ps_342_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:04:07
+685 ps_343_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:08:08
+686 ps_343_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:04:08
+687 ps_344_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:08:09
+688 ps_344_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:04:09
+689 ps_345_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:08:0a
+690 ps_345_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:04:0a
+691 ps_346_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:08:0b
+692 ps_346_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:04:0b
+693 ps_347_1 00:00:00:00:00:00:04:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:04:0c matchDstMac 00:00:c0:a8:08:0c
+694 ps_347_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:04:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:04:0c
+695 ps_348_1 00:00:00:00:00:00:04:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:04:0d matchDstMac 00:00:c0:a8:08:0d
+696 ps_348_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:04:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:04:0d
+697 ps_349_1 00:00:00:00:00:00:04:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:04:0e matchDstMac 00:00:c0:a8:08:0e
+698 ps_349_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:04:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:04:0e
+699 ps_350_1 00:00:00:00:00:00:04:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:04:0f matchDstMac 00:00:c0:a8:08:0f
+700 ps_350_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:04:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:04:0f
+701 ps_351_1 00:00:00:00:00:00:04:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:04:10 matchDstMac 00:00:c0:a8:08:10
+702 ps_351_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:04:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:04:10
+703 ps_352_1 00:00:00:00:00:00:04:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:04:11 matchDstMac 00:00:c0:a8:08:11
+704 ps_352_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:04:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:04:11
+705 ps_353_1 00:00:00:00:00:00:04:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:04:12 matchDstMac 00:00:c0:a8:08:12
+706 ps_353_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:04:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:04:12
+707 ps_354_1 00:00:00:00:00:00:04:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:04:13 matchDstMac 00:00:c0:a8:08:13
+708 ps_354_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:04:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:04:13
+709 ps_355_1 00:00:00:00:00:00:04:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:04:14 matchDstMac 00:00:c0:a8:08:14
+710 ps_355_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:04:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:04:14
+711 ps_356_1 00:00:00:00:00:00:04:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:04:15 matchDstMac 00:00:c0:a8:08:15
+712 ps_356_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:04:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:04:15
+713 ps_357_1 00:00:00:00:00:00:04:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:04:16 matchDstMac 00:00:c0:a8:08:16
+714 ps_357_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:04:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:04:16
+715 ps_358_1 00:00:00:00:00:00:04:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:04:17 matchDstMac 00:00:c0:a8:08:17
+716 ps_358_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:04:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:04:17
+717 ps_359_1 00:00:00:00:00:00:04:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:04:18 matchDstMac 00:00:c0:a8:08:18
+718 ps_359_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:04:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:04:18
+719 ps_360_1 00:00:00:00:00:00:04:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:04:19 matchDstMac 00:00:c0:a8:08:19
+720 ps_360_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:04:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:04:19
+721 ps_361_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+722 ps_361_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+723 ps_362_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:06:03
+724 ps_362_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:05:03
+725 ps_363_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:06:04
+726 ps_363_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:05:04
+727 ps_364_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:06:05
+728 ps_364_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:05:05
+729 ps_365_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:06:06
+730 ps_365_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:05:06
+731 ps_366_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:06:07
+732 ps_366_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:05:07
+733 ps_367_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:06:08
+734 ps_367_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:05:08
+735 ps_368_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:06:09
+736 ps_368_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:05:09
+737 ps_369_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:06:0a
+738 ps_369_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:05:0a
+739 ps_370_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:06:0b
+740 ps_370_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:05:0b
+741 ps_371_1 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:06:0c
+742 ps_371_2 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:05:0c
+743 ps_372_1 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:06:0d
+744 ps_372_2 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:05:0d
+745 ps_373_1 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:06:0e
+746 ps_373_2 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:05:0e
+747 ps_374_1 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:06:0f
+748 ps_374_2 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:05:0f
+749 ps_375_1 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:06:10
+750 ps_375_2 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:05:10
+751 ps_376_1 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:06:11
+752 ps_376_2 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:05:11
+753 ps_377_1 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:06:12
+754 ps_377_2 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:05:12
+755 ps_378_1 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:06:13
+756 ps_378_2 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:05:13
+757 ps_379_1 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:06:14
+758 ps_379_2 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:05:14
+759 ps_380_1 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:06:15
+760 ps_380_2 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:05:15
+761 ps_381_1 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:06:16
+762 ps_381_2 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:05:16
+763 ps_382_1 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:06:17
+764 ps_382_2 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:05:17
+765 ps_383_1 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:06:18
+766 ps_383_2 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:05:18
+767 ps_384_1 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:06:19
+768 ps_384_2 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:05:19
+769 ps_385_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:07:02
+770 ps_385_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:05:02
+771 ps_386_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:07:03
+772 ps_386_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:05:03
+773 ps_387_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:07:04
+774 ps_387_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:05:04
+775 ps_388_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:07:05
+776 ps_388_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:05:05
+777 ps_389_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:07:06
+778 ps_389_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:05:06
+779 ps_390_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:07:07
+780 ps_390_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:05:07
+781 ps_391_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:07:08
+782 ps_391_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:05:08
+783 ps_392_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:07:09
+784 ps_392_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:05:09
+785 ps_393_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:07:0a
+786 ps_393_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:05:0a
+787 ps_394_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:07:0b
+788 ps_394_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:05:0b
+789 ps_395_1 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:07:0c
+790 ps_395_2 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:05:0c
+791 ps_396_1 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:07:0d
+792 ps_396_2 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:05:0d
+793 ps_397_1 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:07:0e
+794 ps_397_2 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:05:0e
+795 ps_398_1 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:07:0f
+796 ps_398_2 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:05:0f
+797 ps_399_1 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:07:10
+798 ps_399_2 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:05:10
+799 ps_400_1 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:07:11
+800 ps_400_2 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:05:11
+801 ps_401_1 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:07:12
+802 ps_401_2 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:05:12
+803 ps_402_1 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:07:13
+804 ps_402_2 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:05:13
+805 ps_403_1 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:07:14
+806 ps_403_2 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:05:14
+807 ps_404_1 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:07:15
+808 ps_404_2 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:05:15
+809 ps_405_1 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:07:16
+810 ps_405_2 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:05:16
+811 ps_406_1 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:07:17
+812 ps_406_2 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:05:17
+813 ps_407_1 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:07:18
+814 ps_407_2 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:05:18
+815 ps_408_1 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:07:19
+816 ps_408_2 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:05:19
+817 ps_409_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+818 ps_409_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+819 ps_410_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:08:03
+820 ps_410_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:05:03
+821 ps_411_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:08:04
+822 ps_411_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:05:04
+823 ps_412_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:08:05
+824 ps_412_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:05:05
+825 ps_413_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:08:06
+826 ps_413_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:05:06
+827 ps_414_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:08:07
+828 ps_414_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:05:07
+829 ps_415_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:08:08
+830 ps_415_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:05:08
+831 ps_416_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:08:09
+832 ps_416_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:05:09
+833 ps_417_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:08:0a
+834 ps_417_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:05:0a
+835 ps_418_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:08:0b
+836 ps_418_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:05:0b
+837 ps_419_1 00:00:00:00:00:00:05:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:05:0c matchDstMac 00:00:c0:a8:08:0c
+838 ps_419_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:05:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:05:0c
+839 ps_420_1 00:00:00:00:00:00:05:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:05:0d matchDstMac 00:00:c0:a8:08:0d
+840 ps_420_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:05:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:05:0d
+841 ps_421_1 00:00:00:00:00:00:05:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:05:0e matchDstMac 00:00:c0:a8:08:0e
+842 ps_421_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:05:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:05:0e
+843 ps_422_1 00:00:00:00:00:00:05:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:05:0f matchDstMac 00:00:c0:a8:08:0f
+844 ps_422_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:05:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:05:0f
+845 ps_423_1 00:00:00:00:00:00:05:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:05:10 matchDstMac 00:00:c0:a8:08:10
+846 ps_423_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:05:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:05:10
+847 ps_424_1 00:00:00:00:00:00:05:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:05:11 matchDstMac 00:00:c0:a8:08:11
+848 ps_424_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:05:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:05:11
+849 ps_425_1 00:00:00:00:00:00:05:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:05:12 matchDstMac 00:00:c0:a8:08:12
+850 ps_425_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:05:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:05:12
+851 ps_426_1 00:00:00:00:00:00:05:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:05:13 matchDstMac 00:00:c0:a8:08:13
+852 ps_426_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:05:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:05:13
+853 ps_427_1 00:00:00:00:00:00:05:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:05:14 matchDstMac 00:00:c0:a8:08:14
+854 ps_427_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:05:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:05:14
+855 ps_428_1 00:00:00:00:00:00:05:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:05:15 matchDstMac 00:00:c0:a8:08:15
+856 ps_428_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:05:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:05:15
+857 ps_429_1 00:00:00:00:00:00:05:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:05:16 matchDstMac 00:00:c0:a8:08:16
+858 ps_429_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:05:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:05:16
+859 ps_430_1 00:00:00:00:00:00:05:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:05:17 matchDstMac 00:00:c0:a8:08:17
+860 ps_430_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:05:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:05:17
+861 ps_431_1 00:00:00:00:00:00:05:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:05:18 matchDstMac 00:00:c0:a8:08:18
+862 ps_431_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:05:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:05:18
+863 ps_432_1 00:00:00:00:00:00:05:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:05:19 matchDstMac 00:00:c0:a8:08:19
+864 ps_432_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:05:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:05:19
+865 ps_433_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+866 ps_433_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+867 ps_434_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:07:03
+868 ps_434_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:06:03
+869 ps_435_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:07:04
+870 ps_435_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:06:04
+871 ps_436_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:07:05
+872 ps_436_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:06:05
+873 ps_437_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:07:06
+874 ps_437_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:06:06
+875 ps_438_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:07:07
+876 ps_438_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:06:07
+877 ps_439_1 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:07:08
+878 ps_439_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:06:08
+879 ps_440_1 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:07:09
+880 ps_440_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:06:09
+881 ps_441_1 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:07:0a
+882 ps_441_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:06:0a
+883 ps_442_1 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:07:0b
+884 ps_442_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:06:0b
+885 ps_443_1 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:07:0c
+886 ps_443_2 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:06:0c
+887 ps_444_1 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:07:0d
+888 ps_444_2 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:06:0d
+889 ps_445_1 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:07:0e
+890 ps_445_2 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:06:0e
+891 ps_446_1 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:07:0f
+892 ps_446_2 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:06:0f
+893 ps_447_1 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:07:10
+894 ps_447_2 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:06:10
+895 ps_448_1 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:07:11
+896 ps_448_2 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:06:11
+897 ps_449_1 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:07:12
+898 ps_449_2 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:06:12
+899 ps_450_1 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:07:13
+900 ps_450_2 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:06:13
+901 ps_451_1 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:07:14
+902 ps_451_2 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:06:14
+903 ps_452_1 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:07:15
+904 ps_452_2 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:06:15
+905 ps_453_1 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:07:16
+906 ps_453_2 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:06:16
+907 ps_454_1 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:07:17
+908 ps_454_2 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:06:17
+909 ps_455_1 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:07:18
+910 ps_455_2 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:06:18
+911 ps_456_1 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:07:19
+912 ps_456_2 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:06:19
+913 ps_457_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+914 ps_457_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+915 ps_458_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:08:03
+916 ps_458_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:06:03
+917 ps_459_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:08:04
+918 ps_459_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:06:04
+919 ps_460_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:08:05
+920 ps_460_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:06:05
+921 ps_461_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:08:06
+922 ps_461_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:06:06
+923 ps_462_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:08:07
+924 ps_462_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:06:07
+925 ps_463_1 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:08:08
+926 ps_463_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:06:08
+927 ps_464_1 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:08:09
+928 ps_464_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:06:09
+929 ps_465_1 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:08:0a
+930 ps_465_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:06:0a
+931 ps_466_1 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:08:0b
+932 ps_466_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:06:0b
+933 ps_467_1 00:00:00:00:00:00:06:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:06:0c matchDstMac 00:00:c0:a8:08:0c
+934 ps_467_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:06:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:06:0c
+935 ps_468_1 00:00:00:00:00:00:06:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:06:0d matchDstMac 00:00:c0:a8:08:0d
+936 ps_468_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:06:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:06:0d
+937 ps_469_1 00:00:00:00:00:00:06:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:06:0e matchDstMac 00:00:c0:a8:08:0e
+938 ps_469_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:06:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:06:0e
+939 ps_470_1 00:00:00:00:00:00:06:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:06:0f matchDstMac 00:00:c0:a8:08:0f
+940 ps_470_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:06:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:06:0f
+941 ps_471_1 00:00:00:00:00:00:06:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:06:10 matchDstMac 00:00:c0:a8:08:10
+942 ps_471_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:06:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:06:10
+943 ps_472_1 00:00:00:00:00:00:06:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:06:11 matchDstMac 00:00:c0:a8:08:11
+944 ps_472_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:06:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:06:11
+945 ps_473_1 00:00:00:00:00:00:06:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:06:12 matchDstMac 00:00:c0:a8:08:12
+946 ps_473_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:06:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:06:12
+947 ps_474_1 00:00:00:00:00:00:06:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:06:13 matchDstMac 00:00:c0:a8:08:13
+948 ps_474_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:06:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:06:13
+949 ps_475_1 00:00:00:00:00:00:06:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:06:14 matchDstMac 00:00:c0:a8:08:14
+950 ps_475_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:06:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:06:14
+951 ps_476_1 00:00:00:00:00:00:06:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:06:15 matchDstMac 00:00:c0:a8:08:15
+952 ps_476_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:06:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:06:15
+953 ps_477_1 00:00:00:00:00:00:06:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:06:16 matchDstMac 00:00:c0:a8:08:16
+954 ps_477_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:06:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:06:16
+955 ps_478_1 00:00:00:00:00:00:06:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:06:17 matchDstMac 00:00:c0:a8:08:17
+956 ps_478_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:06:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:06:17
+957 ps_479_1 00:00:00:00:00:00:06:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:06:18 matchDstMac 00:00:c0:a8:08:18
+958 ps_479_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:06:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:06:18
+959 ps_480_1 00:00:00:00:00:00:06:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:06:19 matchDstMac 00:00:c0:a8:08:19
+960 ps_480_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:06:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:06:19
+961 ps_481_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+962 ps_481_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
+963 ps_482_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:08:03
+964 ps_482_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:07:03
+965 ps_483_1 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:08:04
+966 ps_483_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:07:04
+967 ps_484_1 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:08:05
+968 ps_484_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:07:05
+969 ps_485_1 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:08:06
+970 ps_485_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:07:06
+971 ps_486_1 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:08:07
+972 ps_486_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:07:07
+973 ps_487_1 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:08:08
+974 ps_487_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:07:08
+975 ps_488_1 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:08:09
+976 ps_488_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:07:09
+977 ps_489_1 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:08:0a
+978 ps_489_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:07:0a
+979 ps_490_1 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:08:0b
+980 ps_490_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:07:0b
+981 ps_491_1 00:00:00:00:00:00:07:0c 1 00:00:00:00:00:00:08:0c 1 matchSrcMac 00:00:c0:a8:07:0c matchDstMac 00:00:c0:a8:08:0c
+982 ps_491_2 00:00:00:00:00:00:08:0c 1 00:00:00:00:00:00:07:0c 1 matchSrcMac 00:00:c0:a8:08:0c matchDstMac 00:00:c0:a8:07:0c
+983 ps_492_1 00:00:00:00:00:00:07:0d 1 00:00:00:00:00:00:08:0d 1 matchSrcMac 00:00:c0:a8:07:0d matchDstMac 00:00:c0:a8:08:0d
+984 ps_492_2 00:00:00:00:00:00:08:0d 1 00:00:00:00:00:00:07:0d 1 matchSrcMac 00:00:c0:a8:08:0d matchDstMac 00:00:c0:a8:07:0d
+985 ps_493_1 00:00:00:00:00:00:07:0e 1 00:00:00:00:00:00:08:0e 1 matchSrcMac 00:00:c0:a8:07:0e matchDstMac 00:00:c0:a8:08:0e
+986 ps_493_2 00:00:00:00:00:00:08:0e 1 00:00:00:00:00:00:07:0e 1 matchSrcMac 00:00:c0:a8:08:0e matchDstMac 00:00:c0:a8:07:0e
+987 ps_494_1 00:00:00:00:00:00:07:0f 1 00:00:00:00:00:00:08:0f 1 matchSrcMac 00:00:c0:a8:07:0f matchDstMac 00:00:c0:a8:08:0f
+988 ps_494_2 00:00:00:00:00:00:08:0f 1 00:00:00:00:00:00:07:0f 1 matchSrcMac 00:00:c0:a8:08:0f matchDstMac 00:00:c0:a8:07:0f
+989 ps_495_1 00:00:00:00:00:00:07:10 1 00:00:00:00:00:00:08:10 1 matchSrcMac 00:00:c0:a8:07:10 matchDstMac 00:00:c0:a8:08:10
+990 ps_495_2 00:00:00:00:00:00:08:10 1 00:00:00:00:00:00:07:10 1 matchSrcMac 00:00:c0:a8:08:10 matchDstMac 00:00:c0:a8:07:10
+991 ps_496_1 00:00:00:00:00:00:07:11 1 00:00:00:00:00:00:08:11 1 matchSrcMac 00:00:c0:a8:07:11 matchDstMac 00:00:c0:a8:08:11
+992 ps_496_2 00:00:00:00:00:00:08:11 1 00:00:00:00:00:00:07:11 1 matchSrcMac 00:00:c0:a8:08:11 matchDstMac 00:00:c0:a8:07:11
+993 ps_497_1 00:00:00:00:00:00:07:12 1 00:00:00:00:00:00:08:12 1 matchSrcMac 00:00:c0:a8:07:12 matchDstMac 00:00:c0:a8:08:12
+994 ps_497_2 00:00:00:00:00:00:08:12 1 00:00:00:00:00:00:07:12 1 matchSrcMac 00:00:c0:a8:08:12 matchDstMac 00:00:c0:a8:07:12
+995 ps_498_1 00:00:00:00:00:00:07:13 1 00:00:00:00:00:00:08:13 1 matchSrcMac 00:00:c0:a8:07:13 matchDstMac 00:00:c0:a8:08:13
+996 ps_498_2 00:00:00:00:00:00:08:13 1 00:00:00:00:00:00:07:13 1 matchSrcMac 00:00:c0:a8:08:13 matchDstMac 00:00:c0:a8:07:13
+997 ps_499_1 00:00:00:00:00:00:07:14 1 00:00:00:00:00:00:08:14 1 matchSrcMac 00:00:c0:a8:07:14 matchDstMac 00:00:c0:a8:08:14
+998 ps_499_2 00:00:00:00:00:00:08:14 1 00:00:00:00:00:00:07:14 1 matchSrcMac 00:00:c0:a8:08:14 matchDstMac 00:00:c0:a8:07:14
+999 ps_500_1 00:00:00:00:00:00:07:15 1 00:00:00:00:00:00:08:15 1 matchSrcMac 00:00:c0:a8:07:15 matchDstMac 00:00:c0:a8:08:15
+1000 ps_500_2 00:00:00:00:00:00:08:15 1 00:00:00:00:00:00:07:15 1 matchSrcMac 00:00:c0:a8:08:15 matchDstMac 00:00:c0:a8:07:15
+1001 ps_501_1 00:00:00:00:00:00:07:16 1 00:00:00:00:00:00:08:16 1 matchSrcMac 00:00:c0:a8:07:16 matchDstMac 00:00:c0:a8:08:16
+1002 ps_501_2 00:00:00:00:00:00:08:16 1 00:00:00:00:00:00:07:16 1 matchSrcMac 00:00:c0:a8:08:16 matchDstMac 00:00:c0:a8:07:16
+1003 ps_502_1 00:00:00:00:00:00:07:17 1 00:00:00:00:00:00:08:17 1 matchSrcMac 00:00:c0:a8:07:17 matchDstMac 00:00:c0:a8:08:17
+1004 ps_502_2 00:00:00:00:00:00:08:17 1 00:00:00:00:00:00:07:17 1 matchSrcMac 00:00:c0:a8:08:17 matchDstMac 00:00:c0:a8:07:17
+1005 ps_503_1 00:00:00:00:00:00:07:18 1 00:00:00:00:00:00:08:18 1 matchSrcMac 00:00:c0:a8:07:18 matchDstMac 00:00:c0:a8:08:18
+1006 ps_503_2 00:00:00:00:00:00:08:18 1 00:00:00:00:00:00:07:18 1 matchSrcMac 00:00:c0:a8:08:18 matchDstMac 00:00:c0:a8:07:18
+1007 ps_504_1 00:00:00:00:00:00:07:19 1 00:00:00:00:00:00:08:19 1 matchSrcMac 00:00:c0:a8:07:19 matchDstMac 00:00:c0:a8:08:19
+1008 ps_504_2 00:00:00:00:00:00:08:19 1 00:00:00:00:00:00:07:19 1 matchSrcMac 00:00:c0:a8:08:19 matchDstMac 00:00:c0:a8:07:19
diff --git a/web/flowdef_8node_126.txt b/web/flowdef_8node_126.txt
new file mode 100644
index 0000000..e351706
--- /dev/null
+++ b/web/flowdef_8node_126.txt
@@ -0,0 +1,127 @@
+# For 8 nodes cluster, 3 flows per network pair, total 126 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+8 ps_4_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+9 ps_5_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+10 ps_5_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+11 ps_6_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+12 ps_6_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+13 ps_7_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+14 ps_7_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+15 ps_8_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:05:03
+16 ps_8_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:02:03
+17 ps_9_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:05:04
+18 ps_9_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:02:04
+19 ps_10_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+20 ps_10_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+21 ps_11_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:06:03
+22 ps_11_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:02:03
+23 ps_12_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:06:04
+24 ps_12_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:02:04
+25 ps_13_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+26 ps_13_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+27 ps_14_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:07:03
+28 ps_14_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:02:03
+29 ps_15_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:07:04
+30 ps_15_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:02:04
+31 ps_16_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+32 ps_16_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+33 ps_17_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:08:03
+34 ps_17_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:02:03
+35 ps_18_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:08:04
+36 ps_18_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:02:04
+37 ps_19_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+38 ps_19_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+39 ps_20_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+40 ps_20_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+41 ps_21_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+42 ps_21_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+43 ps_22_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+44 ps_22_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+45 ps_23_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:05:03
+46 ps_23_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:03:03
+47 ps_24_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:05:04
+48 ps_24_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:03:04
+49 ps_25_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+50 ps_25_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+51 ps_26_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:06:03
+52 ps_26_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:03:03
+53 ps_27_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:06:04
+54 ps_27_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:03:04
+55 ps_28_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+56 ps_28_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+57 ps_29_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:07:03
+58 ps_29_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:03:03
+59 ps_30_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:07:04
+60 ps_30_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:03:04
+61 ps_31_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+62 ps_31_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+63 ps_32_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:08:03
+64 ps_32_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:03:03
+65 ps_33_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:08:04
+66 ps_33_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:03:04
+67 ps_34_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+68 ps_34_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+69 ps_35_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:05:03
+70 ps_35_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:04:03
+71 ps_36_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:05:04
+72 ps_36_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:04:04
+73 ps_37_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+74 ps_37_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+75 ps_38_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:06:03
+76 ps_38_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:04:03
+77 ps_39_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:06:04
+78 ps_39_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:04:04
+79 ps_40_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+80 ps_40_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+81 ps_41_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:07:03
+82 ps_41_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:04:03
+83 ps_42_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:07:04
+84 ps_42_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:04:04
+85 ps_43_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+86 ps_43_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+87 ps_44_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:08:03
+88 ps_44_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:04:03
+89 ps_45_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:08:04
+90 ps_45_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:04:04
+91 ps_46_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+92 ps_46_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+93 ps_47_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:06:03
+94 ps_47_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:05:03
+95 ps_48_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:06:04
+96 ps_48_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:05:04
+97 ps_49_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:07:02
+98 ps_49_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:05:02
+99 ps_50_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:07:03
+100 ps_50_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:05:03
+101 ps_51_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:07:04
+102 ps_51_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:05:04
+103 ps_52_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+104 ps_52_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+105 ps_53_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:08:03
+106 ps_53_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:05:03
+107 ps_54_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:08:04
+108 ps_54_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:05:04
+109 ps_55_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+110 ps_55_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+111 ps_56_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:07:03
+112 ps_56_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:06:03
+113 ps_57_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:07:04
+114 ps_57_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:06:04
+115 ps_58_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+116 ps_58_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+117 ps_59_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:08:03
+118 ps_59_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:06:03
+119 ps_60_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:08:04
+120 ps_60_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:06:04
+121 ps_61_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+122 ps_61_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
+123 ps_62_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:08:03
+124 ps_62_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:07:03
+125 ps_63_1 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:08:04
+126 ps_63_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:07:04
diff --git a/web/flowdef_8node_252.txt b/web/flowdef_8node_252.txt
new file mode 100644
index 0000000..500691c
--- /dev/null
+++ b/web/flowdef_8node_252.txt
@@ -0,0 +1,253 @@
+# For 8 nodes cluster, 6 flows per network pair, total 252 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+14 ps_7_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+15 ps_8_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+16 ps_8_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+17 ps_9_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+18 ps_9_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+19 ps_10_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+20 ps_10_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+21 ps_11_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+22 ps_11_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+23 ps_12_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+24 ps_12_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+25 ps_13_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+26 ps_13_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+27 ps_14_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:05:03
+28 ps_14_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:02:03
+29 ps_15_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:05:04
+30 ps_15_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:02:04
+31 ps_16_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:05:05
+32 ps_16_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:02:05
+33 ps_17_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:05:06
+34 ps_17_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:02:06
+35 ps_18_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:05:07
+36 ps_18_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:02:07
+37 ps_19_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+38 ps_19_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+39 ps_20_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:06:03
+40 ps_20_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:02:03
+41 ps_21_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:06:04
+42 ps_21_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:02:04
+43 ps_22_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:06:05
+44 ps_22_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:02:05
+45 ps_23_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:06:06
+46 ps_23_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:02:06
+47 ps_24_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:06:07
+48 ps_24_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:02:07
+49 ps_25_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+50 ps_25_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+51 ps_26_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:07:03
+52 ps_26_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:02:03
+53 ps_27_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:07:04
+54 ps_27_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:02:04
+55 ps_28_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:07:05
+56 ps_28_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:02:05
+57 ps_29_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:07:06
+58 ps_29_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:02:06
+59 ps_30_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:07:07
+60 ps_30_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:02:07
+61 ps_31_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+62 ps_31_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+63 ps_32_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:08:03
+64 ps_32_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:02:03
+65 ps_33_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:08:04
+66 ps_33_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:02:04
+67 ps_34_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:08:05
+68 ps_34_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:02:05
+69 ps_35_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:08:06
+70 ps_35_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:02:06
+71 ps_36_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:08:07
+72 ps_36_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:02:07
+73 ps_37_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+74 ps_37_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+75 ps_38_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+76 ps_38_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+77 ps_39_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+78 ps_39_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+79 ps_40_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+80 ps_40_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+81 ps_41_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+82 ps_41_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+83 ps_42_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+84 ps_42_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+85 ps_43_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+86 ps_43_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+87 ps_44_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:05:03
+88 ps_44_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:03:03
+89 ps_45_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:05:04
+90 ps_45_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:03:04
+91 ps_46_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:05:05
+92 ps_46_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:03:05
+93 ps_47_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:05:06
+94 ps_47_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:03:06
+95 ps_48_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:05:07
+96 ps_48_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:03:07
+97 ps_49_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+98 ps_49_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+99 ps_50_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:06:03
+100 ps_50_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:03:03
+101 ps_51_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:06:04
+102 ps_51_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:03:04
+103 ps_52_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:06:05
+104 ps_52_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:03:05
+105 ps_53_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:06:06
+106 ps_53_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:03:06
+107 ps_54_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:06:07
+108 ps_54_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:03:07
+109 ps_55_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+110 ps_55_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+111 ps_56_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:07:03
+112 ps_56_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:03:03
+113 ps_57_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:07:04
+114 ps_57_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:03:04
+115 ps_58_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:07:05
+116 ps_58_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:03:05
+117 ps_59_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:07:06
+118 ps_59_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:03:06
+119 ps_60_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:07:07
+120 ps_60_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:03:07
+121 ps_61_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+122 ps_61_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+123 ps_62_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:08:03
+124 ps_62_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:03:03
+125 ps_63_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:08:04
+126 ps_63_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:03:04
+127 ps_64_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:08:05
+128 ps_64_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:03:05
+129 ps_65_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:08:06
+130 ps_65_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:03:06
+131 ps_66_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:08:07
+132 ps_66_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:03:07
+133 ps_67_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+134 ps_67_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+135 ps_68_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:05:03
+136 ps_68_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:04:03
+137 ps_69_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:05:04
+138 ps_69_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:04:04
+139 ps_70_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:05:05
+140 ps_70_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:04:05
+141 ps_71_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:05:06
+142 ps_71_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:04:06
+143 ps_72_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:05:07
+144 ps_72_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:04:07
+145 ps_73_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+146 ps_73_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+147 ps_74_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:06:03
+148 ps_74_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:04:03
+149 ps_75_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:06:04
+150 ps_75_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:04:04
+151 ps_76_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:06:05
+152 ps_76_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:04:05
+153 ps_77_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:06:06
+154 ps_77_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:04:06
+155 ps_78_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:06:07
+156 ps_78_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:04:07
+157 ps_79_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+158 ps_79_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+159 ps_80_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:07:03
+160 ps_80_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:04:03
+161 ps_81_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:07:04
+162 ps_81_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:04:04
+163 ps_82_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:07:05
+164 ps_82_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:04:05
+165 ps_83_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:07:06
+166 ps_83_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:04:06
+167 ps_84_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:07:07
+168 ps_84_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:04:07
+169 ps_85_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+170 ps_85_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+171 ps_86_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:08:03
+172 ps_86_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:04:03
+173 ps_87_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:08:04
+174 ps_87_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:04:04
+175 ps_88_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:08:05
+176 ps_88_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:04:05
+177 ps_89_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:08:06
+178 ps_89_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:04:06
+179 ps_90_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:08:07
+180 ps_90_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:04:07
+181 ps_91_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+182 ps_91_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+183 ps_92_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:06:03
+184 ps_92_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:05:03
+185 ps_93_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:06:04
+186 ps_93_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:05:04
+187 ps_94_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:06:05
+188 ps_94_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:05:05
+189 ps_95_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:06:06
+190 ps_95_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:05:06
+191 ps_96_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:06:07
+192 ps_96_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:05:07
+193 ps_97_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:07:02
+194 ps_97_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:05:02
+195 ps_98_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:07:03
+196 ps_98_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:05:03
+197 ps_99_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:07:04
+198 ps_99_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:05:04
+199 ps_100_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:07:05
+200 ps_100_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:05:05
+201 ps_101_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:07:06
+202 ps_101_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:05:06
+203 ps_102_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:07:07
+204 ps_102_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:05:07
+205 ps_103_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+206 ps_103_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+207 ps_104_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:08:03
+208 ps_104_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:05:03
+209 ps_105_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:08:04
+210 ps_105_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:05:04
+211 ps_106_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:08:05
+212 ps_106_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:05:05
+213 ps_107_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:08:06
+214 ps_107_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:05:06
+215 ps_108_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:08:07
+216 ps_108_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:05:07
+217 ps_109_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+218 ps_109_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+219 ps_110_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:07:03
+220 ps_110_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:06:03
+221 ps_111_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:07:04
+222 ps_111_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:06:04
+223 ps_112_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:07:05
+224 ps_112_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:06:05
+225 ps_113_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:07:06
+226 ps_113_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:06:06
+227 ps_114_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:07:07
+228 ps_114_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:06:07
+229 ps_115_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+230 ps_115_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+231 ps_116_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:08:03
+232 ps_116_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:06:03
+233 ps_117_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:08:04
+234 ps_117_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:06:04
+235 ps_118_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:08:05
+236 ps_118_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:06:05
+237 ps_119_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:08:06
+238 ps_119_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:06:06
+239 ps_120_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:08:07
+240 ps_120_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:06:07
+241 ps_121_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+242 ps_121_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
+243 ps_122_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:08:03
+244 ps_122_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:07:03
+245 ps_123_1 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:08:04
+246 ps_123_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:07:04
+247 ps_124_1 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:08:05
+248 ps_124_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:07:05
+249 ps_125_1 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:08:06
+250 ps_125_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:07:06
+251 ps_126_1 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:08:07
+252 ps_126_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:07:07
diff --git a/web/flowdef_8node_42.txt b/web/flowdef_8node_42.txt
new file mode 100644
index 0000000..05750de
--- /dev/null
+++ b/web/flowdef_8node_42.txt
@@ -0,0 +1,43 @@
+# For 8 nodes cluster, 1 flows per network pair, total 42 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+4 ps_2_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+5 ps_3_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+6 ps_3_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+7 ps_4_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+8 ps_4_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+9 ps_5_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+10 ps_5_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+11 ps_6_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+12 ps_6_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+13 ps_7_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+14 ps_7_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+15 ps_8_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+16 ps_8_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+17 ps_9_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+18 ps_9_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+19 ps_10_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+20 ps_10_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+21 ps_11_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+22 ps_11_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+23 ps_12_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+24 ps_12_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+25 ps_13_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+26 ps_13_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+27 ps_14_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+28 ps_14_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+29 ps_15_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+30 ps_15_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+31 ps_16_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+32 ps_16_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+33 ps_17_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:07:02
+34 ps_17_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:05:02
+35 ps_18_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+36 ps_18_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+37 ps_19_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+38 ps_19_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+39 ps_20_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+40 ps_20_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+41 ps_21_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+42 ps_21_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
diff --git a/web/flowdef_8node_420.txt b/web/flowdef_8node_420.txt
new file mode 100644
index 0000000..1f4288d
--- /dev/null
+++ b/web/flowdef_8node_420.txt
@@ -0,0 +1,421 @@
+# For 8 nodes cluster, 10 flows per network pair, total 420 flows
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:03:08
+14 ps_7_2 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:02:08
+15 ps_8_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:03:09
+16 ps_8_2 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:02:09
+17 ps_9_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:03:0a
+18 ps_9_2 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:02:0a
+19 ps_10_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:03:0b
+20 ps_10_2 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:02:0b
+21 ps_11_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+22 ps_11_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+23 ps_12_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+24 ps_12_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+25 ps_13_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+26 ps_13_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+27 ps_14_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+28 ps_14_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+29 ps_15_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+30 ps_15_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+31 ps_16_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+32 ps_16_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+33 ps_17_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:04:08
+34 ps_17_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:02:08
+35 ps_18_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:04:09
+36 ps_18_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:02:09
+37 ps_19_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:04:0a
+38 ps_19_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:02:0a
+39 ps_20_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:04:0b
+40 ps_20_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:02:0b
+41 ps_21_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+42 ps_21_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+43 ps_22_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:05:03
+44 ps_22_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:02:03
+45 ps_23_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:05:04
+46 ps_23_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:02:04
+47 ps_24_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:05:05
+48 ps_24_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:02:05
+49 ps_25_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:05:06
+50 ps_25_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:02:06
+51 ps_26_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:05:07
+52 ps_26_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:02:07
+53 ps_27_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:05:08
+54 ps_27_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:02:08
+55 ps_28_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:05:09
+56 ps_28_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:02:09
+57 ps_29_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:05:0a
+58 ps_29_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:02:0a
+59 ps_30_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:05:0b
+60 ps_30_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:02:0b
+61 ps_31_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+62 ps_31_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+63 ps_32_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:06:03
+64 ps_32_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:02:03
+65 ps_33_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:06:04
+66 ps_33_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:02:04
+67 ps_34_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:06:05
+68 ps_34_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:02:05
+69 ps_35_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:06:06
+70 ps_35_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:02:06
+71 ps_36_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:06:07
+72 ps_36_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:02:07
+73 ps_37_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:06:08
+74 ps_37_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:02:08
+75 ps_38_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:06:09
+76 ps_38_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:02:09
+77 ps_39_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:06:0a
+78 ps_39_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:02:0a
+79 ps_40_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:06:0b
+80 ps_40_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:02:0b
+81 ps_41_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+82 ps_41_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+83 ps_42_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:07:03
+84 ps_42_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:02:03
+85 ps_43_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:07:04
+86 ps_43_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:02:04
+87 ps_44_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:07:05
+88 ps_44_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:02:05
+89 ps_45_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:07:06
+90 ps_45_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:02:06
+91 ps_46_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:07:07
+92 ps_46_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:02:07
+93 ps_47_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:07:08
+94 ps_47_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:02:08
+95 ps_48_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:07:09
+96 ps_48_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:02:09
+97 ps_49_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:07:0a
+98 ps_49_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:02:0a
+99 ps_50_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:07:0b
+100 ps_50_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:02:0b
+101 ps_51_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+102 ps_51_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+103 ps_52_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:08:03
+104 ps_52_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:02:03
+105 ps_53_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:08:04
+106 ps_53_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:02:04
+107 ps_54_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:08:05
+108 ps_54_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:02:05
+109 ps_55_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:08:06
+110 ps_55_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:02:06
+111 ps_56_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:08:07
+112 ps_56_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:02:07
+113 ps_57_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:08:08
+114 ps_57_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:02:08
+115 ps_58_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:08:09
+116 ps_58_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:02:09
+117 ps_59_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:08:0a
+118 ps_59_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:02:0a
+119 ps_60_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:08:0b
+120 ps_60_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:02:0b
+121 ps_61_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+122 ps_61_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+123 ps_62_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+124 ps_62_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+125 ps_63_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+126 ps_63_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+127 ps_64_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+128 ps_64_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+129 ps_65_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+130 ps_65_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+131 ps_66_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+132 ps_66_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+133 ps_67_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:04:08
+134 ps_67_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:03:08
+135 ps_68_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:04:09
+136 ps_68_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:03:09
+137 ps_69_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:04:0a
+138 ps_69_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:03:0a
+139 ps_70_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:04:0b
+140 ps_70_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:03:0b
+141 ps_71_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+142 ps_71_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+143 ps_72_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:05:03
+144 ps_72_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:03:03
+145 ps_73_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:05:04
+146 ps_73_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:03:04
+147 ps_74_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:05:05
+148 ps_74_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:03:05
+149 ps_75_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:05:06
+150 ps_75_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:03:06
+151 ps_76_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:05:07
+152 ps_76_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:03:07
+153 ps_77_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:05:08
+154 ps_77_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:03:08
+155 ps_78_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:05:09
+156 ps_78_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:03:09
+157 ps_79_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:05:0a
+158 ps_79_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:03:0a
+159 ps_80_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:05:0b
+160 ps_80_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:03:0b
+161 ps_81_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+162 ps_81_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+163 ps_82_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:06:03
+164 ps_82_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:03:03
+165 ps_83_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:06:04
+166 ps_83_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:03:04
+167 ps_84_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:06:05
+168 ps_84_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:03:05
+169 ps_85_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:06:06
+170 ps_85_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:03:06
+171 ps_86_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:06:07
+172 ps_86_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:03:07
+173 ps_87_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:06:08
+174 ps_87_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:03:08
+175 ps_88_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:06:09
+176 ps_88_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:03:09
+177 ps_89_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:06:0a
+178 ps_89_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:03:0a
+179 ps_90_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:06:0b
+180 ps_90_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:03:0b
+181 ps_91_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+182 ps_91_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+183 ps_92_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:07:03
+184 ps_92_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:03:03
+185 ps_93_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:07:04
+186 ps_93_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:03:04
+187 ps_94_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:07:05
+188 ps_94_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:03:05
+189 ps_95_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:07:06
+190 ps_95_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:03:06
+191 ps_96_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:07:07
+192 ps_96_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:03:07
+193 ps_97_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:07:08
+194 ps_97_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:03:08
+195 ps_98_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:07:09
+196 ps_98_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:03:09
+197 ps_99_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:07:0a
+198 ps_99_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:03:0a
+199 ps_100_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:07:0b
+200 ps_100_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:03:0b
+201 ps_101_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+202 ps_101_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+203 ps_102_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:08:03
+204 ps_102_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:03:03
+205 ps_103_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:08:04
+206 ps_103_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:03:04
+207 ps_104_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:08:05
+208 ps_104_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:03:05
+209 ps_105_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:08:06
+210 ps_105_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:03:06
+211 ps_106_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:08:07
+212 ps_106_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:03:07
+213 ps_107_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:08:08
+214 ps_107_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:03:08
+215 ps_108_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:08:09
+216 ps_108_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:03:09
+217 ps_109_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:08:0a
+218 ps_109_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:03:0a
+219 ps_110_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:08:0b
+220 ps_110_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:03:0b
+221 ps_111_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+222 ps_111_2 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+223 ps_112_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:05:03
+224 ps_112_2 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:04:03
+225 ps_113_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:05:04
+226 ps_113_2 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:04:04
+227 ps_114_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:05:05
+228 ps_114_2 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:04:05
+229 ps_115_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:05:06
+230 ps_115_2 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:04:06
+231 ps_116_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:05:07
+232 ps_116_2 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:04:07
+233 ps_117_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:05:08
+234 ps_117_2 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:04:08
+235 ps_118_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:05:09
+236 ps_118_2 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:04:09
+237 ps_119_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:05:0a
+238 ps_119_2 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:04:0a
+239 ps_120_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:05:0b
+240 ps_120_2 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:04:0b
+241 ps_121_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+242 ps_121_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+243 ps_122_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:06:03
+244 ps_122_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:04:03
+245 ps_123_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:06:04
+246 ps_123_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:04:04
+247 ps_124_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:06:05
+248 ps_124_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:04:05
+249 ps_125_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:06:06
+250 ps_125_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:04:06
+251 ps_126_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:06:07
+252 ps_126_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:04:07
+253 ps_127_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:06:08
+254 ps_127_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:04:08
+255 ps_128_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:06:09
+256 ps_128_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:04:09
+257 ps_129_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:06:0a
+258 ps_129_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:04:0a
+259 ps_130_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:06:0b
+260 ps_130_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:04:0b
+261 ps_131_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+262 ps_131_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+263 ps_132_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:07:03
+264 ps_132_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:04:03
+265 ps_133_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:07:04
+266 ps_133_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:04:04
+267 ps_134_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:07:05
+268 ps_134_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:04:05
+269 ps_135_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:07:06
+270 ps_135_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:04:06
+271 ps_136_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:07:07
+272 ps_136_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:04:07
+273 ps_137_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:07:08
+274 ps_137_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:04:08
+275 ps_138_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:07:09
+276 ps_138_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:04:09
+277 ps_139_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:07:0a
+278 ps_139_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:04:0a
+279 ps_140_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:07:0b
+280 ps_140_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:04:0b
+281 ps_141_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+282 ps_141_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+283 ps_142_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:08:03
+284 ps_142_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:04:03
+285 ps_143_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:08:04
+286 ps_143_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:04:04
+287 ps_144_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:08:05
+288 ps_144_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:04:05
+289 ps_145_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:08:06
+290 ps_145_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:04:06
+291 ps_146_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:08:07
+292 ps_146_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:04:07
+293 ps_147_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:08:08
+294 ps_147_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:04:08
+295 ps_148_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:08:09
+296 ps_148_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:04:09
+297 ps_149_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:08:0a
+298 ps_149_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:04:0a
+299 ps_150_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:08:0b
+300 ps_150_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:04:0b
+301 ps_151_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+302 ps_151_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+303 ps_152_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:06:03
+304 ps_152_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:05:03
+305 ps_153_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:06:04
+306 ps_153_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:05:04
+307 ps_154_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:06:05
+308 ps_154_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:05:05
+309 ps_155_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:06:06
+310 ps_155_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:05:06
+311 ps_156_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:06:07
+312 ps_156_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:05:07
+313 ps_157_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:06:08
+314 ps_157_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:05:08
+315 ps_158_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:06:09
+316 ps_158_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:05:09
+317 ps_159_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:06:0a
+318 ps_159_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:05:0a
+319 ps_160_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:06:0b
+320 ps_160_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:05:0b
+321 ps_161_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:07:02
+322 ps_161_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:05:02
+323 ps_162_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:07:03
+324 ps_162_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:05:03
+325 ps_163_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:07:04
+326 ps_163_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:05:04
+327 ps_164_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:07:05
+328 ps_164_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:05:05
+329 ps_165_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:07:06
+330 ps_165_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:05:06
+331 ps_166_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:07:07
+332 ps_166_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:05:07
+333 ps_167_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:07:08
+334 ps_167_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:05:08
+335 ps_168_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:07:09
+336 ps_168_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:05:09
+337 ps_169_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:07:0a
+338 ps_169_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:05:0a
+339 ps_170_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:07:0b
+340 ps_170_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:05:0b
+341 ps_171_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+342 ps_171_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+343 ps_172_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:08:03
+344 ps_172_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:05:03
+345 ps_173_1 00:00:00:00:00:00:05:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:05:04 matchDstMac 00:00:c0:a8:08:04
+346 ps_173_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:05:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:05:04
+347 ps_174_1 00:00:00:00:00:00:05:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:05:05 matchDstMac 00:00:c0:a8:08:05
+348 ps_174_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:05:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:05:05
+349 ps_175_1 00:00:00:00:00:00:05:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:05:06 matchDstMac 00:00:c0:a8:08:06
+350 ps_175_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:05:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:05:06
+351 ps_176_1 00:00:00:00:00:00:05:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:05:07 matchDstMac 00:00:c0:a8:08:07
+352 ps_176_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:05:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:05:07
+353 ps_177_1 00:00:00:00:00:00:05:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:05:08 matchDstMac 00:00:c0:a8:08:08
+354 ps_177_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:05:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:05:08
+355 ps_178_1 00:00:00:00:00:00:05:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:05:09 matchDstMac 00:00:c0:a8:08:09
+356 ps_178_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:05:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:05:09
+357 ps_179_1 00:00:00:00:00:00:05:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:05:0a matchDstMac 00:00:c0:a8:08:0a
+358 ps_179_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:05:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:05:0a
+359 ps_180_1 00:00:00:00:00:00:05:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:05:0b matchDstMac 00:00:c0:a8:08:0b
+360 ps_180_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:05:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:05:0b
+361 ps_181_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+362 ps_181_2 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+363 ps_182_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:07:03
+364 ps_182_2 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:06:03
+365 ps_183_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:07:04
+366 ps_183_2 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:06:04
+367 ps_184_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:07:05
+368 ps_184_2 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:06:05
+369 ps_185_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:07:06
+370 ps_185_2 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:06:06
+371 ps_186_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:07:07
+372 ps_186_2 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:06:07
+373 ps_187_1 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:07:08
+374 ps_187_2 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:06:08
+375 ps_188_1 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:07:09
+376 ps_188_2 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:06:09
+377 ps_189_1 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:07:0a
+378 ps_189_2 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:06:0a
+379 ps_190_1 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:07:0b
+380 ps_190_2 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:06:0b
+381 ps_191_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+382 ps_191_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+383 ps_192_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:08:03
+384 ps_192_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:06:03
+385 ps_193_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:08:04
+386 ps_193_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:06:04
+387 ps_194_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:08:05
+388 ps_194_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:06:05
+389 ps_195_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:08:06
+390 ps_195_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:06:06
+391 ps_196_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:08:07
+392 ps_196_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:06:07
+393 ps_197_1 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:08:08
+394 ps_197_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:06:08
+395 ps_198_1 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:08:09
+396 ps_198_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:06:09
+397 ps_199_1 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:08:0a
+398 ps_199_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:06:0a
+399 ps_200_1 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:08:0b
+400 ps_200_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:06:0b
+401 ps_201_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+402 ps_201_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
+403 ps_202_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:08:03
+404 ps_202_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:07:03
+405 ps_203_1 00:00:00:00:00:00:07:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:07:04 matchDstMac 00:00:c0:a8:08:04
+406 ps_203_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:07:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:07:04
+407 ps_204_1 00:00:00:00:00:00:07:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:07:05 matchDstMac 00:00:c0:a8:08:05
+408 ps_204_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:07:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:07:05
+409 ps_205_1 00:00:00:00:00:00:07:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:07:06 matchDstMac 00:00:c0:a8:08:06
+410 ps_205_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:07:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:07:06
+411 ps_206_1 00:00:00:00:00:00:07:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:07:07 matchDstMac 00:00:c0:a8:08:07
+412 ps_206_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:07:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:07:07
+413 ps_207_1 00:00:00:00:00:00:07:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:07:08 matchDstMac 00:00:c0:a8:08:08
+414 ps_207_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:07:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:07:08
+415 ps_208_1 00:00:00:00:00:00:07:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:07:09 matchDstMac 00:00:c0:a8:08:09
+416 ps_208_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:07:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:07:09
+417 ps_209_1 00:00:00:00:00:00:07:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:07:0a matchDstMac 00:00:c0:a8:08:0a
+418 ps_209_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:07:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:07:0a
+419 ps_210_1 00:00:00:00:00:00:07:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:07:0b matchDstMac 00:00:c0:a8:08:0b
+420 ps_210_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:07:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:07:0b
diff --git a/web/flowdef_demo_add.txt b/web/flowdef_demo_add.txt
new file mode 100644
index 0000000..7ef2fbb
--- /dev/null
+++ b/web/flowdef_demo_add.txt
@@ -0,0 +1,61 @@
+# Demo flow scale down
+201 ps_101_1 00:00:00:00:00:00:05:01 1 00:00:00:00:00:00:02:01 1 matchSrcMac 00:00:c0:a8:05:01 matchDstMac 00:00:c0:a8:02:01
+202 ps_101_2 00:00:00:00:00:00:02:01 1 00:00:00:00:00:00:05:01 1 matchSrcMac 00:00:c0:a8:02:01 matchDstMac 00:00:c0:a8:05:01
+203 ps_102_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:02:02
+204 ps_102_2 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:05:02
+205 ps_103_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:02:03
+206 ps_103_2 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:05:03
+207 ps_104_1 00:00:00:00:00:00:05:01 1 00:00:00:00:00:00:03:01 1 matchSrcMac 00:00:c0:a8:05:01 matchDstMac 00:00:c0:a8:03:01
+208 ps_104_2 00:00:00:00:00:00:03:01 1 00:00:00:00:00:00:05:01 1 matchSrcMac 00:00:c0:a8:03:01 matchDstMac 00:00:c0:a8:05:01
+209 ps_105_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:03:02
+210 ps_105_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:05:02
+211 ps_106_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:03:03
+212 ps_106_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:05:03
+213 ps_107_1 00:00:00:00:00:00:05:01 1 00:00:00:00:00:00:04:01 1 matchSrcMac 00:00:c0:a8:05:01 matchDstMac 00:00:c0:a8:04:01
+214 ps_107_2 00:00:00:00:00:00:04:01 1 00:00:00:00:00:00:05:01 1 matchSrcMac 00:00:c0:a8:04:01 matchDstMac 00:00:c0:a8:05:01
+215 ps_108_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:04:02
+216 ps_108_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:05:02
+217 ps_109_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:04:03
+218 ps_109_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:05:03
+219 ps_110_1 00:00:00:00:00:00:05:01 1 00:00:00:00:00:00:06:01 1 matchSrcMac 00:00:c0:a8:05:01 matchDstMac 00:00:c0:a8:06:01
+220 ps_110_2 00:00:00:00:00:00:06:01 1 00:00:00:00:00:00:05:01 1 matchSrcMac 00:00:c0:a8:06:01 matchDstMac 00:00:c0:a8:05:01
+221 ps_111_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:06:02
+222 ps_111_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:05:02
+223 ps_112_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:06:03
+224 ps_112_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:05:03
+225 ps_113_1 00:00:00:00:00:00:05:01 1 00:00:00:00:00:00:08:01 1 matchSrcMac 00:00:c0:a8:05:01 matchDstMac 00:00:c0:a8:08:01
+226 ps_113_2 00:00:00:00:00:00:08:01 1 00:00:00:00:00:00:05:01 1 matchSrcMac 00:00:c0:a8:08:01 matchDstMac 00:00:c0:a8:05:01
+227 ps_114_1 00:00:00:00:00:00:05:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:05:02 matchDstMac 00:00:c0:a8:08:02
+228 ps_114_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:05:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:05:02
+229 ps_115_1 00:00:00:00:00:00:05:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:05:03 matchDstMac 00:00:c0:a8:08:03
+230 ps_115_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:05:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:05:03
+231 ps_116_1 00:00:00:00:00:00:07:01 1 00:00:00:00:00:00:02:01 1 matchSrcMac 00:00:c0:a8:07:01 matchDstMac 00:00:c0:a8:02:01
+232 ps_116_2 00:00:00:00:00:00:02:01 1 00:00:00:00:00:00:07:01 1 matchSrcMac 00:00:c0:a8:02:01 matchDstMac 00:00:c0:a8:07:01
+233 ps_117_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:02:02
+234 ps_117_2 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:07:02
+235 ps_118_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:02:03
+236 ps_118_2 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:07:03
+237 ps_119_1 00:00:00:00:00:00:07:01 1 00:00:00:00:00:00:03:01 1 matchSrcMac 00:00:c0:a8:07:01 matchDstMac 00:00:c0:a8:03:01
+238 ps_119_2 00:00:00:00:00:00:03:01 1 00:00:00:00:00:00:07:01 1 matchSrcMac 00:00:c0:a8:03:01 matchDstMac 00:00:c0:a8:07:01
+239 ps_120_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:03:02
+240 ps_120_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:07:02
+241 ps_121_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:03:03
+242 ps_121_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:07:03
+243 ps_122_1 00:00:00:00:00:00:07:01 1 00:00:00:00:00:00:04:01 1 matchSrcMac 00:00:c0:a8:07:01 matchDstMac 00:00:c0:a8:04:01
+244 ps_122_2 00:00:00:00:00:00:04:01 1 00:00:00:00:00:00:07:01 1 matchSrcMac 00:00:c0:a8:04:01 matchDstMac 00:00:c0:a8:07:01
+245 ps_123_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:04:02
+246 ps_123_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:07:02
+247 ps_124_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:04:03
+248 ps_124_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:07:03
+249 ps_125_1 00:00:00:00:00:00:07:01 1 00:00:00:00:00:00:06:01 1 matchSrcMac 00:00:c0:a8:07:01 matchDstMac 00:00:c0:a8:06:01
+250 ps_125_2 00:00:00:00:00:00:06:01 1 00:00:00:00:00:00:07:01 1 matchSrcMac 00:00:c0:a8:06:01 matchDstMac 00:00:c0:a8:07:01
+251 ps_126_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:06:02
+252 ps_126_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:07:02
+253 ps_127_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:06:03
+254 ps_127_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:07:03
+255 ps_128_1 00:00:00:00:00:00:07:01 1 00:00:00:00:00:00:08:01 1 matchSrcMac 00:00:c0:a8:07:01 matchDstMac 00:00:c0:a8:08:01
+256 ps_128_2 00:00:00:00:00:00:08:01 1 00:00:00:00:00:00:07:01 1 matchSrcMac 00:00:c0:a8:08:01 matchDstMac 00:00:c0:a8:07:01
+257 ps_129_1 00:00:00:00:00:00:07:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:07:02 matchDstMac 00:00:c0:a8:08:02
+258 ps_129_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:07:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:07:02
+259 ps_130_1 00:00:00:00:00:00:07:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:07:03 matchDstMac 00:00:c0:a8:08:03
+260 ps_130_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:07:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:07:03
diff --git a/web/flowdef_demo_start.txt b/web/flowdef_demo_start.txt
new file mode 100644
index 0000000..fe0e3b5
--- /dev/null
+++ b/web/flowdef_demo_start.txt
@@ -0,0 +1,201 @@
+# Demo flow scale down
+1 ps_1_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:03:02
+2 ps_1_2 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:02:02
+3 ps_2_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:03:03
+4 ps_2_2 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:02:03
+5 ps_3_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:03:04
+6 ps_3_2 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:02:04
+7 ps_4_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:03:05
+8 ps_4_2 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:02:05
+9 ps_5_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:03:06
+10 ps_5_2 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:02:06
+11 ps_6_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:03:07
+12 ps_6_2 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:02:07
+13 ps_7_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:03:08
+14 ps_7_2 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:02:08
+15 ps_8_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:03:09
+16 ps_8_2 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:02:09
+17 ps_9_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:03:0a
+18 ps_9_2 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:02:0a
+19 ps_10_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:03:0b
+20 ps_10_2 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:02:0b
+21 ps_11_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:04:02
+22 ps_11_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:02:02
+23 ps_12_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:04:03
+24 ps_12_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:02:03
+25 ps_13_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:04:04
+26 ps_13_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:02:04
+27 ps_14_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:04:05
+28 ps_14_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:02:05
+29 ps_15_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:04:06
+30 ps_15_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:02:06
+31 ps_16_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:04:07
+32 ps_16_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:02:07
+33 ps_17_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:04:08
+34 ps_17_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:02:08
+35 ps_18_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:04:09
+36 ps_18_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:02:09
+37 ps_19_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:04:0a
+38 ps_19_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:02:0a
+39 ps_20_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:04:0b
+40 ps_20_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:02:0b
+41 ps_21_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:06:02
+42 ps_21_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:02:02
+43 ps_22_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:06:03
+44 ps_22_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:02:03
+45 ps_23_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:06:04
+46 ps_23_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:02:04
+47 ps_24_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:06:05
+48 ps_24_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:02:05
+49 ps_25_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:06:06
+50 ps_25_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:02:06
+51 ps_26_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:06:07
+52 ps_26_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:02:07
+53 ps_27_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:06:08
+54 ps_27_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:02:08
+55 ps_28_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:06:09
+56 ps_28_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:02:09
+57 ps_29_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:06:0a
+58 ps_29_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:02:0a
+59 ps_30_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:06:0b
+60 ps_30_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:02:0b
+61 ps_31_1 00:00:00:00:00:00:02:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:02:02 matchDstMac 00:00:c0:a8:08:02
+62 ps_31_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:02:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:02:02
+63 ps_32_1 00:00:00:00:00:00:02:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:02:03 matchDstMac 00:00:c0:a8:08:03
+64 ps_32_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:02:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:02:03
+65 ps_33_1 00:00:00:00:00:00:02:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:02:04 matchDstMac 00:00:c0:a8:08:04
+66 ps_33_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:02:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:02:04
+67 ps_34_1 00:00:00:00:00:00:02:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:02:05 matchDstMac 00:00:c0:a8:08:05
+68 ps_34_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:02:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:02:05
+69 ps_35_1 00:00:00:00:00:00:02:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:02:06 matchDstMac 00:00:c0:a8:08:06
+70 ps_35_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:02:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:02:06
+71 ps_36_1 00:00:00:00:00:00:02:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:02:07 matchDstMac 00:00:c0:a8:08:07
+72 ps_36_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:02:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:02:07
+73 ps_37_1 00:00:00:00:00:00:02:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:02:08 matchDstMac 00:00:c0:a8:08:08
+74 ps_37_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:02:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:02:08
+75 ps_38_1 00:00:00:00:00:00:02:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:02:09 matchDstMac 00:00:c0:a8:08:09
+76 ps_38_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:02:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:02:09
+77 ps_39_1 00:00:00:00:00:00:02:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:02:0a matchDstMac 00:00:c0:a8:08:0a
+78 ps_39_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:02:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:02:0a
+79 ps_40_1 00:00:00:00:00:00:02:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:02:0b matchDstMac 00:00:c0:a8:08:0b
+80 ps_40_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:02:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:02:0b
+81 ps_41_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:04:02
+82 ps_41_2 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:03:02
+83 ps_42_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:04:03
+84 ps_42_2 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:03:03
+85 ps_43_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:04:04
+86 ps_43_2 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:03:04
+87 ps_44_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:04:05
+88 ps_44_2 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:03:05
+89 ps_45_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:04:06
+90 ps_45_2 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:03:06
+91 ps_46_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:04:07
+92 ps_46_2 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:03:07
+93 ps_47_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:04:08
+94 ps_47_2 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:03:08
+95 ps_48_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:04:09
+96 ps_48_2 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:03:09
+97 ps_49_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:04:0a
+98 ps_49_2 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:03:0a
+99 ps_50_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:04:0b
+100 ps_50_2 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:03:0b
+101 ps_51_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:06:02
+102 ps_51_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:03:02
+103 ps_52_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:06:03
+104 ps_52_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:03:03
+105 ps_53_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:06:04
+106 ps_53_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:03:04
+107 ps_54_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:06:05
+108 ps_54_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:03:05
+109 ps_55_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:06:06
+110 ps_55_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:03:06
+111 ps_56_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:06:07
+112 ps_56_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:03:07
+113 ps_57_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:06:08
+114 ps_57_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:03:08
+115 ps_58_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:06:09
+116 ps_58_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:03:09
+117 ps_59_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:06:0a
+118 ps_59_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:03:0a
+119 ps_60_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:06:0b
+120 ps_60_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:03:0b
+121 ps_61_1 00:00:00:00:00:00:03:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:03:02 matchDstMac 00:00:c0:a8:08:02
+122 ps_61_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:03:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:03:02
+123 ps_62_1 00:00:00:00:00:00:03:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:03:03 matchDstMac 00:00:c0:a8:08:03
+124 ps_62_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:03:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:03:03
+125 ps_63_1 00:00:00:00:00:00:03:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:03:04 matchDstMac 00:00:c0:a8:08:04
+126 ps_63_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:03:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:03:04
+127 ps_64_1 00:00:00:00:00:00:03:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:03:05 matchDstMac 00:00:c0:a8:08:05
+128 ps_64_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:03:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:03:05
+129 ps_65_1 00:00:00:00:00:00:03:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:03:06 matchDstMac 00:00:c0:a8:08:06
+130 ps_65_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:03:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:03:06
+131 ps_66_1 00:00:00:00:00:00:03:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:03:07 matchDstMac 00:00:c0:a8:08:07
+132 ps_66_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:03:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:03:07
+133 ps_67_1 00:00:00:00:00:00:03:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:03:08 matchDstMac 00:00:c0:a8:08:08
+134 ps_67_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:03:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:03:08
+135 ps_68_1 00:00:00:00:00:00:03:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:03:09 matchDstMac 00:00:c0:a8:08:09
+136 ps_68_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:03:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:03:09
+137 ps_69_1 00:00:00:00:00:00:03:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:03:0a matchDstMac 00:00:c0:a8:08:0a
+138 ps_69_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:03:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:03:0a
+139 ps_70_1 00:00:00:00:00:00:03:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:03:0b matchDstMac 00:00:c0:a8:08:0b
+140 ps_70_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:03:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:03:0b
+141 ps_71_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:06:02
+142 ps_71_2 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:04:02
+143 ps_72_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:06:03
+144 ps_72_2 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:04:03
+145 ps_73_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:06:04
+146 ps_73_2 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:04:04
+147 ps_74_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:06:05
+148 ps_74_2 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:04:05
+149 ps_75_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:06:06
+150 ps_75_2 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:04:06
+151 ps_76_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:06:07
+152 ps_76_2 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:04:07
+153 ps_77_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:06:08
+154 ps_77_2 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:04:08
+155 ps_78_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:06:09
+156 ps_78_2 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:04:09
+157 ps_79_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:06:0a
+158 ps_79_2 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:04:0a
+159 ps_80_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:06:0b
+160 ps_80_2 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:04:0b
+161 ps_81_1 00:00:00:00:00:00:04:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:04:02 matchDstMac 00:00:c0:a8:08:02
+162 ps_81_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:04:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:04:02
+163 ps_82_1 00:00:00:00:00:00:04:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:04:03 matchDstMac 00:00:c0:a8:08:03
+164 ps_82_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:04:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:04:03
+165 ps_83_1 00:00:00:00:00:00:04:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:04:04 matchDstMac 00:00:c0:a8:08:04
+166 ps_83_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:04:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:04:04
+167 ps_84_1 00:00:00:00:00:00:04:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:04:05 matchDstMac 00:00:c0:a8:08:05
+168 ps_84_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:04:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:04:05
+169 ps_85_1 00:00:00:00:00:00:04:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:04:06 matchDstMac 00:00:c0:a8:08:06
+170 ps_85_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:04:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:04:06
+171 ps_86_1 00:00:00:00:00:00:04:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:04:07 matchDstMac 00:00:c0:a8:08:07
+172 ps_86_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:04:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:04:07
+173 ps_87_1 00:00:00:00:00:00:04:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:04:08 matchDstMac 00:00:c0:a8:08:08
+174 ps_87_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:04:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:04:08
+175 ps_88_1 00:00:00:00:00:00:04:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:04:09 matchDstMac 00:00:c0:a8:08:09
+176 ps_88_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:04:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:04:09
+177 ps_89_1 00:00:00:00:00:00:04:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:04:0a matchDstMac 00:00:c0:a8:08:0a
+178 ps_89_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:04:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:04:0a
+179 ps_90_1 00:00:00:00:00:00:04:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:04:0b matchDstMac 00:00:c0:a8:08:0b
+180 ps_90_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:04:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:04:0b
+181 ps_91_1 00:00:00:00:00:00:06:02 1 00:00:00:00:00:00:08:02 1 matchSrcMac 00:00:c0:a8:06:02 matchDstMac 00:00:c0:a8:08:02
+182 ps_91_2 00:00:00:00:00:00:08:02 1 00:00:00:00:00:00:06:02 1 matchSrcMac 00:00:c0:a8:08:02 matchDstMac 00:00:c0:a8:06:02
+183 ps_92_1 00:00:00:00:00:00:06:03 1 00:00:00:00:00:00:08:03 1 matchSrcMac 00:00:c0:a8:06:03 matchDstMac 00:00:c0:a8:08:03
+184 ps_92_2 00:00:00:00:00:00:08:03 1 00:00:00:00:00:00:06:03 1 matchSrcMac 00:00:c0:a8:08:03 matchDstMac 00:00:c0:a8:06:03
+185 ps_93_1 00:00:00:00:00:00:06:04 1 00:00:00:00:00:00:08:04 1 matchSrcMac 00:00:c0:a8:06:04 matchDstMac 00:00:c0:a8:08:04
+186 ps_93_2 00:00:00:00:00:00:08:04 1 00:00:00:00:00:00:06:04 1 matchSrcMac 00:00:c0:a8:08:04 matchDstMac 00:00:c0:a8:06:04
+187 ps_94_1 00:00:00:00:00:00:06:05 1 00:00:00:00:00:00:08:05 1 matchSrcMac 00:00:c0:a8:06:05 matchDstMac 00:00:c0:a8:08:05
+188 ps_94_2 00:00:00:00:00:00:08:05 1 00:00:00:00:00:00:06:05 1 matchSrcMac 00:00:c0:a8:08:05 matchDstMac 00:00:c0:a8:06:05
+189 ps_95_1 00:00:00:00:00:00:06:06 1 00:00:00:00:00:00:08:06 1 matchSrcMac 00:00:c0:a8:06:06 matchDstMac 00:00:c0:a8:08:06
+190 ps_95_2 00:00:00:00:00:00:08:06 1 00:00:00:00:00:00:06:06 1 matchSrcMac 00:00:c0:a8:08:06 matchDstMac 00:00:c0:a8:06:06
+191 ps_96_1 00:00:00:00:00:00:06:07 1 00:00:00:00:00:00:08:07 1 matchSrcMac 00:00:c0:a8:06:07 matchDstMac 00:00:c0:a8:08:07
+192 ps_96_2 00:00:00:00:00:00:08:07 1 00:00:00:00:00:00:06:07 1 matchSrcMac 00:00:c0:a8:08:07 matchDstMac 00:00:c0:a8:06:07
+193 ps_97_1 00:00:00:00:00:00:06:08 1 00:00:00:00:00:00:08:08 1 matchSrcMac 00:00:c0:a8:06:08 matchDstMac 00:00:c0:a8:08:08
+194 ps_97_2 00:00:00:00:00:00:08:08 1 00:00:00:00:00:00:06:08 1 matchSrcMac 00:00:c0:a8:08:08 matchDstMac 00:00:c0:a8:06:08
+195 ps_98_1 00:00:00:00:00:00:06:09 1 00:00:00:00:00:00:08:09 1 matchSrcMac 00:00:c0:a8:06:09 matchDstMac 00:00:c0:a8:08:09
+196 ps_98_2 00:00:00:00:00:00:08:09 1 00:00:00:00:00:00:06:09 1 matchSrcMac 00:00:c0:a8:08:09 matchDstMac 00:00:c0:a8:06:09
+197 ps_99_1 00:00:00:00:00:00:06:0a 1 00:00:00:00:00:00:08:0a 1 matchSrcMac 00:00:c0:a8:06:0a matchDstMac 00:00:c0:a8:08:0a
+198 ps_99_2 00:00:00:00:00:00:08:0a 1 00:00:00:00:00:00:06:0a 1 matchSrcMac 00:00:c0:a8:08:0a matchDstMac 00:00:c0:a8:06:0a
+199 ps_100_1 00:00:00:00:00:00:06:0b 1 00:00:00:00:00:00:08:0b 1 matchSrcMac 00:00:c0:a8:06:0b matchDstMac 00:00:c0:a8:08:0b
+200 ps_100_2 00:00:00:00:00:00:08:0b 1 00:00:00:00:00:00:06:0b 1 matchSrcMac 00:00:c0:a8:08:0b matchDstMac 00:00:c0:a8:06:0b
diff --git a/web/flowsync.py b/web/flowsync.py
new file mode 100755
index 0000000..51399d5
--- /dev/null
+++ b/web/flowsync.py
@@ -0,0 +1,103 @@
+#! /usr/bin/env python
+
+
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+from flask import Flask, json, Response, render_template, make_response, request
+
+## Global Var ##
+ControllerIP="127.0.0.1"
+ControllerPort=8080
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+app = Flask(__name__)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+# @app.route("/wm/fprog/synchronizer/sync/<dpid>/json")
+# Sample output:
+# "true"
+def synchronize(dpid):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/synchronizer/sync/%s/json\"" % (ControllerIP, ControllerPort, dpid)
+ debug("synchronize %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to synchronize"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "Synchronization of switch %s has successfully began" % (dpid)
+
+# @app.route("/wm/fprog/synchronizer/interrupt/<dpid>/json")
+# Sample output:
+# "true"
+def interrupt(dpid):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/synchronizer/interrupt/%s/json\"" % (ControllerIP, ControllerPort, dpid)
+ debug("interrupt %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to interrupt synchronization"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "Synchronization of switch %s has successfully interrupted" % (dpid)
+
+
+if __name__ == "__main__":
+ usage_msg1 = "Usage:\n"
+ usage_msg2 = "%s sync <dpid> : Start synchronization of the switch\n" % (sys.argv[0])
+ usage_msg3 = " interrupt <dpid> : Interrupt synchronization of the switch\n"
+ usage_msg = usage_msg1 + usage_msg2 + usage_msg3;
+
+ app.debug = True;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+ if len(sys.argv) < 2:
+ log_error(usage_msg)
+ exit(1)
+
+ # Do the work
+ if sys.argv[1] == "sync":
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+ synchronize(sys.argv[2])
+ elif sys.argv[1] == "interrupt":
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+ interrupt(sys.argv[2])
+ else:
+ log_error(usage_msg)
+ exit(1)
+
\ No newline at end of file
diff --git a/web/generate_flows.py b/web/generate_flows.py
new file mode 100755
index 0000000..492b8cb
--- /dev/null
+++ b/web/generate_flows.py
@@ -0,0 +1,90 @@
+#! /usr/bin/env python
+# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+
+#
+# A script for generating a number of flows.
+#
+# The output of the script should be saved to a file, and the flows from
+# that file should be added by the following command:
+#
+# web/add_flow.py -f filename
+#
+# NOTE: Currently, some of the parameters fo the flows are hard-coded,
+# and all flows are between same source and destination DPID and ports
+# (differentiated by different matchSrcMac and matchDstMac).
+#
+
+import copy
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+## Global Var ##
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+
+if __name__ == "__main__":
+ usage_msg = "Generate a number of flows by using a pre-defined template.\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + "NOTE: This script is work-in-progress. Currently all flows are within same\n"
+ usage_msg = usage_msg + "pair of switch ports and contain auto-generated MAC-based matching conditions.\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + "Usage: %s <begin-flow-id> <end-flow-id>\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " The output should be saved to a file, and the flows should be installed\n"
+ usage_msg = usage_msg + " by using the command './add_flow.py -f filename'\n"
+
+
+ # app.debug = False;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+
+ # Extract the arguments
+ begin_flow_id = int(sys.argv[1], 0)
+ end_flow_id = int(sys.argv[2], 0)
+ if begin_flow_id > end_flow_id:
+ log_error(usage_msg)
+ exit(1)
+
+ #
+ # Do the work
+ #
+ # NOTE: Currently, up to 65536 flows are supported.
+ # More flows can be supported by iterating by, say, iterating over some of
+ # the other bytes of the autogenereated source/destination MAC addresses.
+ #
+ flow_id = begin_flow_id
+ idx = 0
+ while flow_id <= end_flow_id:
+ mac3 = idx / 255
+ mac4 = idx % 255
+ str_mac3 = "%0.2x" % mac3
+ str_mac4 = "%0.2x" % mac4
+ src_mac = "00:00:" + str_mac3 + ":" + str_mac4 + ":00:00";
+ dst_mac = "00:01:" + str_mac3 + ":" + str_mac4 + ":00:00";
+ print "%s FOOBAR 00:00:00:00:00:00:01:01 1 00:00:00:00:00:00:01:0b 1 matchSrcMac %s matchDstMac %s" % (flow_id, src_mac, dst_mac)
+ flow_id = flow_id + 1
+ idx = idx + 1
diff --git a/web/get_datagrid.py b/web/get_datagrid.py
new file mode 100755
index 0000000..2d26846
--- /dev/null
+++ b/web/get_datagrid.py
@@ -0,0 +1,84 @@
+#! /usr/bin/env python
+# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+from flask import Flask, json, Response, render_template, make_response, request
+
+## Global Var ##
+ControllerIP="127.0.0.1"
+ControllerPort=8080
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+app = Flask(__name__)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+# @app.route("/wm/datagrid/get/map/<map-name>/json ")
+# Sample output:
+
+def print_datagrid_map(parsedResult):
+ print '%s' % (parsedResult)
+
+def get_datagrid_map(map_name):
+ try:
+ command = "curl -s \"http://%s:%s/wm/datagrid/get/map/%s/json\"" % (ControllerIP, ControllerPort, map_name)
+ debug("get_datagrid_map %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if len(result) == 0:
+ print "No Map found"
+ return;
+
+ # TODO: For now, the string is not JSON-formatted
+ # parsedResult = json.loads(result)
+ parsedResult = result
+ debug("parsed %s" % parsedResult)
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print_datagrid_map(parsedResult)
+
+
+if __name__ == "__main__":
+ usage_msg1 = "Usage:\n"
+ usage_msg2 = "%s <map_name> : Print datagrid map with name of <map_name>\n" % (sys.argv[0])
+ usage_msg3 = " Valid map names:\n"
+ usage_msg4 = " all : Print all maps\n"
+ usage_msg5 = " flow : Print all flows\n"
+ usage_msg6 = " flow-entry : Print all flow entries\n"
+ usage_msg7 = " topology : Print the topology\n"
+ usage_msg = usage_msg1 + usage_msg2 + usage_msg3 + usage_msg4 + usage_msg5
+ usage_msg = usage_msg + usage_msg6 + usage_msg7
+
+ # app.debug = False;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+ if len(sys.argv) < 2:
+ log_error(usage_msg)
+ exit(1)
+
+ # Do the work
+ get_datagrid_map(sys.argv[1])
diff --git a/web/get_flow.py b/web/get_flow.py
index b20e134..72fbd4a 100755
--- a/web/get_flow.py
+++ b/web/get_flow.py
@@ -33,23 +33,202 @@
# Sample output:
# {"flowId":{"value":"0x5"},"installerId":{"value":"FOOBAR"},"dataPath":{"srcPort":{"dpid":{"value":"00:00:00:00:00:00:00:01"},"port":{"value":0}},"dstPort":{"dpid":{"value":"00:00:00:00:00:00:00:02"},"port":{"value":0}},"flowEntries":[{"flowEntryId":"0x1389","flowEntryMatch":null,"flowEntryActions":null,"dpid":{"value":"00:00:00:00:00:00:00:01"},"inPort":{"value":0},"outPort":{"value":1},"flowEntryUserState":"FE_USER_DELETE","flowEntrySwitchState":"FE_SWITCH_NOT_UPDATED","flowEntryErrorState":null},{"flowEntryId":"0x138a","flowEntryMatch":null,"flowEntryActions":null,"dpid":{"value":"00:00:00:00:00:00:00:02"},"inPort":{"value":9},"outPort":{"value":0},"flowEntryUserState":"FE_USER_DELETE","flowEntrySwitchState":"FE_SWITCH_NOT_UPDATED","flowEntryErrorState":null}]}}
+def parse_match(match):
+ result = []
+
+ inPort = match['inPort']
+ matchInPort = match['matchInPort']
+ srcMac = match['srcMac']
+ matchSrcMac = match['matchSrcMac']
+ dstMac = match['dstMac']
+ matchDstMac = match['matchDstMac']
+ ethernetFrameType = match['ethernetFrameType']
+ matchEthernetFrameType = match['matchEthernetFrameType']
+ vlanId = match['vlanId']
+ matchVlanId = match['matchVlanId']
+ vlanPriority = match['vlanPriority']
+ matchVlanPriority = match['matchVlanPriority']
+ srcIPv4Net = match['srcIPv4Net']
+ matchSrcIPv4Net = match['matchSrcIPv4Net']
+ dstIPv4Net = match['dstIPv4Net']
+ matchDstIPv4Net = match['matchDstIPv4Net']
+ ipProto = match['ipProto']
+ matchIpProto = match['matchIpProto']
+ ipToS = match['ipToS']
+ matchIpToS = match['matchIpToS']
+ srcTcpUdpPort = match['srcTcpUdpPort']
+ matchSrcTcpUdpPort = match['matchSrcTcpUdpPort']
+ dstTcpUdpPort = match['dstTcpUdpPort']
+ matchDstTcpUdpPort = match['matchDstTcpUdpPort']
+ if matchInPort == True:
+ r = "inPort: %s" % inPort['value']
+ result.append(r)
+ if matchSrcMac == True:
+ r = "srcMac: %s" % srcMac['value']
+ result.append(r)
+ if matchDstMac == True:
+ r = "dstMac: %s" % dstMac['value']
+ result.append(r)
+ if matchEthernetFrameType == True:
+ r = "ethernetFrameType: %s" % hex(ethernetFrameType)
+ result.append(r)
+ if matchVlanId == True:
+ r = "vlanId: %s" % vlanId
+ result.append(r)
+ if matchVlanPriority == True:
+ r = "vlanPriority: %s" % vlanPriority
+ result.append(r)
+ if matchSrcIPv4Net == True:
+ r = "srcIPv4Net: %s" % srcIPv4Net['value']
+ result.append(r)
+ if matchDstIPv4Net == True:
+ r = "dstIPv4Net: %s" % dstIPv4Net['value']
+ result.append(r)
+ if matchIpProto == True:
+ r = "ipProto: %s" % ipProto
+ result.append(r)
+ if matchIpToS == True:
+ r = "ipToS: %s" % ipToS
+ result.append(r)
+ if matchSrcTcpUdpPort == True:
+ r = "srcTcpUdpPort: %s" % srcTcpUdpPort
+ result.append(r)
+ if matchDstTcpUdpPort == True:
+ r = "dstTcpUdpPort: %s" % dstTcpUdpPort
+ result.append(r)
+
+ return result
+
+
+def parse_actions(actions):
+ result = []
+ for a in actions:
+ actionType = a['actionType']
+ if actionType == "ACTION_OUTPUT":
+ port = a['actionOutput']['port']['value']
+ maxLen = a['actionOutput']['maxLen']
+ r = "actionType: %s port: %s maxLen: %s" % (actionType, port, maxLen)
+ result.append(r)
+ if actionType == "ACTION_SET_VLAN_VID":
+ vlanId = a['actionSetVlanId']['vlanId']
+ r = "actionType: %s vlanId: %s" % (actionType, vlanId)
+ result.append(r)
+ if actionType == "ACTION_SET_VLAN_PCP":
+ vlanPriority = a['actionSetVlanPriority']['vlanPriority']
+ r = "actionType: %s vlanPriority: %s" % (actionType, vlanPriority)
+ result.append(r)
+ if actionType == "ACTION_STRIP_VLAN":
+ stripVlan = a['actionStripVlan']['stripVlan']
+ r = "actionType: %s stripVlan: %s" % (actionType, stripVlan)
+ result.append(r)
+ if actionType == "ACTION_SET_DL_SRC":
+ setEthernetSrcAddr = a['actionSetEthernetSrcAddr']['addr']['value']
+ r = "actionType: %s setEthernetSrcAddr: %s" % (actionType, setEthernetSrcAddr)
+ result.append(r)
+ if actionType == "ACTION_SET_DL_DST":
+ setEthernetDstAddr = a['actionSetEthernetDstAddr']['addr']['value']
+ r = "actionType: %s setEthernetDstAddr: %s" % (actionType, setEthernetDstAddr)
+ result.append(r)
+ if actionType == "ACTION_SET_NW_SRC":
+ setIPv4SrcAddr = a['actionSetIPv4SrcAddr']['addr']['value']
+ r = "actionType: %s setIPv4SrcAddr: %s" % (actionType, setIPv4SrcAddr)
+ result.append(r)
+ if actionType == "ACTION_SET_NW_DST":
+ setIPv4DstAddr = a['actionSetIPv4DstAddr']['addr']['value']
+ r = "actionType: %s setIPv4DstAddr: %s" % (actionType, setIPv4DstAddr)
+ result.append(r)
+ if actionType == "ACTION_SET_NW_TOS":
+ setIpToS = a['actionSetIpToS']['ipToS']
+ r = "actionType: %s setIpToS: %s" % (actionType, setIpToS)
+ result.append(r)
+ if actionType == "ACTION_SET_TP_SRC":
+ setTcpUdpSrcPort = a['actionSetTcpUdpSrcPort']['port']
+ r = "actionType: %s setTcpUdpSrcPort: %s" % (actionType, setTcpUdpSrcPort)
+ result.append(r)
+ if actionType == "ACTION_SET_TP_DST":
+ setTcpUdpDstPort = a['actionSetTcpUdpDstPort']['port']
+ r = "actionType: %s setTcpUdpDstPort: %s" % (actionType, setTcpUdpDstPort)
+ result.append(r)
+ if actionType == "ACTION_ENQUEUE":
+ port = a['actionEnqueue']['port']['value']
+ queueId = a['actionEnqueue']['queueId']
+ r = "actionType: %s port: %s queueId: %s" % (actionType, port, queueId)
+ result.append(r)
+
+ return result
+
+
def print_flow_path(parsedResult):
- flowId = parsedResult['flowId']['value'];
- installerId = parsedResult['installerId']['value'];
- srcSwitch = parsedResult['dataPath']['srcPort']['dpid']['value'];
- srcPort = parsedResult['dataPath']['srcPort']['port']['value'];
- dstSwitch = parsedResult['dataPath']['dstPort']['dpid']['value'];
- dstPort = parsedResult['dataPath']['dstPort']['port']['value'];
+ flowId = parsedResult['flowId']['value']
+ installerId = parsedResult['installerId']['value']
+ flowPathType = parsedResult['flowPathType']
+ flowPathUserState = parsedResult['flowPathUserState']
+ flowPathFlags = parsedResult['flowPathFlags']['flags']
+ srcSwitch = parsedResult['dataPath']['srcPort']['dpid']['value']
+ srcPort = parsedResult['dataPath']['srcPort']['port']['value']
+ dstSwitch = parsedResult['dataPath']['dstPort']['dpid']['value']
+ dstPort = parsedResult['dataPath']['dstPort']['port']['value']
+ match = parsedResult['flowEntryMatch'];
+ actions = parsedResult['flowEntryActions']['actions']
- print "FlowPath: (flowId = %s installerId = %s src = %s/%s dst = %s/%s)" % (flowId, installerId, srcSwitch, srcPort, dstSwitch, dstPort)
+ flowPathFlagsStr = ""
+ if (flowPathFlags & 0x1):
+ if flowPathFlagsStr:
+ flowPathFlagsStr += ","
+ flowPathFlagsStr += "DISCARD_FIRST_HOP_ENTRY"
+ if (flowPathFlags & 0x2):
+ if flowPathFlagsStr:
+ flowPathFlagsStr += ","
+ flowPathFlagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY"
+ print "FlowPath: (flowId = %s installerId = %s flowPathType = %s flowPathUserState = %s flowPathFlags = 0x%x(%s) src = %s/%s dst = %s/%s)" % (flowId, installerId, flowPathType, flowPathUserState, flowPathFlags, flowPathFlagsStr, srcSwitch, srcPort, dstSwitch, dstPort)
+
+ #
+ # Print the common match conditions
+ #
+ if match == None:
+ print " Match: %s" % (match)
+ else:
+ parsedMatch = parse_match(match)
+ for l in parsedMatch:
+ print " %s" % l
+
+ #
+ # Print the actions
+ #
+ parsedActions = parse_actions(actions)
+ for l in parsedActions:
+ print " %s" % l
+
+ #
+ # Print each Flow Entry
+ #
for f in parsedResult['dataPath']['flowEntries']:
- inPort = f['inPort']['value'];
- outPort = f['outPort']['value'];
+ flowEntryId = f['flowEntryId']
dpid = f['dpid']['value']
userState = f['flowEntryUserState']
switchState = f['flowEntrySwitchState']
- print " FlowEntry: (%s, %s, %s, %s, %s)" % (inPort, dpid, outPort, userState, switchState)
+ match = f['flowEntryMatch'];
+ actions = f['flowEntryActions']['actions']
+
+ print " FlowEntry: (%s, %s, %s, %s)" % (flowEntryId, dpid, userState, switchState)
+
+ #
+ # Print the match conditions
+ #
+ if match == None:
+ print " Match: %s" % (match)
+ else:
+ parsedMatch = parse_match(match)
+ for l in parsedMatch:
+ print " %s" % l
+ #
+ # Print the actions
+ #
+ parsedActions = parse_actions(actions)
+ for l in parsedActions:
+ print " %s" % l
+
def get_flow_path(flow_id):
try:
@@ -59,8 +238,8 @@
result = os.popen(command).read()
debug("result %s" % result)
if len(result) == 0:
- print "No Flow found"
- return;
+ print "No Flow found"
+ return;
parsedResult = json.loads(result)
debug("parsed %s" % parsedResult)
@@ -71,48 +250,6 @@
print_flow_path(parsedResult)
-def get_installer_flow_paths(installer_id, v1, p1, v2, p2):
- try:
- command = "curl -s \"http://%s:%s/wm/flow/getall-by-installer-id/%s/%s/%s/%s/%s/json\"" % (ControllerIP, ControllerPort, installer_id, v1, p1, v2, p2)
- debug("get_installer_flow_paths %s" % command)
-
- result = os.popen(command).read()
- debug("result %s" % result)
- if len(result) == 0:
- print "No Flows found"
- return;
-
- parsedResult = json.loads(result)
- debug("parsed %s" % parsedResult)
- except:
- log_error("Controller IF has issue")
- exit(1)
-
- for flowPath in parsedResult:
- print_flow_path(flowPath)
-
-
-def get_endpoints_flow_paths(v1, p1, v2, p2):
- try:
- command = "curl -s \"http://%s:%s/wm/flow/getall-by-endpoints/%s/%s/%s/%s/json\"" % (ControllerIP, ControllerPort, v1, p1, v2, p2)
- debug("get_endpoints_flow_paths %s" % command)
-
- result = os.popen(command).read()
- debug("result %s" % result)
- if len(result) == 0:
- print "No Flows found"
- return;
-
- parsedResult = json.loads(result)
- debug("parsed %s" % parsedResult)
- except:
- log_error("Controller IF has issue")
- exit(1)
-
- for flowPath in parsedResult:
- print_flow_path(flowPath)
-
-
def get_all_flow_paths():
try:
command = "curl -s \"http://%s:%s/wm/flow/getall/json\"" % (ControllerIP, ControllerPort)
@@ -137,9 +274,7 @@
usage_msg1 = "Usage:\n"
usage_msg2 = "%s <flow_id> : Print flow with Flow ID of <flow_id>\n" % (sys.argv[0])
usage_msg3 = " all : Print all flows\n"
- usage_msg4 = " installer <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port>\n"
- usage_msg5 = " endpoints <src-dpid> <src-port> <dest-dpid> <dest-port>"
- usage_msg = usage_msg1 + usage_msg2 + usage_msg3 + usage_msg4 + usage_msg5;
+ usage_msg = usage_msg1 + usage_msg2 + usage_msg3;
# app.debug = False;
@@ -156,17 +291,5 @@
# Do the work
if sys.argv[1] == "all":
get_all_flow_paths()
- elif sys.argv[1] == "installer":
- if len(sys.argv) < 7:
- log_error(usage_msg)
- exit(1)
- get_installer_flow_paths(sys.argv[2], sys.argv[3], sys.argv[4],
- sys.argv[5], sys.argv[6])
- elif sys.argv[1] == "endpoints":
- if len(sys.argv) < 6:
- log_error(usage_msg)
- exit(1)
- get_endpoints_flow_paths(sys.argv[2], sys.argv[3], sys.argv[4],
- sys.argv[5])
else:
get_flow_path(sys.argv[1])
diff --git a/web/js/controller-status.js b/web/js/controller-status.js
index 1cca38f..5c1ae30 100644
--- a/web/js/controller-status.js
+++ b/web/js/controller-status.js
@@ -5,22 +5,22 @@
{name:'onos12vpc', onos: 0, cassandra: 1}] */
var barWidth = 100;
- var width = (barWidth + 10) * 4
+ var width = (barWidth + 10) * 8
var height = 50;
var Servers = d3.select("#servers").
append("svg:svg").
- attr("width", 800).
+ attr("width", 1280).
attr("height", 30);
var ContStatus = d3.select("#onos-status").
append("svg:svg").
- attr("width", 800).
+ attr("width", 1280).
attr("height", 50);
var CassandraStatus = d3.select("#cassandra-status").
append("svg:svg").
- attr("width", 800).
+ attr("width", 1280).
attr("height", 50);
d3.json(data_source, draw);
@@ -32,7 +32,7 @@
},
dataType: "json"
});
- }, 5000);
+ }, 3000);
function draw(json){
// var data = json.data;
@@ -62,6 +62,14 @@
return "green"
}else if (index == 3){
return "orange"
+ }else if (index == 4){
+ return "cyan"
+ }else if (index == 5){
+ return "magenta"
+ }else if (index == 6){
+ return "yellow"
+ }else if (index == 7){
+ return "purple"
}else{
return "black"
}
@@ -84,6 +92,14 @@
return "green"
}else if (index == 3){
return "orange"
+ }else if (index == 4){
+ return "cyan"
+ }else if (index == 5){
+ return "magenta"
+ }else if (index == 6){
+ return "yellow"
+ }else if (index == 7){
+ return "purple"
}else{
return "black"
}
@@ -133,6 +149,14 @@
return "green"
}else if (index == 3){
return "orange"
+ }else if (index == 4){
+ return "cyan"
+ }else if (index == 5){
+ return "magenta"
+ }else if (index == 6){
+ return "yellow"
+ }else if (index == 7){
+ return "purple"
}else{
return "black"
}
diff --git a/web/js/onos-topology.js b/web/js/onos-topology.js
index 062d37b..3772127 100644
--- a/web/js/onos-topology.js
+++ b/web/js/onos-topology.js
@@ -1,6 +1,6 @@
function gui(data_source){
- var width = 960,
- height = 500;
+ var width = 1280,
+ height = 1280;
var radius = 8;
var color = d3.scale.category20();
@@ -250,19 +250,33 @@
.attr("y", ".31em")
.text(function(d) {
l=d.name.split(":").length
- return d.name.split(":")[l-3] + ":" + d.name.split(":")[l-2] + ":" + d.name.split(":")[l-1]
+ return d.name.split(":")[l-2] + ":" + d.name.split(":")[l-1]
});
circle.append("title")
.text(function(d) { return d.name; });
circle.attr("fill", function(d) {
- if (d.group == 1){return "red";}
- else if (d.group == 2){return "blue";}
- else if (d.group == 3){return "green";}
- else if (d.group == 4){return "orange";}
- else if (d.group == 1000){return "black";}
- else{ return "gray"; }
+ if (d.group == 1){
+ return "red"
+ }else if (d.group == 2){
+ return "blue"
+ }else if (d.group == 3){
+ return "green"
+ }else if (d.group == 4){
+ return "orange"
+ }else if (d.group == 5){
+ return "cyan"
+ }else if (d.group == 6){
+ return "magenta"
+ }else if (d.group == 7){
+ return "yellow"
+ }else if (d.group == 8){
+ return "purple"
+ }else{
+ return "gray"
+ }
+
});
path.attr("stroke", function(d) {
@@ -364,12 +378,25 @@
})
circle.attr("fill", function(d) {
- ; if (d.group == 1){return "red";}
- else if (d.group == 2){return "blue";}
- else if (d.group == 3){return "green";}
- else if (d.group == 4){return "orange";}
- else if (d.group == 1000){return "black";}
- else{ return "gray"; }
+ if (d.group == 1){
+ return "red"
+ }else if (d.group == 2){
+ return "blue"
+ }else if (d.group == 3){
+ return "green"
+ }else if (d.group == 4){
+ return "orange"
+ }else if (d.group == 5){
+ return "cyan"
+ }else if (d.group == 6){
+ return "magenta"
+ }else if (d.group == 7){
+ return "yellow"
+ }else if (d.group == 8){
+ return "purple"
+ }else{
+ return "gray"
+ }
});
// text.attr("x", function(d) { return d.x; }).attr("y", function(d) { return d.y; });
text.attr("transform", function(d) {
diff --git a/web/link.json b/web/link.json
new file mode 100644
index 0000000..1bf2b66
--- /dev/null
+++ b/web/link.json
@@ -0,0 +1,2636 @@
+[
+ {
+ "dst-switch": "00:00:00:16:97:08:9a:46",
+ "src-switch": "00:00:00:00:ba:5e:ba:11",
+ "src-port": 2,
+ "dst-port": 2
+ },
+ {
+ "dst-switch": "00:00:00:08:a2:08:f9:01",
+ "src-switch": "00:00:00:00:ba:5e:ba:11",
+ "src-port": 3,
+ "dst-port": 2
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-switch": "00:00:00:00:ba:5e:ba:11",
+ "src-port": 4,
+ "dst-port": 51
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-switch": "00:00:00:00:00:00:ba:12",
+ "src-port": 5,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-switch": "00:00:00:00:00:00:ba:12",
+ "src-port": 4,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:08:a2:08:f9:01",
+ "src-switch": "00:00:00:00:00:00:ba:12",
+ "src-port": 2,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:00:00:ba:5e:ba:13",
+ "src-switch": "00:00:00:00:00:00:ba:12",
+ "src-port": 3,
+ "dst-port": 2
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-port": 5,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:16:97:08:9a:46",
+ "src-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-port": 2,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:00:08:a2:08:f9:01",
+ "src-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-port": 3,
+ "dst-port": 4
+ },
+ {
+ "dst-switch": "00:00:00:00:ba:5e:ba:13",
+ "src-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-port": 4,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-switch": "00:00:00:00:ba:5e:ba:13",
+ "src-port": 4,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:ba:12",
+ "src-switch": "00:00:00:00:ba:5e:ba:13",
+ "src-port": 2,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-switch": "00:00:00:00:ba:5e:ba:13",
+ "src-port": 3,
+ "dst-port": 4
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-switch": "00:00:00:08:a2:08:f9:01",
+ "src-port": 5,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:00:ba:5e:ba:11",
+ "src-switch": "00:00:00:08:a2:08:f9:01",
+ "src-port": 2,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:ba:12",
+ "src-switch": "00:00:00:08:a2:08:f9:01",
+ "src-port": 3,
+ "dst-port": 2
+ },
+ {
+ "dst-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-switch": "00:00:00:08:a2:08:f9:01",
+ "src-port": 4,
+ "dst-port": 3
+ },
+ {
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-switch": "00:00:00:16:97:08:9a:46",
+ "src-port": 4,
+ "dst-port": 26
+ },
+ {
+ "dst-switch": "00:00:00:00:ba:5e:ba:11",
+ "src-switch": "00:00:00:16:97:08:9a:46",
+ "src-port": 2,
+ "dst-port": 2
+ },
+ {
+ "dst-switch": "00:00:20:4e:7f:51:8a:35",
+ "src-switch": "00:00:00:16:97:08:9a:46",
+ "src-port": 3,
+ "dst-port": 2
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:15"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0f"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:11"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0c"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:03"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:16"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0b"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0e"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0d"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0c"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:19"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:12"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:16"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:06"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:02"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:02"
+ },
+ {
+ "dst-port": 51,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:02"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:11"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:04"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:06"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:09"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:14"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0f"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0e"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:02"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:08"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0d"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0b"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:16"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:12"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:01:03"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:03"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:04",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:03"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:06",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:03"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:07"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:19"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:01:06"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:04",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:01:06"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:06"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:06"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:05",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:06"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:14"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:08"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:01:04"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:01:04"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:03",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:04"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:05",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:04"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:01:06",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:04"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:06"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:05"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0f"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:01:04",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:05"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:06",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:05"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:05"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:19"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:14"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0c"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0e"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:19"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:10"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0a"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0b"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0f"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0c"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:02"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:16"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0a"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:02"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:11"
+ },
+ {
+ "dst-port": 31,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1f"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0b"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:11"
+ },
+ {
+ "dst-port": 44,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2c"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:09"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:19"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:10"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:17"
+ },
+ {
+ "dst-port": 39,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:27"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0e"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0b"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:15"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0d"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0d"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:15"
+ },
+ {
+ "dst-port": 27,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1b"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:03"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:15"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0d"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:05"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0a"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:17"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:12"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:08"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:08"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:11"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:17"
+ },
+ {
+ "dst-port": 35,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:23"
+ },
+ {
+ "dst-port": 38,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:26"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:19"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:04"
+ },
+ {
+ "dst-port": 36,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:24"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:0a"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:17"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0c"
+ },
+ {
+ "dst-port": 43,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2b"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:05"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:08"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:04"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:18"
+ },
+ {
+ "dst-port": 28,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1c"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:01:06",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:07:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:07:01"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:10"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:0c"
+ },
+ {
+ "dst-port": 30,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1e"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:04"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:13"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:28",
+ "src-port": 40,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:31",
+ "src-port": 49,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1f",
+ "src-port": 31,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1b",
+ "src-port": 27,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:22",
+ "src-port": 34,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:29",
+ "src-port": 41,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:30",
+ "src-port": 48,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1c",
+ "src-port": 28,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:21",
+ "src-port": 33,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2a",
+ "src-port": 42,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2f",
+ "src-port": 47,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2e",
+ "src-port": 46,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1a",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:24",
+ "src-port": 36,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2d",
+ "src-port": 45,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:23",
+ "src-port": 35,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:02",
+ "src-port": 51,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:25",
+ "src-port": 37,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2c",
+ "src-port": 44,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:2b",
+ "src-port": 43,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1e",
+ "src-port": 30,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:26",
+ "src-port": 38,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:1d",
+ "src-port": 29,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:27",
+ "src-port": 39,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:20",
+ "src-port": 32,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:32",
+ "src-port": 50,
+ "src-switch": "00:00:00:00:00:00:02:01"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:10"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:14"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:04"
+ },
+ {
+ "dst-port": 49,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:31"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:14"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:05"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:18"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:12"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0b"
+ },
+ {
+ "dst-port": 42,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2a"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:18"
+ },
+ {
+ "dst-port": 48,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:30"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:14"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:15"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:13"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:07"
+ },
+ {
+ "dst-port": 37,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:25"
+ },
+ {
+ "dst-port": 33,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:21"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:17"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:06"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:10"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:11"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0d"
+ },
+ {
+ "dst-port": 32,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:20"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:10"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:09"
+ },
+ {
+ "dst-port": 34,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:22"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:04"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:09"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:15"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:07"
+ },
+ {
+ "dst-port": 12,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0c"
+ },
+ {
+ "dst-port": 47,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2f"
+ },
+ {
+ "dst-port": 16,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:10"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:09"
+ },
+ {
+ "dst-port": 13,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0d"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:13"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:06"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0f"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:02"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:09"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:18"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:12"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:18"
+ },
+ {
+ "dst-port": 45,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2d"
+ },
+ {
+ "dst-port": 11,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0b"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:13"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:02"
+ },
+ {
+ "dst-port": 20,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:14"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:01",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:08:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:08:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:01:03",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:03:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:03:01"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:03"
+ },
+ {
+ "dst-port": 29,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1d"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:03"
+ },
+ {
+ "dst-port": 25,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:19"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:07"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:08"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0e"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0e"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:07"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:06"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:0f"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:05"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:01:04",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:05:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:05:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:01:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:01:06",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:01:01"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:01:01"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:12"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:0a"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:03"
+ },
+ {
+ "dst-port": 17,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:11"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:17"
+ },
+ {
+ "dst-port": 18,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:12"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:13"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:07"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0a"
+ },
+ {
+ "dst-port": 40,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:28"
+ },
+ {
+ "dst-port": 10,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:0a"
+ },
+ {
+ "dst-port": 50,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:32"
+ },
+ {
+ "dst-port": 41,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:29"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:05"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:05"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:16"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:03"
+ },
+ {
+ "dst-port": 23,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:17"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:13"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:04"
+ },
+ {
+ "dst-port": 26,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:1a"
+ },
+ {
+ "dst-port": 6,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:06"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:02"
+ },
+ {
+ "dst-port": 19,
+ "dst-switch": "00:00:00:00:00:00:07:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:07:13"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 5,
+ "dst-switch": "00:00:00:00:00:00:01:04",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:04:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:04:01"
+ },
+ {
+ "dst-port": 21,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:15"
+ },
+ {
+ "dst-port": 3,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:03"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:18"
+ },
+ {
+ "dst-port": 9,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:09"
+ },
+ {
+ "dst-port": 46,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:2e"
+ },
+ {
+ "dst-port": 15,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:0f"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:02:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:02:02"
+ },
+ {
+ "dst-port": 14,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:0e"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:03:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:03:16"
+ },
+ {
+ "dst-port": 22,
+ "dst-switch": "00:00:00:00:00:00:06:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:16"
+ },
+ {
+ "dst-port": 7,
+ "dst-switch": "00:00:00:00:00:00:08:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:08:07"
+ },
+ {
+ "dst-port": 24,
+ "dst-switch": "00:00:00:00:00:00:04:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:04:18"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0c",
+ "src-port": 12,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:16",
+ "src-port": 22,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:14",
+ "src-port": 20,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:06",
+ "src-port": 6,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0d",
+ "src-port": 13,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:13",
+ "src-port": 19,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:05",
+ "src-port": 5,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:12",
+ "src-port": 18,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:19",
+ "src-port": 25,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:07",
+ "src-port": 7,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 4,
+ "dst-switch": "00:00:00:00:00:00:01:05",
+ "src-port": 26,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:08",
+ "src-port": 8,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:11",
+ "src-port": 17,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:02",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:09",
+ "src-port": 9,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0a",
+ "src-port": 10,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:17",
+ "src-port": 23,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:10",
+ "src-port": 16,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0f",
+ "src-port": 15,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:18",
+ "src-port": 24,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0e",
+ "src-port": 14,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:15",
+ "src-port": 21,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:03",
+ "src-port": 3,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:0b",
+ "src-port": 11,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 2,
+ "dst-switch": "00:00:00:00:00:00:06:04",
+ "src-port": 4,
+ "src-switch": "00:00:00:00:00:00:06:01"
+ },
+ {
+ "dst-port": 8,
+ "dst-switch": "00:00:00:00:00:00:05:01",
+ "src-port": 2,
+ "src-switch": "00:00:00:00:00:00:05:08"
+ }
+]
diff --git a/web/log b/web/log
deleted file mode 100644
index e69de29..0000000
--- a/web/log
+++ /dev/null
diff --git a/web/onos-topology.html b/web/onos-topology.html
index 9d90ea4..d72c0e1 100644
--- a/web/onos-topology.html
+++ b/web/onos-topology.html
@@ -52,8 +52,8 @@
<div id="topology"></div>
<script type="text/javascript" src="js/controller-status.js"></script>
<script type="text/javascript">
-controller_status("http://gui.onlab.us:8080/controller_status");
-gui("http://gui.onlab.us:8080/topology");
+controller_status("controller_status");
+gui("topology");
</script>
</svg>
</body>
diff --git a/web/ons-demo/README.txt b/web/ons-demo/README.txt
new file mode 100644
index 0000000..2807fec
--- /dev/null
+++ b/web/ons-demo/README.txt
@@ -0,0 +1,5 @@
+from main web directory
+
+ python ./restapi2.py
+
+http://localhost:9000/ons-demo/index.html
\ No newline at end of file
diff --git a/web/ons-demo/RELEASE_NOTES.txt b/web/ons-demo/RELEASE_NOTES.txt
new file mode 100644
index 0000000..19d5e58
--- /dev/null
+++ b/web/ons-demo/RELEASE_NOTES.txt
@@ -0,0 +1,121 @@
+** April 12, 2013 **
+- fixed bug in iperf fetch
+- improved iperf logging
+
+** April 11, 2013 **
+- Use timestamps for iperf display
+This elimates spurious gaps when server responds slowly. However, gaps still appear if the server drops buffers entirely
+- Add "K" action for killing a controller
+
+** April 9, 2013 **
+- display number of flows for each core<->core link
+- graphics tweaks
+
+** April 8, 2013 **
+- map view
+- onos nodes at top
+- count only active switches in header
+- hook up switchctrl all and local actions
+- various small ui improvements (hover feedback, flow chooser animation e.g.)
+- splash screen and use vector graphics for on.lab logo
+- only show "marching ants" animation when iperf data is flowing
+- NOTE: the map view dynamically sizes with browser resize. so no need to refresh after resizing anymore
+
+
+** April 8, 2013 **
+- add explicit timeout logic so that the GUI doesn't have to be refreshed if the API misbehaves
+
+** April 8, 2013 **
+- merge from master
+- fix gradually increasing latency of iperf data display
+
+** April 4, 2013 **
+- denser iperf display
+- don't pop alert on command error response. just log it
+
+** April 4, 2013 **
+iperf display implemented
+- scaled to 50,000,000
+- update rate is every 2s
+- the display does not draw until receiving 2 buffers of data (this way if there is a stale buffer it doesn't get displayed)
+- duration is 10000 seconds. seems like there is no need for a button to restart?
+- displaying 10s data
+- if the data underruns (either because the server response is too slow or because the iperf data stops being updated) the display draws 0s
+- seeing the data stall a lot (timestamp and end-time remain the same through many fetches)
+
+** April 4, 2013 **
+Fix issues:
+ 305 - "close x" now unselects flow. double click to delete a flow
+ 323 - gui now recovers on timeout errors and polls again
+ 324 - fixed problem with added flows not displaying
+ 325 - fixed logic displaying flows in topology view
+
+** March 28, 2013 **
+- add and delete flow implemented
+- to add flow
+ - mouse down in src edge switch
+ - drag to dst edge switch
+ - release/confirm to create flow
+- to delete flow
+ - select flow in flow chooser
+ - click "close" button in flow table
+ - confirm
+- same "pending" style as other actions
+
+** March 28, 2013 **
+- basic flow chooser
+ - click in "eye" to show full list
+ - click on "eye" in full list to monitor that flow in the top slot (and show the flow in topology)
+ - other flows get pushed down one slot
+ - when a flow is pushed off the list, it is no longer displayed in topology
+- bug fix for link disappearing after being added
+- color improvements
+- draw vector while linking to make it clearer what's going to happen
+
+** March 27, 2013 **
+- click onos node "eye" icon to highlight switches associated with that controller
+- double click onos node else where to activate/deactivate
+- double click core switch to activate/deactivate
+- mouse down on switch, drag to other switch, mouse up to make link up/down
+ allowed links are
+ aggregation->core (link up/down)
+ core->core (link up/down)
+- pending states for links, switches and controllers after executing command
+ object pulses until state change or timeout (12s)
+- merge from upstream/master
+
+** March 25, 2013 **
+- First pass at flow chooser
+ - Uses mock data
+ - Select flow to show the flow in topology view
+ - Selected flow currently always shows "marching ants" Once iperf is setup the movement will only be when there is iperf traffic
+ - Still need to do popup flow chooser to "monitor" flows in the flow panel
+
+** March 23, 2013 **
+- Link and switch state updates dynamically
+- Link direction is indicated with arrow heads
+
+** March 22, 2013 **
+- Workarounds for Chrome v25 rendering bugs
+- Fixed broken proxy functionality in restapi2.py
+- webui should now work when hosted from a different server than the controller (where it uses gui3.onlab.us:8080) and also when run from the same server (where it uses localhost:8080)
+
+** March 20, 2013 **
+- URL parameters control functions as follows:
+ http://localhost:9000/ons-demo/index.html
+ uses the ONOS_HOST defined in restapi2.py. currently http://gui3.onlab.us:8080
+ http://localhost:9000/ons-demo/index.html?proxy
+ uses the index.html host to proxy to ONOS_HOST (works around cross site scripting restrictions to allow the WebUI to be served from a different server than the one that hosts the controller)
+ http://localhost:9000/ons-demo/index.html?mock
+ uses the mock JSON responses under ons-dmo/data
+- clicking a controller behavior change
+ 1) if all controllers are selected, deselects all controllers except the one clicked
+ 2) if only the clicked controller is selected, selects all controllers again
+- Update configuration files to match test bed
+- Update sample JSON files from test bed
+
+** March 19, 2013 **
+- aggregation switch sample data DPIDs do not match official switch config.
+ - switch config hacked 00:00:00:00:00:00:01:01 ==> 00:00:00:00:00:00:01:00 etc.
+- layout does not dynamically adjust when window is resized
+ - refresh browser window after resizing to fix layout
diff --git a/web/ons-demo/assets/black-eye.svg b/web/ons-demo/assets/black-eye.svg
new file mode 100644
index 0000000..73596c2
--- /dev/null
+++ b/web/ons-demo/assets/black-eye.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<g>
+ <path d="M506.637,242.501c-5.362-6.347-11.263-12.33-17.171-18.193c-31.897-31.679-68.549-59.921-108.648-80.411
+ c-25.618-13.08-53.038-23.655-81.451-28.721c-14.453-2.586-28.617-3.912-43.474-3.938c-14.447,0.025-28.908,1.353-43.361,3.938
+ c-28.412,5.065-55.775,15.641-81.393,28.721c-40.102,20.489-76.724,48.733-108.622,80.411
+ c-5.909,5.862-11.794,11.847-17.155,18.193c-7.147,8.484-7.147,18.515,0,27c16.344,19.353,35.774,36.575,55.542,52.321
+ c42.57,33.915,91.25,62.278,144.993,73.711c16.621,3.524,33.299,5.244,49.998,5.228c16.904,0.018,33.488-1.702,50.107-5.228
+ c53.744-11.433,102.534-39.796,145.104-73.711c19.768-15.745,39.194-32.969,55.538-52.321
+ C513.79,261.018,513.783,250.987,506.637,242.501z M255.892,354.552c-54.334-0.104-98.348-44.177-98.348-98.554
+ c0-54.351,44.014-98.438,98.348-98.543c54.809,0.104,98.347,44.192,98.347,98.543C354.24,310.374,310.701,354.445,255.892,354.552z
+ "/>
+ <path d="M255.86,217.881c-21.06,0-38.106,17.059-38.106,38.115c0,21.068,17.047,38.123,38.106,38.123
+ c21.058,0,38.124-17.055,38.124-38.123C293.984,234.94,276.917,217.881,255.86,217.881z"/>
+</g>
+</svg>
diff --git a/web/ons-demo/assets/delete.svg b/web/ons-demo/assets/delete.svg
new file mode 100644
index 0000000..a32a278
--- /dev/null
+++ b/web/ons-demo/assets/delete.svg
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="283.465px"
+ height="283.465px"
+ viewBox="0 0 283.465 283.465"
+ enable-background="new 0 0 283.465 283.465"
+ xml:space="preserve"
+ inkscape:version="0.48.0 r9654"
+ sodipodi:docname="delete.svg"><metadata
+ id="metadata9"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs7" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="721"
+ inkscape:window-height="480"
+ id="namedview5"
+ showgrid="false"
+ inkscape:zoom="0.92427638"
+ inkscape:cx="141.7325"
+ inkscape:cy="141.7325"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Layer_1" />
+<path
+ fill="#772953"
+ d="M141.733,198.425c-15.143,0-29.38-5.897-40.088-16.605c-10.708-10.708-16.605-24.945-16.605-40.088 c0-15.142,5.897-29.378,16.605-40.086c10.708-10.708,24.945-16.605,40.088-16.605c15.142,0,29.379,5.896,40.087,16.604 c10.708,10.708,16.605,24.946,16.605,40.089c0,15.143-5.897,29.381-16.605,40.088C171.112,192.528,156.875,198.425,141.733,198.425 L141.733,198.425z M141.733,99.213c-11.357,0-22.035,4.423-30.067,12.454c-8.031,8.031-12.454,18.708-12.454,30.064 c0,11.357,4.423,22.035,12.454,30.065c8.032,8.031,18.709,12.455,30.067,12.455c11.356,0,22.034-4.423,30.064-12.453 c8.031-8.03,12.455-18.709,12.455-30.066s-4.424-22.036-12.455-30.067C163.768,103.636,153.09,99.213,141.733,99.213L141.733,99.213 z M151.703,141.79l10.021-10.022c2.768-2.768,2.768-7.254,0-10.021c-2.767-2.767-7.255-2.767-10.021,0l-10.022,10.021 l-10.021-10.021c-2.767-2.767-7.255-2.767-10.022,0c-2.768,2.768-2.768,7.254,0,10.021l10.022,10.022l-10.023,10.023 c-2.768,2.768-2.768,7.254,0,10.021c1.383,1.384,3.197,2.076,5.011,2.076c1.813,0,3.627-0.692,5.011-2.076l10.023-10.023 l10.022,10.021c1.383,1.384,3.197,2.076,5.011,2.076s3.627-0.692,5.011-2.076c2.768-2.768,2.768-7.254,0-10.021L151.703,141.79z"
+ id="path3"
+ style="fill:#ffffff;fill-opacity:1" />
+</svg>
\ No newline at end of file
diff --git a/web/ons-demo/assets/logo.svg b/web/ons-demo/assets/logo.svg
new file mode 100644
index 0000000..373e072
--- /dev/null
+++ b/web/ons-demo/assets/logo.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg3166"
+ version="1.1"
+ inkscape:version="0.48.0 r9654"
+ width="236.41251"
+ height="60.909126"
+ xml:space="preserve"
+ sodipodi:docname="logo.svg"><metadata
+ id="metadata3172"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs3170"><clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath3182"><path
+ d="M 0,327.273 0,0 l 1731.3,0 0,327.273 -1731.3,0 z"
+ id="path3184"
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1158"
+ inkscape:window-height="739"
+ id="namedview3168"
+ showgrid="false"
+ inkscape:zoom="0.26464646"
+ inkscape:cx="124.21755"
+ inkscape:cy="40.229009"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g3174"
+ fit-margin-top="10"
+ fit-margin-left="10"
+ fit-margin-right="10"
+ fit-margin-bottom="10" /><g
+ id="g3174"
+ inkscape:groupmode="layer"
+ inkscape:label="ink_ext_XXXXXX"
+ transform="matrix(1.25,0,0,-1.25,-258.28245,515.68011)"><g
+ id="g3176"
+ transform="matrix(0.1,0,0,0.1,214.62596,371.81679)"><g
+ id="g3178"><g
+ id="g3180"
+ clip-path="url(#clipPath3182)"><path
+ d="m 164.363,70.2617 c -58.078,0 -101.8982,42.3673 -101.8982,98.5503 0,34.516 21.5743,99.797 103.1802,99.797 70.007,0 101.507,-57.371 101.507,-98.113 0,-23.973 -10.742,-52.461 -26.117,-69.277 C 223.723,82.4297 193.609,70.2617 164.363,70.2617 z m -0.41,257.0113 C 56.3242,327.273 0,247.559 0,168.812 0,79.4414 69.5664,12.0312 161.848,12.0312 c 96.941,0 167.328,66.4727 167.328,158.0508 0,76.203 -57.903,157.191 -165.223,157.191"
+ style="fill:#325cb3;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3186"
+ inkscape:connector-curvature="0" /><path
+ d="m 656.363,323.477 -9.922,0 0,-206.633 -176.695,203.222 -2.965,3.411 -47.797,0 0,-307.6372 58.684,0 0,204.9182 175.043,-201.5002 2.937,-3.418 49.895,0 0,307.6372 -49.18,0"
+ style="fill:#204476;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3188"
+ inkscape:connector-curvature="0" /><path
+ d="m 925.344,59.7148 0,265.7772 -64.188,0 0,-325.492 201.784,0 0,59.7148 -137.596,0"
+ style="fill:#461f35;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3190"
+ inkscape:connector-curvature="0" /><path
+ d="m 1308.12,149.355 -64.91,0 31.25,75.622 33.66,-75.622 z m -8.81,172.036 -2.6,5.882 -43.93,0 -2.57,-6.027 L 1118.88,13.8164 1112.98,0 l 66.39,0 2.59,6.02344 35.94,84.06246 117.03,0 38.15,-84.25778 2.63,-5.82812 66.49,0 -6.19,13.9453 -136.7,307.4457"
+ style="fill:#971a1f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3192"
+ inkscape:connector-curvature="0" /><path
+ d="m 1621.32,200.641 c -6.74,-3.907 -19.94,-6.028 -36.62,-6.028 l -19.2,0 0,72.035 19.2,0 c 12.13,0 28.75,0 39.33,-4.902 9.69,-4.523 15.73,-15.676 15.73,-29.09 0,-20.129 -12.91,-29.097 -18.44,-32.015 z m -22.25,-141.8246 -33.57,0 0,76.5236 31.29,0 c 24.33,0 36.89,-1.485 46.36,-5.488 21.41,-8.817 23.07,-27.129 23.07,-32.5395 0,-11.5195 -6.66,-27.5156 -25.45,-34.6445 -9.61,-3.8516 -30.49,-3.8516 -41.7,-3.8516 z m 74.77,115.7146 c 20.6,14.879 31.03,35.555 31.03,61.699 0,38.442 -21.17,68.29 -58.02,81.911 -16.27,6.117 -32.93,7.351 -54.54,7.351 l -90.11,0 0,-325.492 94.59,0 c 33.47,0 48.75,0 68.28,6.84375 31.97,10.91015 66.23,39.37505 66.23,86.43745 0,36.6488 -21.9,66.7068 -57.46,81.2498"
+ style="fill:#c41e25;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3194"
+ inkscape:connector-curvature="0" /><path
+ d="m 780.367,59.7148 c -16.476,0 -29.863,-13.3984 -29.863,-29.8632 C 750.504,13.3984 763.891,0 780.367,0 c 16.485,0 29.863,13.3984 29.863,29.8516 0,16.4648 -13.378,29.8632 -29.863,29.8632"
+ style="fill:#461f35;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3196"
+ inkscape:connector-curvature="0" /></g></g></g></g></svg>
\ No newline at end of file
diff --git a/web/ons-demo/assets/switch.svg b/web/ons-demo/assets/switch.svg
new file mode 100644
index 0000000..7a69e98
--- /dev/null
+++ b/web/ons-demo/assets/switch.svg
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ height="60"
+ id="svg6140"
+ inkscape:version="0.48.0 r9654"
+ sodipodi:docname="switch.svg"
+ sodipodi:version="0.32"
+ width="60"
+ version="1.1">
+ <metadata
+ id="metadata4412">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:title>switch</dc:title>
+ <dc:description />
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>symbol</rdf:li>
+ <rdf:li>network</rdf:li>
+ <rdf:li>switch</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <dc:publisher>
+ <cc:Agent
+ rdf:about="http://www.openclipart.org/">
+ <dc:title>Open Clip Art Library</dc:title>
+ </cc:Agent>
+ </dc:publisher>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Angelis</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:rights>
+ <cc:Agent>
+ <dc:title>Jakub Angelis</dc:title>
+ </cc:Agent>
+ </dc:rights>
+ <dc:date />
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://web.resource.org/cc/PublicDomain" />
+ <dc:language>en</dc:language>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://web.resource.org/cc/PublicDomain">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ bordercolor="#666666"
+ borderopacity="1.0"
+ id="namedview6144"
+ inkscape:current-layer="layer1"
+ inkscape:cx="-65.089664"
+ inkscape:cy="-73.508205"
+ inkscape:document-units="mm"
+ inkscape:guide-bbox="true"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:window-height="746"
+ inkscape:window-width="1028"
+ inkscape:window-x="-4"
+ inkscape:window-y="0"
+ inkscape:zoom="1"
+ pagecolor="#ffffff"
+ showguides="false"
+ showgrid="false"
+ inkscape:window-maximized="0"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ showborder="false"
+ inkscape:showpageshadow="false" />
+ <g
+ id="layer1"
+ inkscape:groupmode="layer"
+ inkscape:label="Layer 1"
+ transform="translate(-350.71012,-251.97973)">
+ <rect
+ height="18.093575"
+ id="rect1944"
+ width="48.643852"
+ x="350.85608"
+ y="293.55972" />
+ <rect
+ height="18.093575"
+ id="rect1946"
+ transform="matrix(0.20031099,-0.97973237,0,1,0,0)"
+ width="38.694553"
+ x="1994.4028"
+ y="2247.5422" />
+ <g
+ id="g9312"
+ transform="matrix(0.1641042,0,0,0.35267689,231.88841,175.74726)">
+ <path
+ d="m 772.21875,226.4375 -47.34375,107.625 296.5,0 47.3438,-107.625 -296.50005,0 z"
+ id="path4749"
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g9298">
+ <g
+ id="g9282">
+ <path
+ d="m 772.66454,271.72258 40.19422,-18.1307"
+ id="path7440"
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 807.7045,264.2106 92.50521,-0.0884"
+ id="path7442"
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g9294">
+ <path
+ d="m 913.2487,258.25739 6.36742,-14.48613 92.16548,-0.0165 4.1023,-9.59965 22.5745,16.94194"
+ id="path7444"
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 1003.8684,257.40378 -4.4934,10.25247 4.4915,-2.05647 0,-8.196 z"
+ id="path7446"
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g9286">
+ <path
+ d="m 754.65476,312.558 40.38172,-18.16195"
+ id="path9238"
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 789.69472,304.95227 92.50521,0.005"
+ id="path9240"
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g9290">
+ <path
+ d="m 895.23892,299.09281 6.36742,-14.48613 92.16548,-0.0165 4.1023,-9.59965 22.57448,16.94194"
+ id="path9242"
+ sodipodi:nodetypes="ccccc"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 985.85862,298.2392 -4.4934,10.25247 4.4915,-1.83772 0.002,-8.41475 z"
+ id="path9244"
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <path
+ d="m 772.21875,226.4375 -47.34375,107.625 296.5,0 47.3438,-107.625 -296.50005,0 z m 243.00005,5.1875 24.2187,18.0625 -40.03125,17.90625 4.46875,-10.1875 -92.1875,0 6.75,-15.40625 92.2188,0 4.5625,-10.375 z m -203.06255,20.40625 -4.53125,10.375 92.1875,0 -6.78125,15.40625 -92.1875,0 -4.5,10.1875 -24.28125,-17.90625 40.09375,-18.0625 z m 185.09375,20.4375 24.2188,18.0625 -40.0313,17.90625 4.46875,-10.21875 -92.1875,0 6.78125,-15.40625 92.1875,0 4.5625,-10.34375 z m -203.03125,20.40625 -4.5625,10.34375 92.1875,0 -6.75,15.4375 -92.21875,0 -4.46875,10.1875 -24.3125,-17.90625 40.125,-18.0625 z"
+ id="rect1948"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ d="m 350.85884,293.2658 -0.14872,0.3086 0,18.09675 0.14872,0.30858 48.62613,0 0.14359,-0.30858 0,-18.09675 -0.14359,-0.3086 -48.62613,0 z m 0.14359,0.62824 48.33382,0 0,17.45751 -48.33382,0 0,-17.45751 z m 7.5129,-38.60712 -0.041,0.18736 -7.71291,37.78051 0.26668,0.25349 7.677,-37.59317 48.41074,0.0111 -0.0154,17.76613 -7.74367,37.74742 0.26668,0.2535 7.75906,-37.82461 0.0103,-0.0662 0,-0.0662 0.0103,-18.43839 -48.79537,-0.0111 -0.0923,0 z m 48.61074,0.12122 -7.81033,38.22137 0.26666,0.25347 7.81035,-38.22133 -0.26668,-0.25351 z"
+ id="rect10242"
+ sodipodi:nodetypes="cccccccccccccccccccccccccccccccccc"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/web/ons-demo/assets/white-eye.svg b/web/ons-demo/assets/white-eye.svg
new file mode 100644
index 0000000..8f3b180
--- /dev/null
+++ b/web/ons-demo/assets/white-eye.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="512"
+ height="512"
+ viewBox="0 0 512 512"
+ id="Layer_1"
+ xml:space="preserve"><metadata
+ id="metadata13"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs11" />
+<g
+ id="g3"
+ style="fill:#ffffff;fill-opacity:1">
+ <path
+ d="m 506.637,242.501 c -5.362,-6.347 -11.263,-12.33 -17.171,-18.193 -31.897,-31.679 -68.549,-59.921 -108.648,-80.411 -25.618,-13.08 -53.038,-23.655 -81.451,-28.721 -14.453,-2.586 -28.617,-3.912 -43.474,-3.938 -14.447,0.025 -28.908,1.353 -43.361,3.938 -28.412,5.065 -55.775,15.641 -81.393,28.721 -40.102,20.489 -76.724,48.733 -108.622,80.411 -5.909,5.862 -11.794,11.847 -17.155,18.193 -7.147,8.484 -7.147,18.515 0,27 16.344,19.353 35.774,36.575 55.542,52.321 42.57,33.915 91.25,62.278 144.993,73.711 16.621,3.524 33.299,5.244 49.998,5.228 16.904,0.018 33.488,-1.702 50.107,-5.228 53.744,-11.433 102.534,-39.796 145.104,-73.711 19.768,-15.745 39.194,-32.969 55.538,-52.321 7.146,-8.483 7.139,-18.514 -0.007,-27 z M 255.892,354.552 c -54.334,-0.104 -98.348,-44.177 -98.348,-98.554 0,-54.351 44.014,-98.438 98.348,-98.543 54.809,0.104 98.347,44.192 98.347,98.543 0.001,54.376 -43.538,98.447 -98.347,98.554 z"
+ id="path5"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 255.86,217.881 c -21.06,0 -38.106,17.059 -38.106,38.115 0,21.068 17.047,38.123 38.106,38.123 21.058,0 38.124,-17.055 38.124,-38.123 0,-21.056 -17.067,-38.115 -38.124,-38.115 z"
+ id="path7"
+ style="fill:#ffffff;fill-opacity:1" />
+</g>
+</svg>
\ No newline at end of file
diff --git a/web/ons-demo/css/layout.default.css b/web/ons-demo/css/layout.default.css
new file mode 100644
index 0000000..f3daf04
--- /dev/null
+++ b/web/ons-demo/css/layout.default.css
@@ -0,0 +1,162 @@
+html, body {
+ height: 100%;
+}
+
+body {
+ display: -webkit-box;
+ -webkit-user-select: none;
+}
+
+#background, #background-image {
+ width: 100%;
+ height: 100%;
+}
+
+#contents {
+ width: 100%;
+ height: 100%;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+}
+
+#columns {
+ display: -webkit-box;
+ -webkit-box-flex: 1.0;
+}
+
+#confirm {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 100%;
+ height: 100%;
+ display: -webkit-box;
+ -webkit-box-align: center;
+ -webkit-box-pack: center;
+}
+
+#confirm-background {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+#confirm-panel {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-box-pack: justify;
+}
+
+#confirm-buttons {
+ display: -webkit-box;
+ -webkit-box-pack: center;
+ -webkit-box-flex: 1.0;
+ -webkit-box-align: center;
+}
+
+.header {
+ width: 100%;
+ display: -webkit-box;
+ -webkit-box-pack: justify;
+ -webkit-box-align: center;
+}
+
+#status {
+ display: -webkit-box;
+ -webkit-box-flex: 1.0;
+}
+
+#left, #right {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+}
+
+#right {
+ width: 100%;
+ -webkit-box-flex: 1.0;
+}
+
+#topologyArea {
+ -webkit-box-flex: 1.0;
+ position: relative;
+}
+
+#selectedFlows {
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+}
+
+#flowChooser {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ height: 100%;
+ display: -webkit-box;
+ overflow: scroll;
+}
+
+.selectedFlow {
+ display: -webkit-box;
+ position: relative;
+}
+
+#showFlowChooser {
+ position: relative;
+ display: -webkit-box;
+ -webkit-box-pack: center;
+}
+
+.selectedFlow .srcDPID, .selectedFlow .dstDPID {
+ -webkit-user-select: auto;
+}
+
+#selectedFlowsHeader {
+ display: -webkit-box;
+ height: 1.5em;
+}
+
+.iperf {
+ width: 100%;
+ -webkit-box-flex: 1.0;
+ position: relative;
+ display: -webkit-box;
+}
+
+.iperf-container {
+ position: absolute;
+ top: 0px;
+ height: 100%;
+ width: 100%;
+}
+
+#onos {
+ display: -webkit-box;
+}
+
+#actions {
+ display: -webkit-box;
+}
+
+#controllers {
+ display: -webkit-box;
+ overflow: scroll;
+ -webkit-box-flex: 1.0;
+}
+
+.controller {
+ margin: .25em;
+ background-color: blue;
+ -webkit-box-flex: 1.0;
+}
+
+#svg-container {
+ position: absolute;
+ top: 0px;
+ height: 100%;
+ width: 100%;
+}
diff --git a/web/ons-demo/css/skin.default.css b/web/ons-demo/css/skin.default.css
new file mode 100644
index 0000000..b860f1d
--- /dev/null
+++ b/web/ons-demo/css/skin.default.css
@@ -0,0 +1,559 @@
+
+body {
+ background-color: black;
+ color: white;
+ font-family: Helvetica;
+ margin: 0px;
+}
+
+#contents {
+ visibility: hidden;
+ background-color: black;
+}
+
+#topologyArea.linking {
+ cursor: crosshair;
+}
+
+
+#map path {
+ fill:none;
+ stroke:#333;
+ stroke-width:2;
+}
+
+.nodrop {
+ cursor: not-allowed;
+}
+
+.status {
+ padding: 1em;
+}
+
+
+.status:last-child {
+ border-right: none;
+}
+
+.status .static {
+ color: #AAA;
+ padding: .25em;
+}
+
+.status .dynamic {
+ color: #FFF;
+ padding: .25em;
+}
+
+#status span {
+ font-size: 24px;
+}
+
+.button {
+ padding: 1em;
+ background-color: lightgray;
+ color: black;
+ border: 1px solid #AAA;
+}
+
+#arrow {
+ stroke: none;
+ fill: rgba(255, 255, 255, .35);
+}
+
+.header {
+ height: 50px;
+}
+
+.selectedFlow {
+ border-bottom: 1px solid #AAA;
+}
+
+.selectedFlow:hover {
+ background-color: #222;
+}
+
+.selectedFlow:last-child {
+ border-bottom: none;
+}
+
+#flowChooser .selectedFlow:hover {
+ background-color: white;
+}
+
+#lastUpdated {
+ padding-bottom: 0px;
+}
+
+#right .header {
+ font-size: 12px;
+ padding-right: .25em;
+ -webkit-box-sizing: border-box;
+}
+
+#selectedFlows {
+ border-top: 1px solid #AAA;
+ border-bottom: 1px solid #AAA;
+}
+
+.selectedFlow {
+ height: 2em;
+ color: white;
+ background-color: black;
+}
+
+.header, #onos {
+ border-bottom: 1px solid #AAA;;
+}
+
+#onos {
+ background-color: #333;
+}
+
+#cluster-label {
+ font-size: 22px;
+ display: -webkit-box;
+ -webkit-box-align: center;
+ padding-left: .5em;
+ padding-right: .5em;
+ color: #EEE;
+}
+
+#actions {
+ padding-right: .25em;
+ padding-left: .25em;
+ padding-top: .25em;
+ padding-bottom: .25em;
+ border-left: 1px solid white;
+ display: -webkit-box;
+ -webkit-box-align: center;
+ -webkit-box-orient: vertical;
+ -webkit-box-pack: center;
+}
+
+#controllers {
+ padding: .25em;
+ background-color: black;
+ margin: .25em;
+ border-radius: 8px;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-align: center;
+}
+
+#flowChooser .selectedFlow {
+ background-color: rgba(255, 255, 255, .75);
+ color: black;
+}
+
+#flowChooser .flowId {
+ padding-left: 2em;
+}
+
+
+.selectedFlow.selected {
+ color: black;
+ background-color:#AAA;
+}
+
+.highlight circle {
+ stroke: rgba(255, 255, 255, .5);
+ stroke-width: 2px;
+}
+
+#linkVector {
+ fill: none;
+ stroke-width: 1px;
+ stroke: rgba(255, 255, 255, .75);
+ pointer-events: none;
+}
+
+path {
+ pointer-events: none;
+}
+
+path.flow {
+ fill: none;
+ stroke-width: 10px;
+ stroke: rgba(255, 255, 255, .35);
+}
+
+path.flow.highlight {
+ stroke-width: 16px;
+ stroke: rgba(255, 255, 255, .75);
+}
+
+#selectedFlowsHeader {
+ border-top: 1px solid #AAA;
+}
+
+path.iperfdata {
+ fill: none;
+ stroke-width: 1px;
+ stroke: #ccc;
+}
+
+.iperf {
+ background-color: black;
+}
+
+#selectedFlowsHeader .iperf {
+ background-color: black;
+}
+
+#flowChooser {
+ pointer-events: none;
+ background-color: rgba(0, 0, 0, .25);
+}
+
+
+.flowId, .srcDPID, .dstDPID, .iperf, #deleteFlow, .deleteFlow {
+ display: -webkit-box;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
+ width: 4em;
+}
+
+
+.srcDPID, .dstDPID {
+ width: 12em;
+}
+
+
+.srcDPID, .dstDPID, .deleteFlow, #showFlowChooser {
+ border-right: 1px solid #AAA;
+}
+
+#showFlowChooser:hover, .deleteFlow:hover {
+ background-color: #444;
+}
+
+#showFlowChooser:active, .deleteFlow:active {
+ background-color: black;
+}
+
+.srcDPID {
+ border-left: 1px solid #AAA;
+}
+
+.controller {
+ padding: .25em;
+ padding-left: 2.5em;
+ position: relative;
+ height: 1.5em;
+ border: 1px solid #444;
+ color: white;
+ position: relative;
+ border-radius: 8px;
+ display: -webkit-box;
+ -webkit-box-align: center;
+}
+
+.controller:hover {
+ border: 1px solid white;
+}
+
+.controller {
+ font-size: 18px;
+}
+
+
+.black-eye {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ height: 100%;
+ width: 2.25em;
+ background-image: url('../assets/black-eye.svg');
+ background-size: auto 100%;
+ background-repeat: no-repeat;
+ background-position: .25em center;
+}
+
+.white-eye {
+ height: 100%;
+ width: 2.25em;
+ background-image: url('../assets/white-eye.svg');
+ background-size: auto 100%;
+ background-repeat: no-repeat;
+ background-position: .4em center;
+}
+
+.deleteFlow {
+ height: 100%;
+ background-image: url('../assets/delete.svg');
+ background-size: auto 150%;
+ background-repeat: no-repeat;
+ background-position: center;
+}
+
+#logo {
+ height: 50px;
+}
+
+.edge {
+ stroke: black;
+ stroke-width: 1.5px;
+}
+
+.nolabel text {
+ display: none;
+}
+
+text {
+ stroke: none;
+ fill: white;
+ font-size: 28px;
+ pointer-events: none;
+}
+
+text.label {
+ fill: #888;
+}
+
+path {
+ stroke: rgba(255, 255, 255, .25);
+ stroke-width: 1.5px;
+}
+
+.aggregation {
+ stroke: black;
+ stroke-width: 2px;
+}
+
+#traceButton {
+ visibility: hidden
+}
+
+.color1-selected .color1,
+.color2-selected .color2,
+.color3-selected .color3,
+.color4-selected .color4,
+.color5-selected .color5,
+.color6-selected .color6,
+.color7-selected .color7,
+.color8-selected .color8,
+.color9-selected .color9,
+.color10-selected .color10,
+.color11-selected .color11,
+.color12-selected .color12 {
+ opacity: 1;
+ pointer-events: auto;
+}
+
+.colorInactive {
+ opacity: 1;
+ fill: #444;
+ background-color: #444;
+ color: #222;
+}
+
+.color1 {
+ opacity: .15;
+ pointer-events: none;
+ fill: #FF0000;
+ background-color: #FF0000;
+}
+
+.color2 {
+ opacity: .15;
+ pointer-events: none;
+ fill: #FFBA00;
+ background-color: #FFBA00;
+}
+
+.color3 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #3714B0;
+ background-color: #3714B0;
+}
+
+.color4 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #800080;
+ background-color: #800080;
+}
+
+.color5 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #402C84;
+ background-color: #402C84;
+}
+
+.color6 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #5555FF;
+ background-color: #2222FF;
+}
+
+.color7 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #5555FF;
+ background-color: #2222FF;
+}
+
+.color8 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #A0522D;
+ background-color: #A0522D;
+}
+
+.color9 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #66CDAA;
+ background-color: #66CDAA;
+}
+
+.color10 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #FFA500;
+ background-color: #FFA500;
+}
+
+.color11 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #FFA500;
+ background-color: #FFA500;
+}
+
+.color12 {
+ opacity: .2;
+ pointer-events: none;
+ fill: #FF69B4;
+ background-color: #FF69B4;
+}
+
+.action {
+ margin: .1em;
+ border: 2px solid #AAA;
+ height: 1.5em;
+ width: 5em;
+ font-size: 9px;
+ background-color: #444;
+ display: -webkit-box;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
+ color: #AAA;
+ border-radius: 0%;
+ -webkit-box-sizing: border-box;
+}
+
+.action:hover {
+ border: 2px solid #FFF;
+ color: white;
+}
+
+.action:active {
+ background-color: #222;
+}
+
+
+@-webkit-keyframes pending {
+ from {
+ opacity: 1.0;
+ }
+ to {
+ opacity: 0.5;
+ }
+}
+
+.pending {
+ -webkit-animation-name: pending;
+ -webkit-animation-duration: .5s;
+ -webkit-animation-direction: alternate;
+ -webkit-animation-timing-function: ease-in-out;
+ -webkit-animation-iteration-count: 70;
+}
+
+.core path {
+ stroke-width: 1px;
+ stroke: black;
+}
+
+.flowCount {
+ font-size: 32px;
+ fill: rgba(255, 255, 255, .99);
+}
+
+#confirm {
+ display: none;
+ -webkit-transition: opacity .25s;
+ font-size: 20px;
+}
+
+#confirm-background {
+ background-color: black;
+ opacity: .5;
+}
+
+#confirm-prompt {
+ display: -webkit-box;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
+ -webkit-box-flex: 1.0;
+ text-align: center;
+}
+
+#confirm-buttons {
+ padding: 1em;
+}
+
+#confirm-prompt {
+ margin-top:1em;
+ line-height: 1.5em;
+}
+
+#confirm-panel {
+ position: relative;
+ background-color: #222;
+ border: 2px solid #aaa;
+ border-radius: 12px;
+ width: 20em;
+ padding: 1em;
+}
+
+.confirm-button {
+ padding: .5em;
+ border: 2px solid #aaa;
+ color: #aaa;
+ border-radius: 6px;
+ margin-left: .5em;
+ margin-right: .5em;
+}
+
+.confirm-button:hover{
+ border: 2px solid white;
+ color: white;
+}
+
+.confirm-button:active{
+ background-color: black;
+}
+
+select {
+ margin-top: 1em;
+ -webkit-appearance: none;
+ border-radius: 0px;
+ font-size: 18px;
+ padding: .5em;
+ background-color: black;
+ color: white;
+ border: 1px solid white;
+}
+
+select:after {
+ content: 'a';
+ position: absolute;
+ right: 0px;
+ top: 0px;
+}
+
diff --git a/web/ons-demo/d3/d3.v3.js b/web/ons-demo/d3/d3.v3.js
new file mode 100644
index 0000000..3726652
--- /dev/null
+++ b/web/ons-demo/d3/d3.v3.js
@@ -0,0 +1,7801 @@
+d3 = function() {
+ var π = Math.PI, ε = 1e-6, d3 = {
+ version: "3.0.8"
+ }, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window;
+ function d3_target(d) {
+ return d.target;
+ }
+ function d3_source(d) {
+ return d.source;
+ }
+ var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ];
+ if (!Date.now) Date.now = function() {
+ return +new Date();
+ };
+ try {
+ d3_document.createElement("div").style.setProperty("opacity", 0, "");
+ } catch (error) {
+ var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
+ d3_style_prototype.setProperty = function(name, value, priority) {
+ d3_style_setProperty.call(this, name, value + "", priority);
+ };
+ }
+ function d3_class(ctor, properties) {
+ try {
+ for (var key in properties) {
+ Object.defineProperty(ctor.prototype, key, {
+ value: properties[key],
+ enumerable: false
+ });
+ }
+ } catch (e) {
+ ctor.prototype = properties;
+ }
+ }
+ var d3_array = d3_arraySlice;
+ function d3_arrayCopy(pseudoarray) {
+ var i = -1, n = pseudoarray.length, array = [];
+ while (++i < n) array.push(pseudoarray[i]);
+ return array;
+ }
+ function d3_arraySlice(pseudoarray) {
+ return Array.prototype.slice.call(pseudoarray);
+ }
+ try {
+ d3_array(d3_document.documentElement.childNodes)[0].nodeType;
+ } catch (e) {
+ d3_array = d3_arrayCopy;
+ }
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
+ array.__proto__ = prototype;
+ } : function(array, prototype) {
+ for (var property in prototype) array[property] = prototype[property];
+ };
+ d3.map = function(object) {
+ var map = new d3_Map();
+ for (var key in object) map.set(key, object[key]);
+ return map;
+ };
+ function d3_Map() {}
+ d3_class(d3_Map, {
+ has: function(key) {
+ return d3_map_prefix + key in this;
+ },
+ get: function(key) {
+ return this[d3_map_prefix + key];
+ },
+ set: function(key, value) {
+ return this[d3_map_prefix + key] = value;
+ },
+ remove: function(key) {
+ key = d3_map_prefix + key;
+ return key in this && delete this[key];
+ },
+ keys: function() {
+ var keys = [];
+ this.forEach(function(key) {
+ keys.push(key);
+ });
+ return keys;
+ },
+ values: function() {
+ var values = [];
+ this.forEach(function(key, value) {
+ values.push(value);
+ });
+ return values;
+ },
+ entries: function() {
+ var entries = [];
+ this.forEach(function(key, value) {
+ entries.push({
+ key: key,
+ value: value
+ });
+ });
+ return entries;
+ },
+ forEach: function(f) {
+ for (var key in this) {
+ if (key.charCodeAt(0) === d3_map_prefixCode) {
+ f.call(this, key.substring(1), this[key]);
+ }
+ }
+ }
+ });
+ var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
+ function d3_identity(d) {
+ return d;
+ }
+ function d3_true() {
+ return true;
+ }
+ function d3_functor(v) {
+ return typeof v === "function" ? v : function() {
+ return v;
+ };
+ }
+ d3.functor = d3_functor;
+ d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+ };
+ function d3_rebind(target, source, method) {
+ return function() {
+ var value = method.apply(source, arguments);
+ return value === source ? target : value;
+ };
+ }
+ d3.ascending = function(a, b) {
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
+ };
+ d3.descending = function(a, b) {
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
+ };
+ d3.mean = function(array, f) {
+ var n = array.length, a, m = 0, i = -1, j = 0;
+ if (arguments.length === 1) {
+ while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
+ } else {
+ while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
+ }
+ return j ? m : undefined;
+ };
+ d3.median = function(array, f) {
+ if (arguments.length > 1) array = array.map(f);
+ array = array.filter(d3_number);
+ return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
+ };
+ d3.min = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && a > b) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
+ }
+ return a;
+ };
+ d3.max = function(array, f) {
+ var i = -1, n = array.length, a, b;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = array[i]) != null && b > a) a = b;
+ } else {
+ while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
+ }
+ return a;
+ };
+ d3.extent = function(array, f) {
+ var i = -1, n = array.length, a, b, c;
+ if (arguments.length === 1) {
+ while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
+ while (++i < n) if ((b = array[i]) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ } else {
+ while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
+ while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
+ if (a > b) a = b;
+ if (c < b) c = b;
+ }
+ }
+ return [ a, c ];
+ };
+ d3.random = {
+ normal: function(µ, σ) {
+ var n = arguments.length;
+ if (n < 2) σ = 1;
+ if (n < 1) µ = 0;
+ return function() {
+ var x, y, r;
+ do {
+ x = Math.random() * 2 - 1;
+ y = Math.random() * 2 - 1;
+ r = x * x + y * y;
+ } while (!r || r > 1);
+ return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
+ };
+ },
+ logNormal: function() {
+ var random = d3.random.normal.apply(d3, arguments);
+ return function() {
+ return Math.exp(random());
+ };
+ },
+ irwinHall: function(m) {
+ return function() {
+ for (var s = 0, j = 0; j < m; j++) s += Math.random();
+ return s / m;
+ };
+ }
+ };
+ function d3_number(x) {
+ return x != null && !isNaN(x);
+ }
+ d3.sum = function(array, f) {
+ var s = 0, n = array.length, a, i = -1;
+ if (arguments.length === 1) {
+ while (++i < n) if (!isNaN(a = +array[i])) s += a;
+ } else {
+ while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
+ }
+ return s;
+ };
+ d3.quantile = function(values, p) {
+ var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
+ return e ? v + e * (values[h] - v) : v;
+ };
+ d3.shuffle = function(array) {
+ var m = array.length, t, i;
+ while (m) {
+ i = Math.random() * m-- | 0;
+ t = array[m], array[m] = array[i], array[i] = t;
+ }
+ return array;
+ };
+ d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+ };
+ d3.zip = function() {
+ if (!(n = arguments.length)) return [];
+ for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
+ for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
+ zip[j] = arguments[j][i];
+ }
+ }
+ return zips;
+ };
+ function d3_zipLength(d) {
+ return d.length;
+ }
+ d3.bisector = function(f) {
+ return {
+ left: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
+ }
+ return lo;
+ },
+ right: function(a, x, lo, hi) {
+ if (arguments.length < 3) lo = 0;
+ if (arguments.length < 4) hi = a.length;
+ while (lo < hi) {
+ var mid = lo + hi >>> 1;
+ if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
+ }
+ return lo;
+ }
+ };
+ };
+ var d3_bisector = d3.bisector(function(d) {
+ return d;
+ });
+ d3.bisectLeft = d3_bisector.left;
+ d3.bisect = d3.bisectRight = d3_bisector.right;
+ d3.nest = function() {
+ var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
+ function map(array, depth) {
+ if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
+ var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map(), values, o = {};
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
+ values.push(object);
+ } else {
+ valuesByKey.set(keyValue, [ object ]);
+ }
+ }
+ valuesByKey.forEach(function(keyValue, values) {
+ o[keyValue] = map(values, depth);
+ });
+ return o;
+ }
+ function entries(map, depth) {
+ if (depth >= keys.length) return map;
+ var a = [], sortKey = sortKeys[depth++], key;
+ for (key in map) {
+ a.push({
+ key: key,
+ values: entries(map[key], depth)
+ });
+ }
+ if (sortKey) a.sort(function(a, b) {
+ return sortKey(a.key, b.key);
+ });
+ return a;
+ }
+ nest.map = function(array) {
+ return map(array, 0);
+ };
+ nest.entries = function(array) {
+ return entries(map(array, 0), 0);
+ };
+ nest.key = function(d) {
+ keys.push(d);
+ return nest;
+ };
+ nest.sortKeys = function(order) {
+ sortKeys[keys.length - 1] = order;
+ return nest;
+ };
+ nest.sortValues = function(order) {
+ sortValues = order;
+ return nest;
+ };
+ nest.rollup = function(f) {
+ rollup = f;
+ return nest;
+ };
+ return nest;
+ };
+ d3.keys = function(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+ };
+ d3.values = function(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+ };
+ d3.entries = function(map) {
+ var entries = [];
+ for (var key in map) entries.push({
+ key: key,
+ value: map[key]
+ });
+ return entries;
+ };
+ d3.permute = function(array, indexes) {
+ var permutes = [], i = -1, n = indexes.length;
+ while (++i < n) permutes[i] = array[indexes[i]];
+ return permutes;
+ };
+ d3.merge = function(arrays) {
+ return Array.prototype.concat.apply([], arrays);
+ };
+ function d3_collapse(s) {
+ return s.trim().replace(/\s+/g, " ");
+ }
+ d3.range = function(start, stop, step) {
+ if (arguments.length < 3) {
+ step = 1;
+ if (arguments.length < 2) {
+ stop = start;
+ start = 0;
+ }
+ }
+ if ((stop - start) / step === Infinity) throw new Error("infinite range");
+ var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
+ start *= k, stop *= k, step *= k;
+ if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
+ return range;
+ };
+ function d3_range_integerScale(x) {
+ var k = 1;
+ while (x * k % 1) k *= 10;
+ return k;
+ }
+ d3.requote = function(s) {
+ return s.replace(d3_requote_re, "\\$&");
+ };
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+ d3.round = function(x, n) {
+ return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
+ };
+ d3.xhr = function(url, mimeType, callback) {
+ var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)();
+ "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
+ request.readyState > 3 && respond();
+ };
+ function respond() {
+ var s = request.status;
+ !s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request);
+ }
+ request.onprogress = function(event) {
+ var o = d3.event;
+ d3.event = event;
+ try {
+ dispatch.progress.call(xhr, request);
+ } finally {
+ d3.event = o;
+ }
+ };
+ xhr.header = function(name, value) {
+ name = (name + "").toLowerCase();
+ if (arguments.length < 2) return headers[name];
+ if (value == null) delete headers[name]; else headers[name] = value + "";
+ return xhr;
+ };
+ xhr.mimeType = function(value) {
+ if (!arguments.length) return mimeType;
+ mimeType = value == null ? null : value + "";
+ return xhr;
+ };
+ xhr.response = function(value) {
+ response = value;
+ return xhr;
+ };
+ [ "get", "post" ].forEach(function(method) {
+ xhr[method] = function() {
+ return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
+ };
+ });
+ xhr.send = function(method, data, callback) {
+ if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
+ request.open(method, url, true);
+ if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
+ if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
+ if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
+ if (callback != null) xhr.on("error", callback).on("load", function(request) {
+ callback(null, request);
+ });
+ request.send(data == null ? null : data);
+ return xhr;
+ };
+ xhr.abort = function() {
+ request.abort();
+ return xhr;
+ };
+ d3.rebind(xhr, dispatch, "on");
+ if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
+ mimeType = null;
+ return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
+ };
+ function d3_xhr_fixCallback(callback) {
+ return callback.length === 1 ? function(error, request) {
+ callback(error == null ? request : null);
+ } : callback;
+ }
+ d3.text = function() {
+ return d3.xhr.apply(d3, arguments).response(d3_text);
+ };
+ function d3_text(request) {
+ return request.responseText;
+ }
+ d3.json = function(url, callback) {
+ return d3.xhr(url, "application/json", callback).response(d3_json);
+ };
+ function d3_json(request) {
+ return JSON.parse(request.responseText);
+ }
+ d3.html = function(url, callback) {
+ return d3.xhr(url, "text/html", callback).response(d3_html);
+ };
+ function d3_html(request) {
+ var range = d3_document.createRange();
+ range.selectNode(d3_document.body);
+ return range.createContextualFragment(request.responseText);
+ }
+ d3.xml = function() {
+ return d3.xhr.apply(d3, arguments).response(d3_xml);
+ };
+ function d3_xml(request) {
+ return request.responseXML;
+ }
+ var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+ };
+ d3.ns = {
+ prefix: d3_nsPrefix,
+ qualify: function(name) {
+ var i = name.indexOf(":"), prefix = name;
+ if (i >= 0) {
+ prefix = name.substring(0, i);
+ name = name.substring(i + 1);
+ }
+ return d3_nsPrefix.hasOwnProperty(prefix) ? {
+ space: d3_nsPrefix[prefix],
+ local: name
+ } : name;
+ }
+ };
+ d3.dispatch = function() {
+ var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ return dispatch;
+ };
+ function d3_dispatch() {}
+ d3_dispatch.prototype.on = function(type, listener) {
+ var i = type.indexOf("."), name = "";
+ if (i > 0) {
+ name = type.substring(i + 1);
+ type = type.substring(0, i);
+ }
+ return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
+ };
+ function d3_dispatch_event(dispatch) {
+ var listeners = [], listenerByName = new d3_Map();
+ function event() {
+ var z = listeners, i = -1, n = z.length, l;
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
+ return dispatch;
+ }
+ event.on = function(name, listener) {
+ var l = listenerByName.get(name), i;
+ if (arguments.length < 2) return l && l.on;
+ if (l) {
+ l.on = null;
+ listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
+ listenerByName.remove(name);
+ }
+ if (listener) listeners.push(listenerByName.set(name, {
+ on: listener
+ }));
+ return dispatch;
+ };
+ return event;
+ }
+ d3.format = function(specifier) {
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
+ if (precision) precision = +precision.substring(1);
+ if (zfill || fill === "0" && align === "=") {
+ zfill = fill = "0";
+ align = "=";
+ if (comma) width -= Math.floor((width - 1) / 4);
+ }
+ switch (type) {
+ case "n":
+ comma = true;
+ type = "g";
+ break;
+
+ case "%":
+ scale = 100;
+ suffix = "%";
+ type = "f";
+ break;
+
+ case "p":
+ scale = 100;
+ suffix = "%";
+ type = "r";
+ break;
+
+ case "b":
+ case "o":
+ case "x":
+ case "X":
+ if (basePrefix) basePrefix = "0" + type.toLowerCase();
+
+ case "c":
+ case "d":
+ integer = true;
+ precision = 0;
+ break;
+
+ case "s":
+ scale = -1;
+ type = "r";
+ break;
+ }
+ if (basePrefix === "#") basePrefix = "";
+ if (type == "r" && !precision) type = "g";
+ type = d3_format_types.get(type) || d3_format_typeDefault;
+ var zcomma = zfill && comma;
+ return function(value) {
+ if (integer && value % 1) return "";
+ var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
+ if (scale < 0) {
+ var prefix = d3.formatPrefix(value, precision);
+ value = prefix.scale(value);
+ suffix = prefix.symbol;
+ } else {
+ value *= scale;
+ }
+ value = type(value, precision);
+ if (!zfill && comma) value = d3_format_group(value);
+ var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
+ if (zcomma) value = d3_format_group(padding + value);
+ if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint);
+ negative += basePrefix;
+ return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix;
+ };
+ };
+ var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
+ var d3_format_types = d3.map({
+ b: function(x) {
+ return x.toString(2);
+ },
+ c: function(x) {
+ return String.fromCharCode(x);
+ },
+ o: function(x) {
+ return x.toString(8);
+ },
+ x: function(x) {
+ return x.toString(16);
+ },
+ X: function(x) {
+ return x.toString(16).toUpperCase();
+ },
+ g: function(x, p) {
+ return x.toPrecision(p);
+ },
+ e: function(x, p) {
+ return x.toExponential(p);
+ },
+ f: function(x, p) {
+ return x.toFixed(p);
+ },
+ r: function(x, p) {
+ return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
+ }
+ });
+ function d3_format_precision(x, p) {
+ return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
+ }
+ function d3_format_typeDefault(x) {
+ return x + "";
+ }
+ var d3_format_group = d3_identity;
+ if (d3_format_grouping) {
+ var d3_format_groupingLength = d3_format_grouping.length;
+ d3_format_group = function(value) {
+ var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length,
+ ""), t = [], j = 0, g = d3_format_grouping[0];
+ while (i > 0 && g > 0) {
+ t.push(value.substring(i -= g, i + g));
+ g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength];
+ }
+ return t.reverse().join(d3_format_thousandsSeparator || "") + f;
+ };
+ }
+ var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
+ d3.formatPrefix = function(value, precision) {
+ var i = 0;
+ if (value) {
+ if (value < 0) value *= -1;
+ if (precision) value = d3.round(value, d3_format_precision(value, precision));
+ i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
+ i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
+ }
+ return d3_formatPrefixes[8 + i / 3];
+ };
+ function d3_formatPrefix(d, i) {
+ var k = Math.pow(10, Math.abs(8 - i) * 3);
+ return {
+ scale: i > 8 ? function(d) {
+ return d / k;
+ } : function(d) {
+ return d * k;
+ },
+ symbol: d
+ };
+ }
+ var d3_ease_default = function() {
+ return d3_identity;
+ };
+ var d3_ease = d3.map({
+ linear: d3_ease_default,
+ poly: d3_ease_poly,
+ quad: function() {
+ return d3_ease_quad;
+ },
+ cubic: function() {
+ return d3_ease_cubic;
+ },
+ sin: function() {
+ return d3_ease_sin;
+ },
+ exp: function() {
+ return d3_ease_exp;
+ },
+ circle: function() {
+ return d3_ease_circle;
+ },
+ elastic: d3_ease_elastic,
+ back: d3_ease_back,
+ bounce: function() {
+ return d3_ease_bounce;
+ }
+ });
+ var d3_ease_mode = d3.map({
+ "in": d3_identity,
+ out: d3_ease_reverse,
+ "in-out": d3_ease_reflect,
+ "out-in": function(f) {
+ return d3_ease_reflect(d3_ease_reverse(f));
+ }
+ });
+ d3.ease = function(name) {
+ var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
+ t = d3_ease.get(t) || d3_ease_default;
+ m = d3_ease_mode.get(m) || d3_identity;
+ return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
+ };
+ function d3_ease_clamp(f) {
+ return function(t) {
+ return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
+ };
+ }
+ function d3_ease_reverse(f) {
+ return function(t) {
+ return 1 - f(1 - t);
+ };
+ }
+ function d3_ease_reflect(f) {
+ return function(t) {
+ return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
+ };
+ }
+ function d3_ease_quad(t) {
+ return t * t;
+ }
+ function d3_ease_cubic(t) {
+ return t * t * t;
+ }
+ function d3_ease_cubicInOut(t) {
+ if (t <= 0) return 0;
+ if (t >= 1) return 1;
+ var t2 = t * t, t3 = t2 * t;
+ return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
+ }
+ function d3_ease_poly(e) {
+ return function(t) {
+ return Math.pow(t, e);
+ };
+ }
+ function d3_ease_sin(t) {
+ return 1 - Math.cos(t * π / 2);
+ }
+ function d3_ease_exp(t) {
+ return Math.pow(2, 10 * (t - 1));
+ }
+ function d3_ease_circle(t) {
+ return 1 - Math.sqrt(1 - t * t);
+ }
+ function d3_ease_elastic(a, p) {
+ var s;
+ if (arguments.length < 2) p = .45;
+ if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
+ return function(t) {
+ return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
+ };
+ }
+ function d3_ease_back(s) {
+ if (!s) s = 1.70158;
+ return function(t) {
+ return t * t * ((s + 1) * t - s);
+ };
+ }
+ function d3_ease_bounce(t) {
+ return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
+ }
+ d3.event = null;
+ function d3_eventCancel() {
+ d3.event.stopPropagation();
+ d3.event.preventDefault();
+ }
+ function d3_eventSource() {
+ var e = d3.event, s;
+ while (s = e.sourceEvent) e = s;
+ return e;
+ }
+ function d3_eventDispatch(target) {
+ var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
+ while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
+ dispatch.of = function(thiz, argumentz) {
+ return function(e1) {
+ try {
+ var e0 = e1.sourceEvent = d3.event;
+ e1.target = target;
+ d3.event = e1;
+ dispatch[e1.type].apply(thiz, argumentz);
+ } finally {
+ d3.event = e0;
+ }
+ };
+ };
+ return dispatch;
+ }
+ d3.transform = function(string) {
+ var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
+ })(string);
+ };
+ function d3_transform(m) {
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
+ this.translate = [ m.e, m.f ];
+ this.scale = [ kx, ky ];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
+ }
+ d3_transform.prototype.toString = function() {
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
+ };
+ function d3_transformDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+ function d3_transformNormalize(a) {
+ var k = Math.sqrt(d3_transformDot(a, a));
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
+ return k;
+ }
+ function d3_transformCombine(a, b, k) {
+ a[0] += k * b[0];
+ a[1] += k * b[1];
+ return a;
+ }
+ var d3_transformIdentity = {
+ a: 1,
+ b: 0,
+ c: 0,
+ d: 1,
+ e: 0,
+ f: 0
+ };
+ d3.interpolate = function(a, b) {
+ var i = d3.interpolators.length, f;
+ while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
+ return f;
+ };
+ d3.interpolateNumber = function(a, b) {
+ b -= a;
+ return function(t) {
+ return a + b * t;
+ };
+ };
+ d3.interpolateRound = function(a, b) {
+ b -= a;
+ return function(t) {
+ return Math.round(a + b * t);
+ };
+ };
+ d3.interpolateString = function(a, b) {
+ var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
+ d3_interpolate_number.lastIndex = 0;
+ for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
+ if (m.index) s.push(b.substring(s0, s1 = m.index));
+ q.push({
+ i: s.length,
+ x: m[0]
+ });
+ s.push(null);
+ s0 = d3_interpolate_number.lastIndex;
+ }
+ if (s0 < b.length) s.push(b.substring(s0));
+ for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
+ o = q[i];
+ if (o.x == m[0]) {
+ if (o.i) {
+ if (s[o.i + 1] == null) {
+ s[o.i - 1] += o.x;
+ s.splice(o.i, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ } else {
+ s[o.i - 1] += o.x + s[o.i + 1];
+ s.splice(o.i, 2);
+ for (j = i + 1; j < n; ++j) q[j].i -= 2;
+ }
+ } else {
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ for (j = i + 1; j < n; ++j) q[j].i--;
+ }
+ }
+ q.splice(i, 1);
+ n--;
+ i--;
+ } else {
+ o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
+ }
+ }
+ while (i < n) {
+ o = q.pop();
+ if (s[o.i + 1] == null) {
+ s[o.i] = o.x;
+ } else {
+ s[o.i] = o.x + s[o.i + 1];
+ s.splice(o.i + 1, 1);
+ }
+ n--;
+ }
+ if (s.length === 1) {
+ return s[0] == null ? q[0].x : function() {
+ return b;
+ };
+ }
+ return function(t) {
+ for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateTransform = function(a, b) {
+ var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
+ s.push("translate(", null, ",", null, ")");
+ q.push({
+ i: 1,
+ x: d3.interpolateNumber(ta[0], tb[0])
+ }, {
+ i: 3,
+ x: d3.interpolateNumber(ta[1], tb[1])
+ });
+ } else if (tb[0] || tb[1]) {
+ s.push("translate(" + tb + ")");
+ } else {
+ s.push("");
+ }
+ if (ra != rb) {
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
+ q.push({
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
+ x: d3.interpolateNumber(ra, rb)
+ });
+ } else if (rb) {
+ s.push(s.pop() + "rotate(" + rb + ")");
+ }
+ if (wa != wb) {
+ q.push({
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
+ x: d3.interpolateNumber(wa, wb)
+ });
+ } else if (wb) {
+ s.push(s.pop() + "skewX(" + wb + ")");
+ }
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
+ q.push({
+ i: n - 4,
+ x: d3.interpolateNumber(ka[0], kb[0])
+ }, {
+ i: n - 2,
+ x: d3.interpolateNumber(ka[1], kb[1])
+ });
+ } else if (kb[0] != 1 || kb[1] != 1) {
+ s.push(s.pop() + "scale(" + kb + ")");
+ }
+ n = q.length;
+ return function(t) {
+ var i = -1, o;
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
+ return s.join("");
+ };
+ };
+ d3.interpolateRgb = function(a, b) {
+ a = d3.rgb(a);
+ b = d3.rgb(b);
+ var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
+ return function(t) {
+ return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
+ };
+ };
+ d3.interpolateHsl = function(a, b) {
+ a = d3.hsl(a);
+ b = d3.hsl(b);
+ var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
+ if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
+ return function(t) {
+ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
+ };
+ };
+ d3.interpolateLab = function(a, b) {
+ a = d3.lab(a);
+ b = d3.lab(b);
+ var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
+ return function(t) {
+ return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
+ };
+ };
+ d3.interpolateHcl = function(a, b) {
+ a = d3.hcl(a);
+ b = d3.hcl(b);
+ var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
+ if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
+ return function(t) {
+ return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
+ };
+ };
+ d3.interpolateArray = function(a, b) {
+ var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
+ for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
+ for (;i < na; ++i) c[i] = a[i];
+ for (;i < nb; ++i) c[i] = b[i];
+ return function(t) {
+ for (i = 0; i < n0; ++i) c[i] = x[i](t);
+ return c;
+ };
+ };
+ d3.interpolateObject = function(a, b) {
+ var i = {}, c = {}, k;
+ for (k in a) {
+ if (k in b) {
+ i[k] = d3_interpolateByName(k)(a[k], b[k]);
+ } else {
+ c[k] = a[k];
+ }
+ }
+ for (k in b) {
+ if (!(k in a)) {
+ c[k] = b[k];
+ }
+ }
+ return function(t) {
+ for (k in i) c[k] = i[k](t);
+ return c;
+ };
+ };
+ var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
+ function d3_interpolateByName(name) {
+ return name == "transform" ? d3.interpolateTransform : d3.interpolate;
+ }
+ d3.interpolators = [ d3.interpolateObject, function(a, b) {
+ return b instanceof Array && d3.interpolateArray(a, b);
+ }, function(a, b) {
+ return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
+ }, function(a, b) {
+ return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Color) && d3.interpolateRgb(a, b);
+ }, function(a, b) {
+ return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
+ } ];
+ function d3_uninterpolateNumber(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return (x - a) * b;
+ };
+ }
+ function d3_uninterpolateClamp(a, b) {
+ b = b - (a = +a) ? 1 / (b - a) : 0;
+ return function(x) {
+ return Math.max(0, Math.min(1, (x - a) * b));
+ };
+ }
+ function d3_Color() {}
+ d3_Color.prototype.toString = function() {
+ return this.rgb() + "";
+ };
+ d3.rgb = function(r, g, b) {
+ return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
+ };
+ function d3_rgb(r, g, b) {
+ return new d3_Rgb(r, g, b);
+ }
+ function d3_Rgb(r, g, b) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ }
+ var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
+ d3_rgbPrototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ var r = this.r, g = this.g, b = this.b, i = 30;
+ if (!r && !g && !b) return d3_rgb(i, i, i);
+ if (r && r < i) r = i;
+ if (g && g < i) g = i;
+ if (b && b < i) b = i;
+ return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
+ };
+ d3_rgbPrototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
+ };
+ d3_rgbPrototype.hsl = function() {
+ return d3_rgb_hsl(this.r, this.g, this.b);
+ };
+ d3_rgbPrototype.toString = function() {
+ return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
+ };
+ function d3_rgb_hex(v) {
+ return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
+ }
+ function d3_rgb_parse(format, rgb, hsl) {
+ var r = 0, g = 0, b = 0, m1, m2, name;
+ m1 = /([a-z]+)\((.*)\)/i.exec(format);
+ if (m1) {
+ m2 = m1[2].split(",");
+ switch (m1[1]) {
+ case "hsl":
+ {
+ return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
+ }
+
+ case "rgb":
+ {
+ return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
+ }
+ }
+ }
+ if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
+ if (format != null && format.charAt(0) === "#") {
+ if (format.length === 4) {
+ r = format.charAt(1);
+ r += r;
+ g = format.charAt(2);
+ g += g;
+ b = format.charAt(3);
+ b += b;
+ } else if (format.length === 7) {
+ r = format.substring(1, 3);
+ g = format.substring(3, 5);
+ b = format.substring(5, 7);
+ }
+ r = parseInt(r, 16);
+ g = parseInt(g, 16);
+ b = parseInt(b, 16);
+ }
+ return rgb(r, g, b);
+ }
+ function d3_rgb_hsl(r, g, b) {
+ var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
+ if (d) {
+ s = l < .5 ? d / (max + min) : d / (2 - max - min);
+ if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
+ h *= 60;
+ } else {
+ s = h = 0;
+ }
+ return d3_hsl(h, s, l);
+ }
+ function d3_rgb_lab(r, g, b) {
+ r = d3_rgb_xyz(r);
+ g = d3_rgb_xyz(g);
+ b = d3_rgb_xyz(b);
+ var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
+ return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
+ }
+ function d3_rgb_xyz(r) {
+ return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
+ }
+ function d3_rgb_parseNumber(c) {
+ var f = parseFloat(c);
+ return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
+ }
+ var d3_rgb_names = d3.map({
+ aliceblue: "#f0f8ff",
+ antiquewhite: "#faebd7",
+ aqua: "#00ffff",
+ aquamarine: "#7fffd4",
+ azure: "#f0ffff",
+ beige: "#f5f5dc",
+ bisque: "#ffe4c4",
+ black: "#000000",
+ blanchedalmond: "#ffebcd",
+ blue: "#0000ff",
+ blueviolet: "#8a2be2",
+ brown: "#a52a2a",
+ burlywood: "#deb887",
+ cadetblue: "#5f9ea0",
+ chartreuse: "#7fff00",
+ chocolate: "#d2691e",
+ coral: "#ff7f50",
+ cornflowerblue: "#6495ed",
+ cornsilk: "#fff8dc",
+ crimson: "#dc143c",
+ cyan: "#00ffff",
+ darkblue: "#00008b",
+ darkcyan: "#008b8b",
+ darkgoldenrod: "#b8860b",
+ darkgray: "#a9a9a9",
+ darkgreen: "#006400",
+ darkgrey: "#a9a9a9",
+ darkkhaki: "#bdb76b",
+ darkmagenta: "#8b008b",
+ darkolivegreen: "#556b2f",
+ darkorange: "#ff8c00",
+ darkorchid: "#9932cc",
+ darkred: "#8b0000",
+ darksalmon: "#e9967a",
+ darkseagreen: "#8fbc8f",
+ darkslateblue: "#483d8b",
+ darkslategray: "#2f4f4f",
+ darkslategrey: "#2f4f4f",
+ darkturquoise: "#00ced1",
+ darkviolet: "#9400d3",
+ deeppink: "#ff1493",
+ deepskyblue: "#00bfff",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1e90ff",
+ firebrick: "#b22222",
+ floralwhite: "#fffaf0",
+ forestgreen: "#228b22",
+ fuchsia: "#ff00ff",
+ gainsboro: "#dcdcdc",
+ ghostwhite: "#f8f8ff",
+ gold: "#ffd700",
+ goldenrod: "#daa520",
+ gray: "#808080",
+ green: "#008000",
+ greenyellow: "#adff2f",
+ grey: "#808080",
+ honeydew: "#f0fff0",
+ hotpink: "#ff69b4",
+ indianred: "#cd5c5c",
+ indigo: "#4b0082",
+ ivory: "#fffff0",
+ khaki: "#f0e68c",
+ lavender: "#e6e6fa",
+ lavenderblush: "#fff0f5",
+ lawngreen: "#7cfc00",
+ lemonchiffon: "#fffacd",
+ lightblue: "#add8e6",
+ lightcoral: "#f08080",
+ lightcyan: "#e0ffff",
+ lightgoldenrodyellow: "#fafad2",
+ lightgray: "#d3d3d3",
+ lightgreen: "#90ee90",
+ lightgrey: "#d3d3d3",
+ lightpink: "#ffb6c1",
+ lightsalmon: "#ffa07a",
+ lightseagreen: "#20b2aa",
+ lightskyblue: "#87cefa",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#b0c4de",
+ lightyellow: "#ffffe0",
+ lime: "#00ff00",
+ limegreen: "#32cd32",
+ linen: "#faf0e6",
+ magenta: "#ff00ff",
+ maroon: "#800000",
+ mediumaquamarine: "#66cdaa",
+ mediumblue: "#0000cd",
+ mediumorchid: "#ba55d3",
+ mediumpurple: "#9370db",
+ mediumseagreen: "#3cb371",
+ mediumslateblue: "#7b68ee",
+ mediumspringgreen: "#00fa9a",
+ mediumturquoise: "#48d1cc",
+ mediumvioletred: "#c71585",
+ midnightblue: "#191970",
+ mintcream: "#f5fffa",
+ mistyrose: "#ffe4e1",
+ moccasin: "#ffe4b5",
+ navajowhite: "#ffdead",
+ navy: "#000080",
+ oldlace: "#fdf5e6",
+ olive: "#808000",
+ olivedrab: "#6b8e23",
+ orange: "#ffa500",
+ orangered: "#ff4500",
+ orchid: "#da70d6",
+ palegoldenrod: "#eee8aa",
+ palegreen: "#98fb98",
+ paleturquoise: "#afeeee",
+ palevioletred: "#db7093",
+ papayawhip: "#ffefd5",
+ peachpuff: "#ffdab9",
+ peru: "#cd853f",
+ pink: "#ffc0cb",
+ plum: "#dda0dd",
+ powderblue: "#b0e0e6",
+ purple: "#800080",
+ red: "#ff0000",
+ rosybrown: "#bc8f8f",
+ royalblue: "#4169e1",
+ saddlebrown: "#8b4513",
+ salmon: "#fa8072",
+ sandybrown: "#f4a460",
+ seagreen: "#2e8b57",
+ seashell: "#fff5ee",
+ sienna: "#a0522d",
+ silver: "#c0c0c0",
+ skyblue: "#87ceeb",
+ slateblue: "#6a5acd",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#fffafa",
+ springgreen: "#00ff7f",
+ steelblue: "#4682b4",
+ tan: "#d2b48c",
+ teal: "#008080",
+ thistle: "#d8bfd8",
+ tomato: "#ff6347",
+ turquoise: "#40e0d0",
+ violet: "#ee82ee",
+ wheat: "#f5deb3",
+ white: "#ffffff",
+ whitesmoke: "#f5f5f5",
+ yellow: "#ffff00",
+ yellowgreen: "#9acd32"
+ });
+ d3_rgb_names.forEach(function(key, value) {
+ d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
+ });
+ d3.hsl = function(h, s, l) {
+ return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
+ };
+ function d3_hsl(h, s, l) {
+ return new d3_Hsl(h, s, l);
+ }
+ function d3_Hsl(h, s, l) {
+ this.h = h;
+ this.s = s;
+ this.l = l;
+ }
+ var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
+ d3_hslPrototype.brighter = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, this.l / k);
+ };
+ d3_hslPrototype.darker = function(k) {
+ k = Math.pow(.7, arguments.length ? k : 1);
+ return d3_hsl(this.h, this.s, k * this.l);
+ };
+ d3_hslPrototype.rgb = function() {
+ return d3_hsl_rgb(this.h, this.s, this.l);
+ };
+ function d3_hsl_rgb(h, s, l) {
+ var m1, m2;
+ h = h % 360;
+ if (h < 0) h += 360;
+ s = s < 0 ? 0 : s > 1 ? 1 : s;
+ l = l < 0 ? 0 : l > 1 ? 1 : l;
+ m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
+ m1 = 2 * l - m2;
+ function v(h) {
+ if (h > 360) h -= 360; else if (h < 0) h += 360;
+ if (h < 60) return m1 + (m2 - m1) * h / 60;
+ if (h < 180) return m2;
+ if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
+ return m1;
+ }
+ function vv(h) {
+ return Math.round(v(h) * 255);
+ }
+ return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
+ }
+ d3.hcl = function(h, c, l) {
+ return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
+ };
+ function d3_hcl(h, c, l) {
+ return new d3_Hcl(h, c, l);
+ }
+ function d3_Hcl(h, c, l) {
+ this.h = h;
+ this.c = c;
+ this.l = l;
+ }
+ var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
+ d3_hclPrototype.brighter = function(k) {
+ return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_hclPrototype.darker = function(k) {
+ return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
+ };
+ d3_hclPrototype.rgb = function() {
+ return d3_hcl_lab(this.h, this.c, this.l).rgb();
+ };
+ function d3_hcl_lab(h, c, l) {
+ return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
+ }
+ d3.lab = function(l, a, b) {
+ return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
+ };
+ function d3_lab(l, a, b) {
+ return new d3_Lab(l, a, b);
+ }
+ function d3_Lab(l, a, b) {
+ this.l = l;
+ this.a = a;
+ this.b = b;
+ }
+ var d3_lab_K = 18;
+ var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
+ var d3_labPrototype = d3_Lab.prototype = new d3_Color();
+ d3_labPrototype.brighter = function(k) {
+ return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_labPrototype.darker = function(k) {
+ return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
+ };
+ d3_labPrototype.rgb = function() {
+ return d3_lab_rgb(this.l, this.a, this.b);
+ };
+ function d3_lab_rgb(l, a, b) {
+ var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
+ x = d3_lab_xyz(x) * d3_lab_X;
+ y = d3_lab_xyz(y) * d3_lab_Y;
+ z = d3_lab_xyz(z) * d3_lab_Z;
+ return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
+ }
+ function d3_lab_hcl(l, a, b) {
+ return d3_hcl(Math.atan2(b, a) / π * 180, Math.sqrt(a * a + b * b), l);
+ }
+ function d3_lab_xyz(x) {
+ return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
+ }
+ function d3_xyz_lab(x) {
+ return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
+ }
+ function d3_xyz_rgb(r) {
+ return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
+ }
+ function d3_selection(groups) {
+ d3_arraySubclass(groups, d3_selectionPrototype);
+ return groups;
+ }
+ var d3_select = function(s, n) {
+ return n.querySelector(s);
+ }, d3_selectAll = function(s, n) {
+ return n.querySelectorAll(s);
+ }, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
+ return d3_selectMatcher.call(n, s);
+ };
+ if (typeof Sizzle === "function") {
+ d3_select = function(s, n) {
+ return Sizzle(s, n)[0] || null;
+ };
+ d3_selectAll = function(s, n) {
+ return Sizzle.uniqueSort(Sizzle(s, n));
+ };
+ d3_selectMatches = Sizzle.matchesSelector;
+ }
+ var d3_selectionPrototype = [];
+ d3.selection = function() {
+ return d3_selectionRoot;
+ };
+ d3.selection.prototype = d3_selectionPrototype;
+ d3_selectionPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, group, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(subnode = selector.call(node, node.__data__, i));
+ if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_selector(selector) {
+ return function() {
+ return d3_select(selector, this);
+ };
+ }
+ d3_selectionPrototype.selectAll = function(selector) {
+ var subgroups = [], subgroup, node;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
+ subgroup.parentNode = node;
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_selectorAll(selector) {
+ return function() {
+ return d3_selectAll(selector, this);
+ };
+ }
+ d3_selectionPrototype.attr = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node();
+ name = d3.ns.qualify(name);
+ return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
+ }
+ for (value in name) this.each(d3_selection_attr(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_attr(name, value));
+ };
+ function d3_selection_attr(name, value) {
+ name = d3.ns.qualify(name);
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ function attrConstant() {
+ this.setAttribute(name, value);
+ }
+ function attrConstantNS() {
+ this.setAttributeNS(name.space, name.local, value);
+ }
+ function attrFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
+ }
+ function attrFunctionNS() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
+ }
+ return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
+ }
+ d3_selectionPrototype.classed = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") {
+ var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
+ if (value = node.classList) {
+ while (++i < n) if (!value.contains(name[i])) return false;
+ } else {
+ value = node.className;
+ if (value.baseVal != null) value = value.baseVal;
+ while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
+ }
+ return true;
+ }
+ for (value in name) this.each(d3_selection_classed(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_classed(name, value));
+ };
+ function d3_selection_classedRe(name) {
+ return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
+ }
+ function d3_selection_classed(name, value) {
+ name = name.trim().split(/\s+/).map(d3_selection_classedName);
+ var n = name.length;
+ function classedConstant() {
+ var i = -1;
+ while (++i < n) name[i](this, value);
+ }
+ function classedFunction() {
+ var i = -1, x = value.apply(this, arguments);
+ while (++i < n) name[i](this, x);
+ }
+ return typeof value === "function" ? classedFunction : classedConstant;
+ }
+ function d3_selection_classedName(name) {
+ var re = d3_selection_classedRe(name);
+ return function(node, value) {
+ if (c = node.classList) return value ? c.add(name) : c.remove(name);
+ var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
+ if (value) {
+ re.lastIndex = 0;
+ if (!re.test(cv)) {
+ cv = d3_collapse(cv + " " + name);
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ } else if (cv) {
+ cv = d3_collapse(cv.replace(re, " "));
+ if (cb) c.baseVal = cv; else node.className = cv;
+ }
+ };
+ }
+ d3_selectionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
+ return this;
+ }
+ if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
+ priority = "";
+ }
+ return this.each(d3_selection_style(name, value, priority));
+ };
+ function d3_selection_style(name, value, priority) {
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ function styleConstant() {
+ this.style.setProperty(name, value, priority);
+ }
+ function styleFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
+ }
+ return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
+ }
+ d3_selectionPrototype.property = function(name, value) {
+ if (arguments.length < 2) {
+ if (typeof name === "string") return this.node()[name];
+ for (value in name) this.each(d3_selection_property(value, name[value]));
+ return this;
+ }
+ return this.each(d3_selection_property(name, value));
+ };
+ function d3_selection_property(name, value) {
+ function propertyNull() {
+ delete this[name];
+ }
+ function propertyConstant() {
+ this[name] = value;
+ }
+ function propertyFunction() {
+ var x = value.apply(this, arguments);
+ if (x == null) delete this[name]; else this[name] = x;
+ }
+ return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
+ }
+ d3_selectionPrototype.text = function(value) {
+ return arguments.length ? this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.textContent = v == null ? "" : v;
+ } : value == null ? function() {
+ this.textContent = "";
+ } : function() {
+ this.textContent = value;
+ }) : this.node().textContent;
+ };
+ d3_selectionPrototype.html = function(value) {
+ return arguments.length ? this.each(typeof value === "function" ? function() {
+ var v = value.apply(this, arguments);
+ this.innerHTML = v == null ? "" : v;
+ } : value == null ? function() {
+ this.innerHTML = "";
+ } : function() {
+ this.innerHTML = value;
+ }) : this.node().innerHTML;
+ };
+ d3_selectionPrototype.append = function(name) {
+ name = d3.ns.qualify(name);
+ function append() {
+ return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
+ }
+ function appendNS() {
+ return this.appendChild(d3_document.createElementNS(name.space, name.local));
+ }
+ return this.select(name.local ? appendNS : append);
+ };
+ d3_selectionPrototype.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+ function insert() {
+ return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), d3_select(before, this));
+ }
+ function insertNS() {
+ return this.insertBefore(d3_document.createElementNS(name.space, name.local), d3_select(before, this));
+ }
+ return this.select(name.local ? insertNS : insert);
+ };
+ d3_selectionPrototype.remove = function() {
+ return this.each(function() {
+ var parent = this.parentNode;
+ if (parent) parent.removeChild(this);
+ });
+ };
+ d3_selectionPrototype.data = function(value, key) {
+ var i = -1, n = this.length, group, node;
+ if (!arguments.length) {
+ value = new Array(n = (group = this[0]).length);
+ while (++i < n) {
+ if (node = group[i]) {
+ value[i] = node.__data__;
+ }
+ }
+ return value;
+ }
+ function bind(group, groupData) {
+ var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
+ if (key) {
+ var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
+ for (i = -1; ++i < n; ) {
+ keyValue = key.call(node = group[i], node.__data__, i);
+ if (nodeByKeyValue.has(keyValue)) {
+ exitNodes[i] = node;
+ } else {
+ nodeByKeyValue.set(keyValue, node);
+ }
+ keyValues.push(keyValue);
+ }
+ for (i = -1; ++i < m; ) {
+ keyValue = key.call(groupData, nodeData = groupData[i], i);
+ if (node = nodeByKeyValue.get(keyValue)) {
+ updateNodes[i] = node;
+ node.__data__ = nodeData;
+ } else if (!dataByKeyValue.has(keyValue)) {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ }
+ dataByKeyValue.set(keyValue, nodeData);
+ nodeByKeyValue.remove(keyValue);
+ }
+ for (i = -1; ++i < n; ) {
+ if (nodeByKeyValue.has(keyValues[i])) {
+ exitNodes[i] = group[i];
+ }
+ }
+ } else {
+ for (i = -1; ++i < n0; ) {
+ node = group[i];
+ nodeData = groupData[i];
+ if (node) {
+ node.__data__ = nodeData;
+ updateNodes[i] = node;
+ } else {
+ enterNodes[i] = d3_selection_dataNode(nodeData);
+ }
+ }
+ for (;i < m; ++i) {
+ enterNodes[i] = d3_selection_dataNode(groupData[i]);
+ }
+ for (;i < n; ++i) {
+ exitNodes[i] = group[i];
+ }
+ }
+ enterNodes.update = updateNodes;
+ enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
+ enter.push(enterNodes);
+ update.push(updateNodes);
+ exit.push(exitNodes);
+ }
+ var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
+ if (typeof value === "function") {
+ while (++i < n) {
+ bind(group = this[i], value.call(group, group.parentNode.__data__, i));
+ }
+ } else {
+ while (++i < n) {
+ bind(group = this[i], value);
+ }
+ }
+ update.enter = function() {
+ return enter;
+ };
+ update.exit = function() {
+ return exit;
+ };
+ return update;
+ };
+ function d3_selection_dataNode(data) {
+ return {
+ __data__: data
+ };
+ }
+ d3_selectionPrototype.datum = function(value) {
+ return arguments.length ? this.property("__data__", value) : this.property("__data__");
+ };
+ d3_selectionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = (group = this[j]).parentNode;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+ }
+ d3_selectionPrototype.order = function() {
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
+ if (node = group[i]) {
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
+ next = node;
+ }
+ }
+ }
+ return this;
+ };
+ d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
+ return this.order();
+ };
+ function d3_selection_sortComparator(comparator) {
+ if (!arguments.length) comparator = d3.ascending;
+ return function(a, b) {
+ return !a - !b || comparator(a.__data__, b.__data__);
+ };
+ }
+ d3_selectionPrototype.on = function(type, listener, capture) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof type !== "string") {
+ if (n < 2) listener = false;
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
+ return this;
+ }
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
+ capture = false;
+ }
+ return this.each(d3_selection_on(type, listener, capture));
+ };
+ function d3_selection_on(type, listener, capture) {
+ var name = "__on" + type, i = type.indexOf(".");
+ if (i > 0) type = type.substring(0, i);
+ function onRemove() {
+ var wrapper = this[name];
+ if (wrapper) {
+ this.removeEventListener(type, wrapper, wrapper.$);
+ delete this[name];
+ }
+ }
+ function onAdd() {
+ var node = this, args = d3_array(arguments);
+ onRemove.call(this);
+ this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
+ wrapper._ = listener;
+ function wrapper(e) {
+ var o = d3.event;
+ d3.event = e;
+ args[0] = node.__data__;
+ try {
+ listener.apply(node, args);
+ } finally {
+ d3.event = o;
+ }
+ }
+ }
+ return listener ? onAdd : onRemove;
+ }
+ d3_selectionPrototype.each = function(callback) {
+ return d3_selection_each(this, function(node, i, j) {
+ callback.call(node, node.__data__, i, j);
+ });
+ };
+ function d3_selection_each(groups, callback) {
+ for (var j = 0, m = groups.length; j < m; j++) {
+ for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
+ if (node = group[i]) callback(node, i, j);
+ }
+ }
+ return groups;
+ }
+ d3_selectionPrototype.call = function(callback) {
+ var args = d3_array(arguments);
+ callback.apply(args[0] = this, args);
+ return this;
+ };
+ d3_selectionPrototype.empty = function() {
+ return !this.node();
+ };
+ d3_selectionPrototype.node = function() {
+ for (var j = 0, m = this.length; j < m; j++) {
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ var node = group[i];
+ if (node) return node;
+ }
+ }
+ return null;
+ };
+ d3_selectionPrototype.transition = function() {
+ var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit);
+ transition.time = Date.now();
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) d3_transitionNode(node, i, id, transition);
+ subgroup.push(node);
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
+ d3_selectionRoot[0].parentNode = d3_selectRoot;
+ d3.select = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
+ };
+ d3.selectAll = function(selector) {
+ return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
+ };
+ function d3_selection_enter(selection) {
+ d3_arraySubclass(selection, d3_selection_enterPrototype);
+ return selection;
+ }
+ var d3_selection_enterPrototype = [];
+ d3.selection.enter = d3_selection_enter;
+ d3.selection.enter.prototype = d3_selection_enterPrototype;
+ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
+ d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
+ d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
+ d3_selection_enterPrototype.node = d3_selectionPrototype.node;
+ d3_selection_enterPrototype.select = function(selector) {
+ var subgroups = [], subgroup, subnode, upgroup, group, node;
+ for (var j = -1, m = this.length; ++j < m; ) {
+ upgroup = (group = this[j]).update;
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ for (var i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ };
+ function d3_transition(groups, id) {
+ d3_arraySubclass(groups, d3_transitionPrototype);
+ groups.id = id;
+ return groups;
+ }
+ var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = {
+ ease: d3_ease_cubicInOut,
+ delay: 0,
+ duration: 250
+ };
+ d3_transitionPrototype.call = d3_selectionPrototype.call;
+ d3_transitionPrototype.empty = d3_selectionPrototype.empty;
+ d3_transitionPrototype.node = d3_selectionPrototype.node;
+ d3.transition = function(selection) {
+ return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
+ };
+ d3.transition.prototype = d3_transitionPrototype;
+ function d3_transitionNode(node, i, id, inherit) {
+ var lock = node.__transition__ || (node.__transition__ = {
+ active: 0,
+ count: 0
+ }), transition = lock[id];
+ if (!transition) {
+ var time = inherit.time;
+ transition = lock[id] = {
+ tween: new d3_Map(),
+ event: d3.dispatch("start", "end"),
+ time: time,
+ ease: inherit.ease,
+ delay: inherit.delay,
+ duration: inherit.duration
+ };
+ ++lock.count;
+ d3.timer(function(elapsed) {
+ var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = [];
+ return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1;
+ function start(elapsed) {
+ if (lock.active > id) return stop();
+ lock.active = id;
+ event.start.call(node, d, i);
+ transition.tween.forEach(function(key, value) {
+ if (value = value.call(node, d, i)) {
+ tweened.push(value);
+ }
+ });
+ if (!tick(elapsed)) d3.timer(tick, 0, time);
+ return 1;
+ }
+ function tick(elapsed) {
+ if (lock.active !== id) return stop();
+ var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
+ while (n > 0) {
+ tweened[--n].call(node, e);
+ }
+ if (t >= 1) {
+ stop();
+ event.end.call(node, d, i);
+ return 1;
+ }
+ }
+ function stop() {
+ if (--lock.count) delete lock[id]; else delete node.__transition__;
+ return 1;
+ }
+ }, 0, time);
+ return transition;
+ }
+ }
+ d3_transitionPrototype.select = function(selector) {
+ var id = this.id, subgroups = [], subgroup, subnode, node;
+ if (typeof selector !== "function") selector = d3_selection_selector(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) {
+ if ("__data__" in node) subnode.__data__ = node.__data__;
+ d3_transitionNode(subnode, i, id, node.__transition__[id]);
+ subgroup.push(subnode);
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ d3_transitionPrototype.selectAll = function(selector) {
+ var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
+ if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
+ for (var j = -1, m = this.length; ++j < m; ) {
+ for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
+ if (node = group[i]) {
+ transition = node.__transition__[id];
+ subnodes = selector.call(node, node.__data__, i);
+ subgroups.push(subgroup = []);
+ for (var k = -1, o = subnodes.length; ++k < o; ) {
+ d3_transitionNode(subnode = subnodes[k], k, id, transition);
+ subgroup.push(subnode);
+ }
+ }
+ }
+ }
+ return d3_transition(subgroups, id);
+ };
+ d3_transitionPrototype.filter = function(filter) {
+ var subgroups = [], subgroup, group, node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if ((node = group[i]) && filter.call(node, node.__data__, i)) {
+ subgroup.push(node);
+ }
+ }
+ }
+ return d3_transition(subgroups, this.id, this.time).ease(this.ease());
+ };
+ d3_transitionPrototype.attr = function(nameNS, value) {
+ if (arguments.length < 2) {
+ for (value in nameNS) this.attr(value, nameNS[value]);
+ return this;
+ }
+ var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS);
+ function attrNull() {
+ this.removeAttribute(name);
+ }
+ function attrNullNS() {
+ this.removeAttributeNS(name.space, name.local);
+ }
+ return d3_transition_tween(this, "attr." + nameNS, value, function(b) {
+ function attrString() {
+ var a = this.getAttribute(name), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.setAttribute(name, i(t));
+ });
+ }
+ function attrStringNS() {
+ var a = this.getAttributeNS(name.space, name.local), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.setAttributeNS(name.space, name.local, i(t));
+ });
+ }
+ return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString);
+ });
+ };
+ d3_transitionPrototype.attrTween = function(nameNS, tween) {
+ var name = d3.ns.qualify(nameNS);
+ function attrTween(d, i) {
+ var f = tween.call(this, d, i, this.getAttribute(name));
+ return f && function(t) {
+ this.setAttribute(name, f(t));
+ };
+ }
+ function attrTweenNS(d, i) {
+ var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
+ return f && function(t) {
+ this.setAttributeNS(name.space, name.local, f(t));
+ };
+ }
+ return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
+ };
+ d3_transitionPrototype.style = function(name, value, priority) {
+ var n = arguments.length;
+ if (n < 3) {
+ if (typeof name !== "string") {
+ if (n < 2) value = "";
+ for (priority in name) this.style(priority, name[priority], value);
+ return this;
+ }
+ priority = "";
+ }
+ var interpolate = d3_interpolateByName(name);
+ function styleNull() {
+ this.style.removeProperty(name);
+ }
+ return d3_transition_tween(this, "style." + name, value, function(b) {
+ function styleString() {
+ var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
+ return a !== b && (i = interpolate(a, b), function(t) {
+ this.style.setProperty(name, i(t), priority);
+ });
+ }
+ return b == null ? styleNull : (b += "", styleString);
+ });
+ };
+ d3_transitionPrototype.styleTween = function(name, tween, priority) {
+ if (arguments.length < 3) priority = "";
+ return this.tween("style." + name, function(d, i) {
+ var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
+ return f && function(t) {
+ this.style.setProperty(name, f(t), priority);
+ };
+ });
+ };
+ d3_transitionPrototype.text = function(value) {
+ return d3_transition_tween(this, "text", value, d3_transition_text);
+ };
+ function d3_transition_text(b) {
+ if (b == null) b = "";
+ return function() {
+ this.textContent = b;
+ };
+ }
+ d3_transitionPrototype.remove = function() {
+ return this.each("end.transition", function() {
+ var p;
+ if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
+ });
+ };
+ d3_transitionPrototype.ease = function(value) {
+ var id = this.id;
+ if (arguments.length < 1) return this.node().__transition__[id].ease;
+ if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
+ return d3_selection_each(this, function(node) {
+ node.__transition__[id].ease = value;
+ });
+ };
+ d3_transitionPrototype.delay = function(value) {
+ var id = this.id;
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0;
+ } : (value |= 0, function(node) {
+ node.__transition__[id].delay = value;
+ }));
+ };
+ d3_transitionPrototype.duration = function(value) {
+ var id = this.id;
+ return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0);
+ } : (value = Math.max(1, value | 0), function(node) {
+ node.__transition__[id].duration = value;
+ }));
+ };
+ d3_transitionPrototype.each = function(type, listener) {
+ var id = this.id;
+ if (arguments.length < 2) {
+ var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
+ d3_transitionInheritId = id;
+ d3_selection_each(this, function(node, i, j) {
+ d3_transitionInherit = node.__transition__[id];
+ type.call(node, node.__data__, i, j);
+ });
+ d3_transitionInherit = inherit;
+ d3_transitionInheritId = inheritId;
+ } else {
+ d3_selection_each(this, function(node) {
+ node.__transition__[id].event.on(type, listener);
+ });
+ }
+ return this;
+ };
+ d3_transitionPrototype.transition = function() {
+ var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
+ for (var j = 0, m = this.length; j < m; j++) {
+ subgroups.push(subgroup = []);
+ for (var group = this[j], i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ transition = Object.create(node.__transition__[id0]);
+ transition.delay += transition.duration;
+ d3_transitionNode(node, i, id1, transition);
+ }
+ subgroup.push(node);
+ }
+ }
+ return d3_transition(subgroups, id1);
+ };
+ d3_transitionPrototype.tween = function(name, tween) {
+ var id = this.id;
+ if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
+ return d3_selection_each(this, tween == null ? function(node) {
+ node.__transition__[id].tween.remove(name);
+ } : function(node) {
+ node.__transition__[id].tween.set(name, tween);
+ });
+ };
+ function d3_transition_tween(groups, name, value, tween) {
+ var id = groups.id;
+ return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
+ node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
+ } : (value = tween(value), function(node) {
+ node.__transition__[id].tween.set(name, value);
+ }));
+ }
+ var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
+ d3.timer = function(callback, delay, then) {
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
+ var timer = d3_timer_byId[callback.id];
+ if (timer && timer.callback === callback) {
+ timer.then = then;
+ timer.delay = delay;
+ } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = {
+ callback: callback,
+ then: then,
+ delay: delay,
+ next: d3_timer_queue
+ };
+ if (!d3_timer_interval) {
+ d3_timer_timeout = clearTimeout(d3_timer_timeout);
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ };
+ function d3_timer_step() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ var delay = d3_timer_flush() - now;
+ if (delay > 24) {
+ if (isFinite(delay)) {
+ clearTimeout(d3_timer_timeout);
+ d3_timer_timeout = setTimeout(d3_timer_step, delay);
+ }
+ d3_timer_interval = 0;
+ } else {
+ d3_timer_interval = 1;
+ d3_timer_frame(d3_timer_step);
+ }
+ }
+ d3.timer.flush = function() {
+ var elapsed, now = Date.now(), t1 = d3_timer_queue;
+ while (t1) {
+ elapsed = now - t1.then;
+ if (!t1.delay) t1.flush = t1.callback(elapsed);
+ t1 = t1.next;
+ }
+ d3_timer_flush();
+ };
+ function d3_timer_flush() {
+ var t0 = null, t1 = d3_timer_queue, then = Infinity;
+ while (t1) {
+ if (t1.flush) {
+ delete d3_timer_byId[t1.callback.id];
+ t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
+ } else {
+ then = Math.min(then, t1.then + t1.delay);
+ t1 = (t0 = t1).next;
+ }
+ }
+ return then;
+ }
+ var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) {
+ setTimeout(callback, 17);
+ };
+ d3.mouse = function(container) {
+ return d3_mousePoint(container, d3_eventSource());
+ };
+ var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
+ function d3_mousePoint(container, e) {
+ var svg = container.ownerSVGElement || container;
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
+ svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
+ var ctm = svg[0][0].getScreenCTM();
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
+ svg.remove();
+ }
+ if (d3_mouse_bug44083) {
+ point.x = e.pageX;
+ point.y = e.pageY;
+ } else {
+ point.x = e.clientX;
+ point.y = e.clientY;
+ }
+ point = point.matrixTransform(container.getScreenCTM().inverse());
+ return [ point.x, point.y ];
+ }
+ var rect = container.getBoundingClientRect();
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
+ }
+ d3.touches = function(container, touches) {
+ if (arguments.length < 2) touches = d3_eventSource().touches;
+ return touches ? d3_array(touches).map(function(touch) {
+ var point = d3_mousePoint(container, touch);
+ point.identifier = touch.identifier;
+ return point;
+ }) : [];
+ };
+ function d3_noop() {}
+ d3.scale = {};
+ function d3_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+ }
+ function d3_scale_nice(domain, nice) {
+ var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
+ if (x1 < x0) {
+ dx = i0, i0 = i1, i1 = dx;
+ dx = x0, x0 = x1, x1 = dx;
+ }
+ if (nice = nice(x1 - x0)) {
+ domain[i0] = nice.floor(x0);
+ domain[i1] = nice.ceil(x1);
+ }
+ return domain;
+ }
+ function d3_scale_niceDefault() {
+ return Math;
+ }
+ d3.scale.linear = function() {
+ return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
+ };
+ function d3_scale_linear(domain, range, interpolate, clamp) {
+ var output, input;
+ function rescale() {
+ var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
+ output = linear(domain, range, uninterpolate, interpolate);
+ input = linear(range, domain, uninterpolate, d3.interpolate);
+ return scale;
+ }
+ function scale(x) {
+ return output(x);
+ }
+ scale.invert = function(y) {
+ return input(y);
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(Number);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.rangeRound = function(x) {
+ return scale.range(x).interpolate(d3.interpolateRound);
+ };
+ scale.clamp = function(x) {
+ if (!arguments.length) return clamp;
+ clamp = x;
+ return rescale();
+ };
+ scale.interpolate = function(x) {
+ if (!arguments.length) return interpolate;
+ interpolate = x;
+ return rescale();
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ scale.nice = function() {
+ d3_scale_nice(domain, d3_scale_linearNice);
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_linear(domain, range, interpolate, clamp);
+ };
+ return rescale();
+ }
+ function d3_scale_linearRebind(scale, linear) {
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_scale_linearNice(dx) {
+ dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
+ return dx && {
+ floor: function(x) {
+ return Math.floor(x / dx) * dx;
+ },
+ ceil: function(x) {
+ return Math.ceil(x / dx) * dx;
+ }
+ };
+ }
+ function d3_scale_linearTickRange(domain, m) {
+ var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
+ if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
+ extent[0] = Math.ceil(extent[0] / step) * step;
+ extent[1] = Math.floor(extent[1] / step) * step + step * .5;
+ extent[2] = step;
+ return extent;
+ }
+ function d3_scale_linearTicks(domain, m) {
+ return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
+ }
+ function d3_scale_linearTickFormat(domain, m) {
+ return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
+ }
+ function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
+ var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
+ return function(x) {
+ return i(u(x));
+ };
+ }
+ function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
+ var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
+ if (domain[k] < domain[0]) {
+ domain = domain.slice().reverse();
+ range = range.slice().reverse();
+ }
+ while (++j <= k) {
+ u.push(uninterpolate(domain[j - 1], domain[j]));
+ i.push(interpolate(range[j - 1], range[j]));
+ }
+ return function(x) {
+ var j = d3.bisect(domain, x, 1, k) - 1;
+ return i[j](u[j](x));
+ };
+ }
+ d3.scale.log = function() {
+ return d3_scale_log(d3.scale.linear(), d3_scale_logp);
+ };
+ function d3_scale_log(linear, log) {
+ var pow = log.pow;
+ function scale(x) {
+ return linear(log(x));
+ }
+ scale.invert = function(x) {
+ return pow(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(pow);
+ log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
+ pow = log.pow;
+ linear.domain(x.map(log));
+ return scale;
+ };
+ scale.nice = function() {
+ linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
+ return scale;
+ };
+ scale.ticks = function() {
+ var extent = d3_scaleExtent(linear.domain()), ticks = [];
+ if (extent.every(isFinite)) {
+ var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
+ if (log === d3_scale_logn) {
+ ticks.push(pow(i));
+ for (;i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
+ } else {
+ for (;i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
+ ticks.push(pow(i));
+ }
+ for (i = 0; ticks[i] < u; i++) {}
+ for (j = ticks.length; ticks[j - 1] > v; j--) {}
+ ticks = ticks.slice(i, j);
+ }
+ return ticks;
+ };
+ scale.tickFormat = function(n, format) {
+ if (arguments.length < 2) format = d3_scale_logFormat;
+ if (!arguments.length) return format;
+ var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12,
+ Math.floor) : (e = 1e-12, Math.ceil), e;
+ return function(d) {
+ return d / pow(f(log(d) + e)) <= k ? format(d) : "";
+ };
+ };
+ scale.copy = function() {
+ return d3_scale_log(linear.copy(), log);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ var d3_scale_logFormat = d3.format(".0e");
+ function d3_scale_logp(x) {
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
+ }
+ function d3_scale_logn(x) {
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
+ }
+ d3_scale_logp.pow = function(x) {
+ return Math.pow(10, x);
+ };
+ d3_scale_logn.pow = function(x) {
+ return -Math.pow(10, -x);
+ };
+ d3.scale.pow = function() {
+ return d3_scale_pow(d3.scale.linear(), 1);
+ };
+ function d3_scale_pow(linear, exponent) {
+ var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
+ function scale(x) {
+ return linear(powp(x));
+ }
+ scale.invert = function(x) {
+ return powb(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(powb);
+ linear.domain(x.map(powp));
+ return scale;
+ };
+ scale.ticks = function(m) {
+ return d3_scale_linearTicks(scale.domain(), m);
+ };
+ scale.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(scale.domain(), m);
+ };
+ scale.nice = function() {
+ return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
+ };
+ scale.exponent = function(x) {
+ if (!arguments.length) return exponent;
+ var domain = scale.domain();
+ powp = d3_scale_powPow(exponent = x);
+ powb = d3_scale_powPow(1 / exponent);
+ return scale.domain(domain);
+ };
+ scale.copy = function() {
+ return d3_scale_pow(linear.copy(), exponent);
+ };
+ return d3_scale_linearRebind(scale, linear);
+ }
+ function d3_scale_powPow(e) {
+ return function(x) {
+ return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
+ };
+ }
+ d3.scale.sqrt = function() {
+ return d3.scale.pow().exponent(.5);
+ };
+ d3.scale.ordinal = function() {
+ return d3_scale_ordinal([], {
+ t: "range",
+ a: [ [] ]
+ });
+ };
+ function d3_scale_ordinal(domain, ranger) {
+ var index, range, rangeBand;
+ function scale(x) {
+ return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
+ }
+ function steps(start, step) {
+ return d3.range(domain.length).map(function(i) {
+ return start + step * i;
+ });
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = [];
+ index = new d3_Map();
+ var i = -1, n = x.length, xi;
+ while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
+ return scale[ranger.t].apply(scale, ranger.a);
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ rangeBand = 0;
+ ranger = {
+ t: "range",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangePoints = function(x, padding) {
+ if (arguments.length < 2) padding = 0;
+ var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
+ range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
+ rangeBand = 0;
+ ranger = {
+ t: "rangePoints",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
+ range = steps(start + step * outerPadding, step);
+ if (reverse) range.reverse();
+ rangeBand = step * (1 - padding);
+ ranger = {
+ t: "rangeBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeRoundBands = function(x, padding, outerPadding) {
+ if (arguments.length < 2) padding = 0;
+ if (arguments.length < 3) outerPadding = padding;
+ var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
+ range = steps(start + Math.round(error / 2), step);
+ if (reverse) range.reverse();
+ rangeBand = Math.round(step * (1 - padding));
+ ranger = {
+ t: "rangeRoundBands",
+ a: arguments
+ };
+ return scale;
+ };
+ scale.rangeBand = function() {
+ return rangeBand;
+ };
+ scale.rangeExtent = function() {
+ return d3_scaleExtent(ranger.a[0]);
+ };
+ scale.copy = function() {
+ return d3_scale_ordinal(domain, ranger);
+ };
+ return scale.domain(domain);
+ }
+ d3.scale.category10 = function() {
+ return d3.scale.ordinal().range(d3_category10);
+ };
+ d3.scale.category20 = function() {
+ return d3.scale.ordinal().range(d3_category20);
+ };
+ d3.scale.category20b = function() {
+ return d3.scale.ordinal().range(d3_category20b);
+ };
+ d3.scale.category20c = function() {
+ return d3.scale.ordinal().range(d3_category20c);
+ };
+ var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
+ var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
+ var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
+ var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
+ d3.scale.quantile = function() {
+ return d3_scale_quantile([], []);
+ };
+ function d3_scale_quantile(domain, range) {
+ var thresholds;
+ function rescale() {
+ var k = 0, q = range.length;
+ thresholds = [];
+ while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
+ return scale;
+ }
+ function scale(x) {
+ if (isNaN(x = +x)) return NaN;
+ return range[d3.bisect(thresholds, x)];
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.filter(function(d) {
+ return !isNaN(d);
+ }).sort(d3.ascending);
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.quantiles = function() {
+ return thresholds;
+ };
+ scale.copy = function() {
+ return d3_scale_quantile(domain, range);
+ };
+ return rescale();
+ }
+ d3.scale.quantize = function() {
+ return d3_scale_quantize(0, 1, [ 0, 1 ]);
+ };
+ function d3_scale_quantize(x0, x1, range) {
+ var kx, i;
+ function scale(x) {
+ return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
+ }
+ function rescale() {
+ kx = range.length / (x1 - x0);
+ i = range.length - 1;
+ return scale;
+ }
+ scale.domain = function(x) {
+ if (!arguments.length) return [ x0, x1 ];
+ x0 = +x[0];
+ x1 = +x[x.length - 1];
+ return rescale();
+ };
+ scale.range = function(x) {
+ if (!arguments.length) return range;
+ range = x;
+ return rescale();
+ };
+ scale.copy = function() {
+ return d3_scale_quantize(x0, x1, range);
+ };
+ return rescale();
+ }
+ d3.scale.threshold = function() {
+ return d3_scale_threshold([ .5 ], [ 0, 1 ]);
+ };
+ function d3_scale_threshold(domain, range) {
+ function scale(x) {
+ return range[d3.bisect(domain, x)];
+ }
+ scale.domain = function(_) {
+ if (!arguments.length) return domain;
+ domain = _;
+ return scale;
+ };
+ scale.range = function(_) {
+ if (!arguments.length) return range;
+ range = _;
+ return scale;
+ };
+ scale.copy = function() {
+ return d3_scale_threshold(domain, range);
+ };
+ return scale;
+ }
+ d3.scale.identity = function() {
+ return d3_scale_identity([ 0, 1 ]);
+ };
+ function d3_scale_identity(domain) {
+ function identity(x) {
+ return +x;
+ }
+ identity.invert = identity;
+ identity.domain = identity.range = function(x) {
+ if (!arguments.length) return domain;
+ domain = x.map(identity);
+ return identity;
+ };
+ identity.ticks = function(m) {
+ return d3_scale_linearTicks(domain, m);
+ };
+ identity.tickFormat = function(m) {
+ return d3_scale_linearTickFormat(domain, m);
+ };
+ identity.copy = function() {
+ return d3_scale_identity(domain);
+ };
+ return identity;
+ }
+ d3.svg = {};
+ d3.svg.arc = function() {
+ var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ function arc() {
+ var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0,
+ a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
+ return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
+ }
+ arc.innerRadius = function(v) {
+ if (!arguments.length) return innerRadius;
+ innerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.outerRadius = function(v) {
+ if (!arguments.length) return outerRadius;
+ outerRadius = d3_functor(v);
+ return arc;
+ };
+ arc.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return arc;
+ };
+ arc.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return arc;
+ };
+ arc.centroid = function() {
+ var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
+ return [ Math.cos(a) * r, Math.sin(a) * r ];
+ };
+ return arc;
+ };
+ var d3_svg_arcOffset = -π / 2, d3_svg_arcMax = 2 * π - 1e-6;
+ function d3_svg_arcInnerRadius(d) {
+ return d.innerRadius;
+ }
+ function d3_svg_arcOuterRadius(d) {
+ return d.outerRadius;
+ }
+ function d3_svg_arcStartAngle(d) {
+ return d.startAngle;
+ }
+ function d3_svg_arcEndAngle(d) {
+ return d.endAngle;
+ }
+ function d3_svg_line(projection) {
+ var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
+ function line(data) {
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
+ function segment() {
+ segments.push("M", interpolate(projection(points), tension));
+ }
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
+ } else if (points.length) {
+ segment();
+ points = [];
+ }
+ }
+ if (points.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ line.x = function(_) {
+ if (!arguments.length) return x;
+ x = _;
+ return line;
+ };
+ line.y = function(_) {
+ if (!arguments.length) return y;
+ y = _;
+ return line;
+ };
+ line.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return line;
+ };
+ line.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ return line;
+ };
+ line.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return line;
+ };
+ return line;
+ }
+ d3.svg.line = function() {
+ return d3_svg_line(d3_identity);
+ };
+ function d3_svg_lineX(d) {
+ return d[0];
+ }
+ function d3_svg_lineY(d) {
+ return d[1];
+ }
+ var d3_svg_lineInterpolators = d3.map({
+ linear: d3_svg_lineLinear,
+ "linear-closed": d3_svg_lineLinearClosed,
+ "step-before": d3_svg_lineStepBefore,
+ "step-after": d3_svg_lineStepAfter,
+ basis: d3_svg_lineBasis,
+ "basis-open": d3_svg_lineBasisOpen,
+ "basis-closed": d3_svg_lineBasisClosed,
+ bundle: d3_svg_lineBundle,
+ cardinal: d3_svg_lineCardinal,
+ "cardinal-open": d3_svg_lineCardinalOpen,
+ "cardinal-closed": d3_svg_lineCardinalClosed,
+ monotone: d3_svg_lineMonotone
+ });
+ d3_svg_lineInterpolators.forEach(function(key, value) {
+ value.key = key;
+ value.closed = /-closed$/.test(key);
+ });
+ function d3_svg_lineLinear(points) {
+ return points.join("L");
+ }
+ function d3_svg_lineLinearClosed(points) {
+ return d3_svg_lineLinear(points) + "Z";
+ }
+ function d3_svg_lineStepBefore(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
+ return path.join("");
+ }
+ function d3_svg_lineStepAfter(points) {
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
+ return path.join("");
+ }
+ function d3_svg_lineCardinalOpen(points, tension) {
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineCardinalClosed(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
+ points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
+ }
+ function d3_svg_lineCardinal(points, tension) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
+ }
+ function d3_svg_lineHermite(points, tangents) {
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
+ return d3_svg_lineLinear(points);
+ }
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
+ if (quad) {
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
+ p0 = points[1];
+ pi = 2;
+ }
+ if (tangents.length > 1) {
+ t = tangents[1];
+ p = points[pi];
+ pi++;
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ for (var i = 2; i < tangents.length; i++, pi++) {
+ p = points[pi];
+ t = tangents[i];
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
+ }
+ }
+ if (quad) {
+ var lp = points[pi];
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
+ }
+ return path;
+ }
+ function d3_svg_lineCardinalTangents(points, tension) {
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
+ while (++i < n) {
+ p0 = p1;
+ p1 = p2;
+ p2 = points[i];
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineBasis(points) {
+ if (points.length < 3) return d3_svg_lineLinear(points);
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
+ d3_svg_lineBasisBezier(path, px, py);
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ i = -1;
+ while (++i < 2) {
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisOpen(points) {
+ if (points.length < 4) return d3_svg_lineLinear(points);
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
+ while (++i < 3) {
+ pi = points[i];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
+ --i;
+ while (++i < n) {
+ pi = points[i];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBasisClosed(points) {
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
+ while (++i < 4) {
+ pi = points[i % n];
+ px.push(pi[0]);
+ py.push(pi[1]);
+ }
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
+ --i;
+ while (++i < m) {
+ pi = points[i % n];
+ px.shift();
+ px.push(pi[0]);
+ py.shift();
+ py.push(pi[1]);
+ d3_svg_lineBasisBezier(path, px, py);
+ }
+ return path.join("");
+ }
+ function d3_svg_lineBundle(points, tension) {
+ var n = points.length - 1;
+ if (n) {
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
+ while (++i <= n) {
+ p = points[i];
+ t = i / n;
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
+ }
+ }
+ return d3_svg_lineBasis(points);
+ }
+ function d3_svg_lineDot4(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ }
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
+ function d3_svg_lineBasisBezier(path, x, y) {
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
+ }
+ function d3_svg_lineSlope(p0, p1) {
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
+ }
+ function d3_svg_lineFiniteDifferences(points) {
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
+ while (++i < j) {
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
+ }
+ m[i] = d;
+ return m;
+ }
+ function d3_svg_lineMonotoneTangents(points) {
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
+ while (++i < j) {
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
+ if (Math.abs(d) < 1e-6) {
+ m[i] = m[i + 1] = 0;
+ } else {
+ a = m[i] / d;
+ b = m[i + 1] / d;
+ s = a * a + b * b;
+ if (s > 9) {
+ s = d * 3 / Math.sqrt(s);
+ m[i] = s * a;
+ m[i + 1] = s * b;
+ }
+ }
+ }
+ i = -1;
+ while (++i <= j) {
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
+ tangents.push([ s || 0, m[i] * s || 0 ]);
+ }
+ return tangents;
+ }
+ function d3_svg_lineMonotone(points) {
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
+ }
+ d3.svg.line.radial = function() {
+ var line = d3_svg_line(d3_svg_lineRadial);
+ line.radius = line.x, delete line.x;
+ line.angle = line.y, delete line.y;
+ return line;
+ };
+ function d3_svg_lineRadial(points) {
+ var point, i = -1, n = points.length, r, a;
+ while (++i < n) {
+ point = points[i];
+ r = point[0];
+ a = point[1] + d3_svg_arcOffset;
+ point[0] = r * Math.cos(a);
+ point[1] = r * Math.sin(a);
+ }
+ return points;
+ }
+ function d3_svg_area(projection) {
+ var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
+ function area(data) {
+ var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
+ return x;
+ } : d3_functor(x1), fy1 = y0 === y1 ? function() {
+ return y;
+ } : d3_functor(y1), x, y;
+ function segment() {
+ segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
+ }
+ while (++i < n) {
+ if (defined.call(this, d = data[i], i)) {
+ points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
+ points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
+ } else if (points0.length) {
+ segment();
+ points0 = [];
+ points1 = [];
+ }
+ }
+ if (points0.length) segment();
+ return segments.length ? segments.join("") : null;
+ }
+ area.x = function(_) {
+ if (!arguments.length) return x1;
+ x0 = x1 = _;
+ return area;
+ };
+ area.x0 = function(_) {
+ if (!arguments.length) return x0;
+ x0 = _;
+ return area;
+ };
+ area.x1 = function(_) {
+ if (!arguments.length) return x1;
+ x1 = _;
+ return area;
+ };
+ area.y = function(_) {
+ if (!arguments.length) return y1;
+ y0 = y1 = _;
+ return area;
+ };
+ area.y0 = function(_) {
+ if (!arguments.length) return y0;
+ y0 = _;
+ return area;
+ };
+ area.y1 = function(_) {
+ if (!arguments.length) return y1;
+ y1 = _;
+ return area;
+ };
+ area.defined = function(_) {
+ if (!arguments.length) return defined;
+ defined = _;
+ return area;
+ };
+ area.interpolate = function(_) {
+ if (!arguments.length) return interpolateKey;
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
+ interpolateReverse = interpolate.reverse || interpolate;
+ L = interpolate.closed ? "M" : "L";
+ return area;
+ };
+ area.tension = function(_) {
+ if (!arguments.length) return tension;
+ tension = _;
+ return area;
+ };
+ return area;
+ }
+ d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
+ d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
+ d3.svg.area = function() {
+ return d3_svg_area(d3_identity);
+ };
+ d3.svg.area.radial = function() {
+ var area = d3_svg_area(d3_svg_lineRadial);
+ area.radius = area.x, delete area.x;
+ area.innerRadius = area.x0, delete area.x0;
+ area.outerRadius = area.x1, delete area.x1;
+ area.angle = area.y, delete area.y;
+ area.startAngle = area.y0, delete area.y0;
+ area.endAngle = area.y1, delete area.y1;
+ return area;
+ };
+ d3.svg.chord = function() {
+ var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
+ function chord(d, i) {
+ var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
+ return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
+ }
+ function subgroup(self, f, d, i) {
+ var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
+ return {
+ r: r,
+ a0: a0,
+ a1: a1,
+ p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
+ p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
+ };
+ }
+ function equals(a, b) {
+ return a.a0 == b.a0 && a.a1 == b.a1;
+ }
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
+ }
+ function curve(r0, p0, r1, p1) {
+ return "Q 0,0 " + p1;
+ }
+ chord.radius = function(v) {
+ if (!arguments.length) return radius;
+ radius = d3_functor(v);
+ return chord;
+ };
+ chord.source = function(v) {
+ if (!arguments.length) return source;
+ source = d3_functor(v);
+ return chord;
+ };
+ chord.target = function(v) {
+ if (!arguments.length) return target;
+ target = d3_functor(v);
+ return chord;
+ };
+ chord.startAngle = function(v) {
+ if (!arguments.length) return startAngle;
+ startAngle = d3_functor(v);
+ return chord;
+ };
+ chord.endAngle = function(v) {
+ if (!arguments.length) return endAngle;
+ endAngle = d3_functor(v);
+ return chord;
+ };
+ return chord;
+ };
+ function d3_svg_chordRadius(d) {
+ return d.radius;
+ }
+ d3.svg.diagonal = function() {
+ var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
+ function diagonal(d, i) {
+ var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
+ x: p0.x,
+ y: m
+ }, {
+ x: p3.x,
+ y: m
+ }, p3 ];
+ p = p.map(projection);
+ return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
+ }
+ diagonal.source = function(x) {
+ if (!arguments.length) return source;
+ source = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.target = function(x) {
+ if (!arguments.length) return target;
+ target = d3_functor(x);
+ return diagonal;
+ };
+ diagonal.projection = function(x) {
+ if (!arguments.length) return projection;
+ projection = x;
+ return diagonal;
+ };
+ return diagonal;
+ };
+ function d3_svg_diagonalProjection(d) {
+ return [ d.x, d.y ];
+ }
+ d3.svg.diagonal.radial = function() {
+ var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
+ diagonal.projection = function(x) {
+ return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
+ };
+ return diagonal;
+ };
+ function d3_svg_diagonalRadialProjection(projection) {
+ return function() {
+ var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
+ return [ r * Math.cos(a), r * Math.sin(a) ];
+ };
+ }
+ d3.svg.symbol = function() {
+ var type = d3_svg_symbolType, size = d3_svg_symbolSize;
+ function symbol(d, i) {
+ return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
+ }
+ symbol.type = function(x) {
+ if (!arguments.length) return type;
+ type = d3_functor(x);
+ return symbol;
+ };
+ symbol.size = function(x) {
+ if (!arguments.length) return size;
+ size = d3_functor(x);
+ return symbol;
+ };
+ return symbol;
+ };
+ function d3_svg_symbolSize() {
+ return 64;
+ }
+ function d3_svg_symbolType() {
+ return "circle";
+ }
+ function d3_svg_symbolCircle(size) {
+ var r = Math.sqrt(size / π);
+ return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
+ }
+ var d3_svg_symbols = d3.map({
+ circle: d3_svg_symbolCircle,
+ cross: function(size) {
+ var r = Math.sqrt(size / 5) / 2;
+ return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
+ },
+ diamond: function(size) {
+ var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
+ return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
+ },
+ square: function(size) {
+ var r = Math.sqrt(size) / 2;
+ return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
+ },
+ "triangle-down": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
+ },
+ "triangle-up": function(size) {
+ var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
+ return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
+ }
+ });
+ d3.svg.symbolTypes = d3_svg_symbols.keys();
+ var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
+ d3.svg.axis = function() {
+ var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
+ function axis(g) {
+ g.each(function() {
+ var g = d3.select(this);
+ var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
+ d3.transition(path));
+ var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
+ tickEnter.append("line");
+ tickEnter.append("text");
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
+ switch (orient) {
+ case "bottom":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ lineEnter.attr("y2", tickMajorSize);
+ textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
+ text.attr("dy", ".71em").style("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
+ break;
+ }
+
+ case "top":
+ {
+ tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
+ subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ lineEnter.attr("y2", -tickMajorSize);
+ textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
+ textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
+ text.attr("dy", "0em").style("text-anchor", "middle");
+ pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
+ break;
+ }
+
+ case "left":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
+ subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", -tickMajorSize);
+ textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
+ lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
+ text.attr("dy", ".32em").style("text-anchor", "end");
+ pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
+ break;
+ }
+
+ case "right":
+ {
+ tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
+ subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ lineEnter.attr("x2", tickMajorSize);
+ textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
+ lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
+ textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
+ text.attr("dy", ".32em").style("text-anchor", "start");
+ pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
+ break;
+ }
+ }
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ } else {
+ var dx = scale1.rangeBand() / 2, x = function(d) {
+ return scale1(d) + dx;
+ };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
+ });
+ }
+ axis.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = x;
+ return axis;
+ };
+ axis.orient = function(x) {
+ if (!arguments.length) return orient;
+ orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
+ return axis;
+ };
+ axis.ticks = function() {
+ if (!arguments.length) return tickArguments_;
+ tickArguments_ = arguments;
+ return axis;
+ };
+ axis.tickValues = function(x) {
+ if (!arguments.length) return tickValues;
+ tickValues = x;
+ return axis;
+ };
+ axis.tickFormat = function(x) {
+ if (!arguments.length) return tickFormat_;
+ tickFormat_ = x;
+ return axis;
+ };
+ axis.tickSize = function(x, y) {
+ if (!arguments.length) return tickMajorSize;
+ var n = arguments.length - 1;
+ tickMajorSize = +x;
+ tickMinorSize = n > 1 ? +y : tickMajorSize;
+ tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
+ return axis;
+ };
+ axis.tickPadding = function(x) {
+ if (!arguments.length) return tickPadding;
+ tickPadding = +x;
+ return axis;
+ };
+ axis.tickSubdivide = function(x) {
+ if (!arguments.length) return tickSubdivide;
+ tickSubdivide = +x;
+ return axis;
+ };
+ return axis;
+ };
+ var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
+ top: 1,
+ right: 1,
+ bottom: 1,
+ left: 1
+ };
+ function d3_svg_axisX(selection, x) {
+ selection.attr("transform", function(d) {
+ return "translate(" + x(d) + ",0)";
+ });
+ }
+ function d3_svg_axisY(selection, y) {
+ selection.attr("transform", function(d) {
+ return "translate(0," + y(d) + ")";
+ });
+ }
+ function d3_svg_axisSubdivide(scale, ticks, m) {
+ subticks = [];
+ if (m && ticks.length > 1) {
+ var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
+ while (++i < n) {
+ for (j = m; --j > 0; ) {
+ if ((v = +ticks[i] - j * d) >= extent[0]) {
+ subticks.push(v);
+ }
+ }
+ }
+ for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
+ subticks.push(v);
+ }
+ }
+ return subticks;
+ }
+ d3.svg.brush = function() {
+ var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
+ function brush(g) {
+ g.each(function() {
+ var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
+ g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
+ bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
+ fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
+ tz.enter().append("g").attr("class", function(d) {
+ return "resize " + d;
+ }).style("cursor", function(d) {
+ return d3_svg_brushCursor[d];
+ }).append("rect").attr("x", function(d) {
+ return /[ew]$/.test(d) ? -3 : null;
+ }).attr("y", function(d) {
+ return /^[ns]/.test(d) ? -3 : null;
+ }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
+ tz.style("display", brush.empty() ? "none" : null);
+ tz.exit().remove();
+ if (x) {
+ e = d3_scaleRange(x);
+ bg.attr("x", e[0]).attr("width", e[1] - e[0]);
+ redrawX(g);
+ }
+ if (y) {
+ e = d3_scaleRange(y);
+ bg.attr("y", e[0]).attr("height", e[1] - e[0]);
+ redrawY(g);
+ }
+ redraw(g);
+ });
+ }
+ function redraw(g) {
+ g.selectAll(".resize").attr("transform", function(d) {
+ return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
+ });
+ }
+ function redrawX(g) {
+ g.select(".extent").attr("x", extent[0][0]);
+ g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
+ }
+ function redrawY(g) {
+ g.select(".extent").attr("y", extent[0][1]);
+ g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
+ }
+ function brushstart() {
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
+ var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
+ if (dragging) {
+ origin[0] = extent[0][0] - origin[0];
+ origin[1] = extent[0][1] - origin[1];
+ } else if (resizing) {
+ var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
+ offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
+ origin[0] = extent[ex][0];
+ origin[1] = extent[ey][1];
+ } else if (d3.event.altKey) center = origin.slice();
+ g.style("pointer-events", "none").selectAll(".resize").style("display", null);
+ d3.select("body").style("cursor", eventTarget.style("cursor"));
+ event_({
+ type: "brushstart"
+ });
+ brushmove();
+ d3_eventCancel();
+ function mouse() {
+ var touches = d3.event.changedTouches;
+ return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
+ }
+ function keydown() {
+ if (d3.event.keyCode == 32) {
+ if (!dragging) {
+ center = null;
+ origin[0] -= extent[1][0];
+ origin[1] -= extent[1][1];
+ dragging = 2;
+ }
+ d3_eventCancel();
+ }
+ }
+ function keyup() {
+ if (d3.event.keyCode == 32 && dragging == 2) {
+ origin[0] += extent[1][0];
+ origin[1] += extent[1][1];
+ dragging = 0;
+ d3_eventCancel();
+ }
+ }
+ function brushmove() {
+ var point = mouse(), moved = false;
+ if (offset) {
+ point[0] += offset[0];
+ point[1] += offset[1];
+ }
+ if (!dragging) {
+ if (d3.event.altKey) {
+ if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
+ origin[0] = extent[+(point[0] < center[0])][0];
+ origin[1] = extent[+(point[1] < center[1])][1];
+ } else center = null;
+ }
+ if (resizingX && move1(point, x, 0)) {
+ redrawX(g);
+ moved = true;
+ }
+ if (resizingY && move1(point, y, 1)) {
+ redrawY(g);
+ moved = true;
+ }
+ if (moved) {
+ redraw(g);
+ event_({
+ type: "brush",
+ mode: dragging ? "move" : "resize"
+ });
+ }
+ }
+ function move1(point, scale, i) {
+ var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
+ if (dragging) {
+ r0 -= position;
+ r1 -= size + position;
+ }
+ min = Math.max(r0, Math.min(r1, point[i]));
+ if (dragging) {
+ max = (min += position) + size;
+ } else {
+ if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
+ if (position < min) {
+ max = min;
+ min = position;
+ } else {
+ max = position;
+ }
+ }
+ if (extent[0][i] !== min || extent[1][i] !== max) {
+ extentDomain = null;
+ extent[0][i] = min;
+ extent[1][i] = max;
+ return true;
+ }
+ }
+ function brushend() {
+ brushmove();
+ g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
+ d3.select("body").style("cursor", null);
+ w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
+ event_({
+ type: "brushend"
+ });
+ d3_eventCancel();
+ }
+ }
+ brush.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ resizes = d3_svg_brushResizes[!x << 1 | !y];
+ return brush;
+ };
+ brush.extent = function(z) {
+ var x0, x1, y0, y1, t;
+ if (!arguments.length) {
+ z = extentDomain || extent;
+ if (x) {
+ x0 = z[0][0], x1 = z[1][0];
+ if (!extentDomain) {
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ }
+ }
+ if (y) {
+ y0 = z[0][1], y1 = z[1][1];
+ if (!extentDomain) {
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ }
+ }
+ return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
+ }
+ extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
+ if (x) {
+ x0 = z[0], x1 = z[1];
+ if (y) x0 = x0[0], x1 = x1[0];
+ extentDomain[0][0] = x0, extentDomain[1][0] = x1;
+ if (x.invert) x0 = x(x0), x1 = x(x1);
+ if (x1 < x0) t = x0, x0 = x1, x1 = t;
+ extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
+ }
+ if (y) {
+ y0 = z[0], y1 = z[1];
+ if (x) y0 = y0[1], y1 = y1[1];
+ extentDomain[0][1] = y0, extentDomain[1][1] = y1;
+ if (y.invert) y0 = y(y0), y1 = y(y1);
+ if (y1 < y0) t = y0, y0 = y1, y1 = t;
+ extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
+ }
+ return brush;
+ };
+ brush.clear = function() {
+ extentDomain = null;
+ extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
+ return brush;
+ };
+ brush.empty = function() {
+ return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
+ };
+ return d3.rebind(brush, event, "on");
+ };
+ var d3_svg_brushCursor = {
+ n: "ns-resize",
+ e: "ew-resize",
+ s: "ns-resize",
+ w: "ew-resize",
+ nw: "nwse-resize",
+ ne: "nesw-resize",
+ se: "nwse-resize",
+ sw: "nesw-resize"
+ };
+ var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
+ d3.behavior = {};
+ d3.behavior.drag = function() {
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
+ function drag() {
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
+ }
+ function mousedown() {
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0;
+ var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
+ if (origin) {
+ offset = origin.apply(target, arguments);
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
+ } else {
+ offset = [ 0, 0 ];
+ }
+ if (touchId == null) d3_eventCancel();
+ event_({
+ type: "dragstart"
+ });
+ function point() {
+ var p = target.parentNode;
+ return touchId != null ? d3.touches(p).filter(function(p) {
+ return p.identifier === touchId;
+ })[0] : d3.mouse(p);
+ }
+ function dragmove() {
+ if (!target.parentNode) return dragend();
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
+ moved |= dx | dy;
+ origin_ = p;
+ d3_eventCancel();
+ event_({
+ type: "drag",
+ x: p[0] + offset[0],
+ y: p[1] + offset[1],
+ dx: dx,
+ dy: dy
+ });
+ }
+ function dragend() {
+ event_({
+ type: "dragend"
+ });
+ if (moved) {
+ d3_eventCancel();
+ if (d3.event.target === eventTarget) w.on("click.drag", click, true);
+ }
+ w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.drag", null);
+ }
+ }
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return drag;
+ };
+ return d3.rebind(drag, event, "on");
+ };
+ d3.behavior.zoom = function() {
+ var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
+ function zoom() {
+ this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
+ }
+ zoom.translate = function(x) {
+ if (!arguments.length) return translate;
+ translate = x.map(Number);
+ rescale();
+ return zoom;
+ };
+ zoom.scale = function(x) {
+ if (!arguments.length) return scale;
+ scale = +x;
+ rescale();
+ return zoom;
+ };
+ zoom.scaleExtent = function(x) {
+ if (!arguments.length) return scaleExtent;
+ scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
+ return zoom;
+ };
+ zoom.x = function(z) {
+ if (!arguments.length) return x1;
+ x1 = z;
+ x0 = z.copy();
+ translate = [ 0, 0 ];
+ scale = 1;
+ return zoom;
+ };
+ zoom.y = function(z) {
+ if (!arguments.length) return y1;
+ y1 = z;
+ y0 = z.copy();
+ translate = [ 0, 0 ];
+ scale = 1;
+ return zoom;
+ };
+ function location(p) {
+ return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
+ }
+ function point(l) {
+ return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
+ }
+ function scaleTo(s) {
+ scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
+ }
+ function translateTo(p, l) {
+ l = point(l);
+ translate[0] += p[0] - l[0];
+ translate[1] += p[1] - l[1];
+ }
+ function rescale() {
+ if (x1) x1.domain(x0.range().map(function(x) {
+ return (x - translate[0]) / scale;
+ }).map(x0.invert));
+ if (y1) y1.domain(y0.range().map(function(y) {
+ return (y - translate[1]) / scale;
+ }).map(y0.invert));
+ }
+ function dispatch(event) {
+ rescale();
+ d3.event.preventDefault();
+ event({
+ type: "zoom",
+ scale: scale,
+ translate: translate
+ });
+ }
+ function mousedown() {
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
+ d3_window.focus();
+ d3_eventCancel();
+ function mousemove() {
+ moved = 1;
+ translateTo(d3.mouse(target), l);
+ dispatch(event_);
+ }
+ function mouseup() {
+ if (moved) d3_eventCancel();
+ w.on("mousemove.zoom", null).on("mouseup.zoom", null);
+ if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
+ }
+ function click() {
+ d3_eventCancel();
+ w.on("click.zoom", null);
+ }
+ }
+ function mousewheel() {
+ if (!translate0) translate0 = location(d3.mouse(this));
+ scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
+ translateTo(d3.mouse(this), translate0);
+ dispatch(event.of(this, arguments));
+ }
+ function mousemove() {
+ translate0 = null;
+ }
+ function dblclick() {
+ var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2;
+ scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ function touchstart() {
+ var touches = d3.touches(this), now = Date.now();
+ scale0 = scale;
+ translate0 = {};
+ touches.forEach(function(t) {
+ translate0[t.identifier] = location(t);
+ });
+ d3_eventCancel();
+ if (touches.length === 1) {
+ if (now - touchtime < 500) {
+ var p = touches[0], l = location(touches[0]);
+ scaleTo(scale * 2);
+ translateTo(p, l);
+ dispatch(event.of(this, arguments));
+ }
+ touchtime = now;
+ }
+ }
+ function touchmove() {
+ var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
+ if (p1 = touches[1]) {
+ var p1, l1 = translate0[p1.identifier];
+ p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
+ l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
+ scaleTo(d3.event.scale * scale0);
+ }
+ translateTo(p0, l0);
+ touchtime = null;
+ dispatch(event.of(this, arguments));
+ }
+ return d3.rebind(zoom, event, "on");
+ };
+ var d3_behavior_zoomInfinity = [ 0, Infinity ];
+ var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in document ? (d3_behavior_zoomDelta = function() {
+ return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
+ }, "wheel") : "onmousewheel" in document ? (d3_behavior_zoomDelta = function() {
+ return d3.event.wheelDelta;
+ }, "mousewheel") : (d3_behavior_zoomDelta = function() {
+ return -d3.event.detail;
+ }, "MozMousePixelScroll");
+ d3.layout = {};
+ d3.layout.bundle = function() {
+ return function(links) {
+ var paths = [], i = -1, n = links.length;
+ while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
+ return paths;
+ };
+ };
+ function d3_layout_bundlePath(link) {
+ var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
+ while (start !== lca) {
+ start = start.parent;
+ points.push(start);
+ }
+ var k = points.length;
+ while (end !== lca) {
+ points.splice(k, 0, end);
+ end = end.parent;
+ }
+ return points;
+ }
+ function d3_layout_bundleAncestors(node) {
+ var ancestors = [], parent = node.parent;
+ while (parent != null) {
+ ancestors.push(node);
+ node = parent;
+ parent = parent.parent;
+ }
+ ancestors.push(node);
+ return ancestors;
+ }
+ function d3_layout_bundleLeastCommonAncestor(a, b) {
+ if (a === b) return a;
+ var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
+ while (aNode === bNode) {
+ sharedNode = aNode;
+ aNode = aNodes.pop();
+ bNode = bNodes.pop();
+ }
+ return sharedNode;
+ }
+ d3.layout.chord = function() {
+ var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
+ function relayout() {
+ var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
+ chords = [];
+ groups = [];
+ k = 0, i = -1;
+ while (++i < n) {
+ x = 0, j = -1;
+ while (++j < n) {
+ x += matrix[i][j];
+ }
+ groupSums.push(x);
+ subgroupIndex.push(d3.range(n));
+ k += x;
+ }
+ if (sortGroups) {
+ groupIndex.sort(function(a, b) {
+ return sortGroups(groupSums[a], groupSums[b]);
+ });
+ }
+ if (sortSubgroups) {
+ subgroupIndex.forEach(function(d, i) {
+ d.sort(function(a, b) {
+ return sortSubgroups(matrix[i][a], matrix[i][b]);
+ });
+ });
+ }
+ k = (2 * π - padding * n) / k;
+ x = 0, i = -1;
+ while (++i < n) {
+ x0 = x, j = -1;
+ while (++j < n) {
+ var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
+ subgroups[di + "-" + dj] = {
+ index: di,
+ subindex: dj,
+ startAngle: a0,
+ endAngle: a1,
+ value: v
+ };
+ }
+ groups[di] = {
+ index: di,
+ startAngle: x0,
+ endAngle: x,
+ value: (x - x0) / k
+ };
+ x += padding;
+ }
+ i = -1;
+ while (++i < n) {
+ j = i - 1;
+ while (++j < n) {
+ var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
+ if (source.value || target.value) {
+ chords.push(source.value < target.value ? {
+ source: target,
+ target: source
+ } : {
+ source: source,
+ target: target
+ });
+ }
+ }
+ }
+ if (sortChords) resort();
+ }
+ function resort() {
+ chords.sort(function(a, b) {
+ return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
+ });
+ }
+ chord.matrix = function(x) {
+ if (!arguments.length) return matrix;
+ n = (matrix = x) && matrix.length;
+ chords = groups = null;
+ return chord;
+ };
+ chord.padding = function(x) {
+ if (!arguments.length) return padding;
+ padding = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortGroups = function(x) {
+ if (!arguments.length) return sortGroups;
+ sortGroups = x;
+ chords = groups = null;
+ return chord;
+ };
+ chord.sortSubgroups = function(x) {
+ if (!arguments.length) return sortSubgroups;
+ sortSubgroups = x;
+ chords = null;
+ return chord;
+ };
+ chord.sortChords = function(x) {
+ if (!arguments.length) return sortChords;
+ sortChords = x;
+ if (chords) resort();
+ return chord;
+ };
+ chord.chords = function() {
+ if (!chords) relayout();
+ return chords;
+ };
+ chord.groups = function() {
+ if (!groups) relayout();
+ return groups;
+ };
+ return chord;
+ };
+ d3.layout.force = function() {
+ var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges;
+ function repulse(node) {
+ return function(quad, x1, _, x2) {
+ if (quad.point !== node) {
+ var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
+ if ((x2 - x1) * dn < theta) {
+ var k = quad.charge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ return true;
+ }
+ if (quad.point && isFinite(dn)) {
+ var k = quad.pointCharge * dn * dn;
+ node.px -= dx * k;
+ node.py -= dy * k;
+ }
+ }
+ return !quad.charge;
+ };
+ }
+ force.tick = function() {
+ if ((alpha *= .99) < .005) {
+ event.end({
+ type: "end",
+ alpha: alpha = 0
+ });
+ return true;
+ }
+ var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ s = o.source;
+ t = o.target;
+ x = t.x - s.x;
+ y = t.y - s.y;
+ if (l = x * x + y * y) {
+ l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
+ x *= l;
+ y *= l;
+ t.x -= x * (k = s.weight / (t.weight + s.weight));
+ t.y -= y * k;
+ s.x += x * (k = 1 - k);
+ s.y += y * k;
+ }
+ }
+ if (k = alpha * gravity) {
+ x = size[0] / 2;
+ y = size[1] / 2;
+ i = -1;
+ if (k) while (++i < n) {
+ o = nodes[i];
+ o.x += (x - o.x) * k;
+ o.y += (y - o.y) * k;
+ }
+ }
+ if (charge) {
+ d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
+ i = -1;
+ while (++i < n) {
+ if (!(o = nodes[i]).fixed) {
+ q.visit(repulse(o));
+ }
+ }
+ }
+ i = -1;
+ while (++i < n) {
+ o = nodes[i];
+ if (o.fixed) {
+ o.x = o.px;
+ o.y = o.py;
+ } else {
+ o.x -= (o.px - (o.px = o.x)) * friction;
+ o.y -= (o.py - (o.py = o.y)) * friction;
+ }
+ }
+ event.tick({
+ type: "tick",
+ alpha: alpha
+ });
+ };
+ force.nodes = function(x) {
+ if (!arguments.length) return nodes;
+ nodes = x;
+ return force;
+ };
+ force.links = function(x) {
+ if (!arguments.length) return links;
+ links = x;
+ return force;
+ };
+ force.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return force;
+ };
+ force.linkDistance = function(x) {
+ if (!arguments.length) return linkDistance;
+ linkDistance = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.distance = force.linkDistance;
+ force.linkStrength = function(x) {
+ if (!arguments.length) return linkStrength;
+ linkStrength = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.friction = function(x) {
+ if (!arguments.length) return friction;
+ friction = +x;
+ return force;
+ };
+ force.charge = function(x) {
+ if (!arguments.length) return charge;
+ charge = typeof x === "function" ? x : +x;
+ return force;
+ };
+ force.gravity = function(x) {
+ if (!arguments.length) return gravity;
+ gravity = +x;
+ return force;
+ };
+ force.theta = function(x) {
+ if (!arguments.length) return theta;
+ theta = +x;
+ return force;
+ };
+ force.alpha = function(x) {
+ if (!arguments.length) return alpha;
+ x = +x;
+ if (alpha) {
+ if (x > 0) alpha = x; else alpha = 0;
+ } else if (x > 0) {
+ event.start({
+ type: "start",
+ alpha: alpha = x
+ });
+ d3.timer(force.tick);
+ }
+ return force;
+ };
+ force.start = function() {
+ var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
+ for (i = 0; i < n; ++i) {
+ (o = nodes[i]).index = i;
+ o.weight = 0;
+ }
+ for (i = 0; i < m; ++i) {
+ o = links[i];
+ if (typeof o.source == "number") o.source = nodes[o.source];
+ if (typeof o.target == "number") o.target = nodes[o.target];
+ ++o.source.weight;
+ ++o.target.weight;
+ }
+ for (i = 0; i < n; ++i) {
+ o = nodes[i];
+ if (isNaN(o.x)) o.x = position("x", w);
+ if (isNaN(o.y)) o.y = position("y", h);
+ if (isNaN(o.px)) o.px = o.x;
+ if (isNaN(o.py)) o.py = o.y;
+ }
+ distances = [];
+ if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
+ strengths = [];
+ if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
+ charges = [];
+ if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
+ function position(dimension, size) {
+ var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
+ while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
+ return Math.random() * size;
+ }
+ function neighbor() {
+ if (!neighbors) {
+ neighbors = [];
+ for (j = 0; j < n; ++j) {
+ neighbors[j] = [];
+ }
+ for (j = 0; j < m; ++j) {
+ var o = links[j];
+ neighbors[o.source.index].push(o.target);
+ neighbors[o.target.index].push(o.source);
+ }
+ }
+ return neighbors[i];
+ }
+ return force.resume();
+ };
+ force.resume = function() {
+ return force.alpha(.1);
+ };
+ force.stop = function() {
+ return force.alpha(0);
+ };
+ force.drag = function() {
+ if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
+ if (!arguments.length) return drag;
+ this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
+ };
+ function dragmove(d) {
+ d.px = d3.event.x, d.py = d3.event.y;
+ force.resume();
+ }
+ return d3.rebind(force, event, "on");
+ };
+ function d3_layout_forceDragstart(d) {
+ d.fixed |= 2;
+ }
+ function d3_layout_forceDragend(d) {
+ d.fixed &= ~6;
+ }
+ function d3_layout_forceMouseover(d) {
+ d.fixed |= 4;
+ d.px = d.x, d.py = d.y;
+ }
+ function d3_layout_forceMouseout(d) {
+ d.fixed &= ~4;
+ }
+ function d3_layout_forceAccumulate(quad, alpha, charges) {
+ var cx = 0, cy = 0;
+ quad.charge = 0;
+ if (!quad.leaf) {
+ var nodes = quad.nodes, n = nodes.length, i = -1, c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
+ d3_layout_forceAccumulate(c, alpha, charges);
+ quad.charge += c.charge;
+ cx += c.charge * c.cx;
+ cy += c.charge * c.cy;
+ }
+ }
+ if (quad.point) {
+ if (!quad.leaf) {
+ quad.point.x += Math.random() - .5;
+ quad.point.y += Math.random() - .5;
+ }
+ var k = alpha * charges[quad.point.index];
+ quad.charge += quad.pointCharge = k;
+ cx += k * quad.point.x;
+ cy += k * quad.point.y;
+ }
+ quad.cx = cx / quad.charge;
+ quad.cy = cy / quad.charge;
+ }
+ var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1;
+ d3.layout.partition = function() {
+ var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
+ function position(node, x, dx, dy) {
+ var children = node.children;
+ node.x = x;
+ node.y = node.depth * dy;
+ node.dx = dx;
+ node.dy = dy;
+ if (children && (n = children.length)) {
+ var i = -1, n, c, d;
+ dx = node.value ? dx / node.value : 0;
+ while (++i < n) {
+ position(c = children[i], x, d = c.value * dx, dy);
+ x += d;
+ }
+ }
+ }
+ function depth(node) {
+ var children = node.children, d = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ while (++i < n) d = Math.max(d, depth(children[i]));
+ }
+ return 1 + d;
+ }
+ function partition(d, i) {
+ var nodes = hierarchy.call(this, d, i);
+ position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
+ return nodes;
+ }
+ partition.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return partition;
+ };
+ return d3_layout_hierarchyRebind(partition, hierarchy);
+ };
+ d3.layout.pie = function() {
+ var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * π;
+ function pie(data) {
+ var values = data.map(function(d, i) {
+ return +value.call(pie, d, i);
+ });
+ var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
+ var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
+ var index = d3.range(data.length);
+ if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
+ return values[j] - values[i];
+ } : function(i, j) {
+ return sort(data[i], data[j]);
+ });
+ var arcs = [];
+ index.forEach(function(i) {
+ var d;
+ arcs[i] = {
+ data: data[i],
+ value: d = values[i],
+ startAngle: a,
+ endAngle: a += d * k
+ };
+ });
+ return arcs;
+ }
+ pie.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return pie;
+ };
+ pie.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return pie;
+ };
+ pie.startAngle = function(x) {
+ if (!arguments.length) return startAngle;
+ startAngle = x;
+ return pie;
+ };
+ pie.endAngle = function(x) {
+ if (!arguments.length) return endAngle;
+ endAngle = x;
+ return pie;
+ };
+ return pie;
+ };
+ var d3_layout_pieSortByValue = {};
+ d3.layout.stack = function() {
+ var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
+ function stack(data, index) {
+ var series = data.map(function(d, i) {
+ return values.call(stack, d, i);
+ });
+ var points = series.map(function(d) {
+ return d.map(function(v, i) {
+ return [ x.call(stack, v, i), y.call(stack, v, i) ];
+ });
+ });
+ var orders = order.call(stack, points, index);
+ series = d3.permute(series, orders);
+ points = d3.permute(points, orders);
+ var offsets = offset.call(stack, points, index);
+ var n = series.length, m = series[0].length, i, j, o;
+ for (j = 0; j < m; ++j) {
+ out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
+ for (i = 1; i < n; ++i) {
+ out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
+ }
+ }
+ return data;
+ }
+ stack.values = function(x) {
+ if (!arguments.length) return values;
+ values = x;
+ return stack;
+ };
+ stack.order = function(x) {
+ if (!arguments.length) return order;
+ order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
+ return stack;
+ };
+ stack.offset = function(x) {
+ if (!arguments.length) return offset;
+ offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
+ return stack;
+ };
+ stack.x = function(z) {
+ if (!arguments.length) return x;
+ x = z;
+ return stack;
+ };
+ stack.y = function(z) {
+ if (!arguments.length) return y;
+ y = z;
+ return stack;
+ };
+ stack.out = function(z) {
+ if (!arguments.length) return out;
+ out = z;
+ return stack;
+ };
+ return stack;
+ };
+ function d3_layout_stackX(d) {
+ return d.x;
+ }
+ function d3_layout_stackY(d) {
+ return d.y;
+ }
+ function d3_layout_stackOut(d, y0, y) {
+ d.y0 = y0;
+ d.y = y;
+ }
+ var d3_layout_stackOrders = d3.map({
+ "inside-out": function(data) {
+ var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
+ return max[a] - max[b];
+ }), top = 0, bottom = 0, tops = [], bottoms = [];
+ for (i = 0; i < n; ++i) {
+ j = index[i];
+ if (top < bottom) {
+ top += sums[j];
+ tops.push(j);
+ } else {
+ bottom += sums[j];
+ bottoms.push(j);
+ }
+ }
+ return bottoms.reverse().concat(tops);
+ },
+ reverse: function(data) {
+ return d3.range(data.length).reverse();
+ },
+ "default": d3_layout_stackOrderDefault
+ });
+ var d3_layout_stackOffsets = d3.map({
+ silhouette: function(data) {
+ var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o > max) max = o;
+ sums.push(o);
+ }
+ for (j = 0; j < m; ++j) {
+ y0[j] = (max - sums[j]) / 2;
+ }
+ return y0;
+ },
+ wiggle: function(data) {
+ var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
+ y0[0] = o = o0 = 0;
+ for (j = 1; j < m; ++j) {
+ for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
+ for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
+ for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
+ s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
+ }
+ s2 += s3 * data[i][j][1];
+ }
+ y0[j] = o -= s1 ? s2 / s1 * dx : 0;
+ if (o < o0) o0 = o;
+ }
+ for (j = 0; j < m; ++j) y0[j] -= o0;
+ return y0;
+ },
+ expand: function(data) {
+ var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
+ for (j = 0; j < m; ++j) {
+ for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
+ if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
+ }
+ for (j = 0; j < m; ++j) y0[j] = 0;
+ return y0;
+ },
+ zero: d3_layout_stackOffsetZero
+ });
+ function d3_layout_stackOrderDefault(data) {
+ return d3.range(data.length);
+ }
+ function d3_layout_stackOffsetZero(data) {
+ var j = -1, m = data[0].length, y0 = [];
+ while (++j < m) y0[j] = 0;
+ return y0;
+ }
+ function d3_layout_stackMaxIndex(array) {
+ var i = 1, j = 0, v = array[0][1], k, n = array.length;
+ for (;i < n; ++i) {
+ if ((k = array[i][1]) > v) {
+ j = i;
+ v = k;
+ }
+ }
+ return j;
+ }
+ function d3_layout_stackReduceSum(d) {
+ return d.reduce(d3_layout_stackSum, 0);
+ }
+ function d3_layout_stackSum(p, d) {
+ return p + d[1];
+ }
+ d3.layout.histogram = function() {
+ var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
+ function histogram(data, i) {
+ var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
+ while (++i < m) {
+ bin = bins[i] = [];
+ bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
+ bin.y = 0;
+ }
+ if (m > 0) {
+ i = -1;
+ while (++i < n) {
+ x = values[i];
+ if (x >= range[0] && x <= range[1]) {
+ bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
+ bin.y += k;
+ bin.push(data[i]);
+ }
+ }
+ }
+ return bins;
+ }
+ histogram.value = function(x) {
+ if (!arguments.length) return valuer;
+ valuer = x;
+ return histogram;
+ };
+ histogram.range = function(x) {
+ if (!arguments.length) return ranger;
+ ranger = d3_functor(x);
+ return histogram;
+ };
+ histogram.bins = function(x) {
+ if (!arguments.length) return binner;
+ binner = typeof x === "number" ? function(range) {
+ return d3_layout_histogramBinFixed(range, x);
+ } : d3_functor(x);
+ return histogram;
+ };
+ histogram.frequency = function(x) {
+ if (!arguments.length) return frequency;
+ frequency = !!x;
+ return histogram;
+ };
+ return histogram;
+ };
+ function d3_layout_histogramBinSturges(range, values) {
+ return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
+ }
+ function d3_layout_histogramBinFixed(range, n) {
+ var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
+ while (++x <= n) f[x] = m * x + b;
+ return f;
+ }
+ function d3_layout_histogramRange(values) {
+ return [ d3.min(values), d3.max(values) ];
+ }
+ d3.layout.hierarchy = function() {
+ var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
+ function recurse(node, depth, nodes) {
+ var childs = children.call(hierarchy, node, depth);
+ node.depth = depth;
+ nodes.push(node);
+ if (childs && (n = childs.length)) {
+ var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
+ while (++i < n) {
+ d = recurse(childs[i], j, nodes);
+ d.parent = node;
+ c.push(d);
+ v += d.value;
+ }
+ if (sort) c.sort(sort);
+ if (value) node.value = v;
+ } else if (value) {
+ node.value = +value.call(hierarchy, node, depth) || 0;
+ }
+ return node;
+ }
+ function revalue(node, depth) {
+ var children = node.children, v = 0;
+ if (children && (n = children.length)) {
+ var i = -1, n, j = depth + 1;
+ while (++i < n) v += revalue(children[i], j);
+ } else if (value) {
+ v = +value.call(hierarchy, node, depth) || 0;
+ }
+ if (value) node.value = v;
+ return v;
+ }
+ function hierarchy(d) {
+ var nodes = [];
+ recurse(d, 0, nodes);
+ return nodes;
+ }
+ hierarchy.sort = function(x) {
+ if (!arguments.length) return sort;
+ sort = x;
+ return hierarchy;
+ };
+ hierarchy.children = function(x) {
+ if (!arguments.length) return children;
+ children = x;
+ return hierarchy;
+ };
+ hierarchy.value = function(x) {
+ if (!arguments.length) return value;
+ value = x;
+ return hierarchy;
+ };
+ hierarchy.revalue = function(root) {
+ revalue(root, 0);
+ return root;
+ };
+ return hierarchy;
+ };
+ function d3_layout_hierarchyRebind(object, hierarchy) {
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+ object.nodes = object;
+ object.links = d3_layout_hierarchyLinks;
+ return object;
+ }
+ function d3_layout_hierarchyChildren(d) {
+ return d.children;
+ }
+ function d3_layout_hierarchyValue(d) {
+ return d.value;
+ }
+ function d3_layout_hierarchySort(a, b) {
+ return b.value - a.value;
+ }
+ function d3_layout_hierarchyLinks(nodes) {
+ return d3.merge(nodes.map(function(parent) {
+ return (parent.children || []).map(function(child) {
+ return {
+ source: parent,
+ target: child
+ };
+ });
+ }));
+ }
+ d3.layout.pack = function() {
+ var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
+ function pack(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r = Math.sqrt(d.value);
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
+ if (padding > 0) {
+ var dr = padding * k / 2;
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r += dr;
+ });
+ d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
+ d3_layout_treeVisitAfter(root, function(d) {
+ d.r -= dr;
+ });
+ k = Math.max(2 * root.r / w, 2 * root.r / h);
+ }
+ d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
+ return nodes;
+ }
+ pack.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return pack;
+ };
+ pack.padding = function(_) {
+ if (!arguments.length) return padding;
+ padding = +_;
+ return pack;
+ };
+ return d3_layout_hierarchyRebind(pack, hierarchy);
+ };
+ function d3_layout_packSort(a, b) {
+ return a.value - b.value;
+ }
+ function d3_layout_packInsert(a, b) {
+ var c = a._pack_next;
+ a._pack_next = b;
+ b._pack_prev = a;
+ b._pack_next = c;
+ c._pack_prev = b;
+ }
+ function d3_layout_packSplice(a, b) {
+ a._pack_next = b;
+ b._pack_prev = a;
+ }
+ function d3_layout_packIntersects(a, b) {
+ var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
+ return dr * dr - dx * dx - dy * dy > .001;
+ }
+ function d3_layout_packSiblings(node) {
+ if (!(nodes = node.children) || !(n = nodes.length)) return;
+ var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
+ function bound(node) {
+ xMin = Math.min(node.x - node.r, xMin);
+ xMax = Math.max(node.x + node.r, xMax);
+ yMin = Math.min(node.y - node.r, yMin);
+ yMax = Math.max(node.y + node.r, yMax);
+ }
+ nodes.forEach(d3_layout_packLink);
+ a = nodes[0];
+ a.x = -a.r;
+ a.y = 0;
+ bound(a);
+ if (n > 1) {
+ b = nodes[1];
+ b.x = b.r;
+ b.y = 0;
+ bound(b);
+ if (n > 2) {
+ c = nodes[2];
+ d3_layout_packPlace(a, b, c);
+ bound(c);
+ d3_layout_packInsert(a, c);
+ a._pack_prev = c;
+ d3_layout_packInsert(c, b);
+ b = a._pack_next;
+ for (i = 3; i < n; i++) {
+ d3_layout_packPlace(a, b, c = nodes[i]);
+ var isect = 0, s1 = 1, s2 = 1;
+ for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
+ if (d3_layout_packIntersects(j, c)) {
+ isect = 1;
+ break;
+ }
+ }
+ if (isect == 1) {
+ for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
+ if (d3_layout_packIntersects(k, c)) {
+ break;
+ }
+ }
+ }
+ if (isect) {
+ if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
+ d3_layout_packInsert(a, c);
+ b = c;
+ bound(c);
+ }
+ }
+ }
+ }
+ var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
+ for (i = 0; i < n; i++) {
+ c = nodes[i];
+ c.x -= cx;
+ c.y -= cy;
+ cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
+ }
+ node.r = cr;
+ nodes.forEach(d3_layout_packUnlink);
+ }
+ function d3_layout_packLink(node) {
+ node._pack_next = node._pack_prev = node;
+ }
+ function d3_layout_packUnlink(node) {
+ delete node._pack_next;
+ delete node._pack_prev;
+ }
+ function d3_layout_packTransform(node, x, y, k) {
+ var children = node.children;
+ node.x = x += k * node.x;
+ node.y = y += k * node.y;
+ node.r *= k;
+ if (children) {
+ var i = -1, n = children.length;
+ while (++i < n) d3_layout_packTransform(children[i], x, y, k);
+ }
+ }
+ function d3_layout_packPlace(a, b, c) {
+ var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
+ if (db && (dx || dy)) {
+ var da = b.r + c.r, dc = dx * dx + dy * dy;
+ da *= da;
+ db *= db;
+ var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
+ c.x = a.x + x * dx + y * dy;
+ c.y = a.y + x * dy - y * dx;
+ } else {
+ c.x = a.x + db;
+ c.y = a.y;
+ }
+ }
+ d3.layout.cluster = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ function cluster(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
+ d3_layout_treeVisitAfter(root, function(node) {
+ var children = node.children;
+ if (children && children.length) {
+ node.x = d3_layout_clusterX(children);
+ node.y = d3_layout_clusterY(children);
+ } else {
+ node.x = previousNode ? x += separation(node, previousNode) : 0;
+ node.y = 0;
+ previousNode = node;
+ }
+ });
+ var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
+ });
+ return nodes;
+ }
+ cluster.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return cluster;
+ };
+ cluster.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return cluster;
+ };
+ return d3_layout_hierarchyRebind(cluster, hierarchy);
+ };
+ function d3_layout_clusterY(children) {
+ return 1 + d3.max(children, function(child) {
+ return child.y;
+ });
+ }
+ function d3_layout_clusterX(children) {
+ return children.reduce(function(x, child) {
+ return x + child.x;
+ }, 0) / children.length;
+ }
+ function d3_layout_clusterLeft(node) {
+ var children = node.children;
+ return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
+ }
+ function d3_layout_clusterRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
+ }
+ d3.layout.tree = function() {
+ var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
+ function tree(d, i) {
+ var nodes = hierarchy.call(this, d, i), root = nodes[0];
+ function firstWalk(node, previousSibling) {
+ var children = node.children, layout = node._tree;
+ if (children && (n = children.length)) {
+ var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
+ while (++i < n) {
+ child = children[i];
+ firstWalk(child, previousChild);
+ ancestor = apportion(child, previousChild, ancestor);
+ previousChild = child;
+ }
+ d3_layout_treeShift(node);
+ var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ layout.mod = layout.prelim - midpoint;
+ } else {
+ layout.prelim = midpoint;
+ }
+ } else {
+ if (previousSibling) {
+ layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
+ }
+ }
+ }
+ function secondWalk(node, x) {
+ node.x = node._tree.prelim + x;
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var i = -1, n;
+ x += node._tree.mod;
+ while (++i < n) {
+ secondWalk(children[i], x);
+ }
+ }
+ }
+ function apportion(node, previousSibling, ancestor) {
+ if (previousSibling) {
+ var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
+ while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
+ vom = d3_layout_treeLeft(vom);
+ vop = d3_layout_treeRight(vop);
+ vop._tree.ancestor = node;
+ shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
+ if (shift > 0) {
+ d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
+ sip += shift;
+ sop += shift;
+ }
+ sim += vim._tree.mod;
+ sip += vip._tree.mod;
+ som += vom._tree.mod;
+ sop += vop._tree.mod;
+ }
+ if (vim && !d3_layout_treeRight(vop)) {
+ vop._tree.thread = vim;
+ vop._tree.mod += sim - sop;
+ }
+ if (vip && !d3_layout_treeLeft(vom)) {
+ vom._tree.thread = vip;
+ vom._tree.mod += sip - som;
+ ancestor = node;
+ }
+ }
+ return ancestor;
+ }
+ d3_layout_treeVisitAfter(root, function(node, previousSibling) {
+ node._tree = {
+ ancestor: node,
+ prelim: 0,
+ mod: 0,
+ change: 0,
+ shift: 0,
+ number: previousSibling ? previousSibling._tree.number + 1 : 0
+ };
+ });
+ firstWalk(root);
+ secondWalk(root, -root._tree.prelim);
+ var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
+ d3_layout_treeVisitAfter(root, function(node) {
+ node.x = (node.x - x0) / (x1 - x0) * size[0];
+ node.y = node.depth / y1 * size[1];
+ delete node._tree;
+ });
+ return nodes;
+ }
+ tree.separation = function(x) {
+ if (!arguments.length) return separation;
+ separation = x;
+ return tree;
+ };
+ tree.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return tree;
+ };
+ return d3_layout_hierarchyRebind(tree, hierarchy);
+ };
+ function d3_layout_treeSeparation(a, b) {
+ return a.parent == b.parent ? 1 : 2;
+ }
+ function d3_layout_treeLeft(node) {
+ var children = node.children;
+ return children && children.length ? children[0] : node._tree.thread;
+ }
+ function d3_layout_treeRight(node) {
+ var children = node.children, n;
+ return children && (n = children.length) ? children[n - 1] : node._tree.thread;
+ }
+ function d3_layout_treeSearch(node, compare) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, n, i = -1;
+ while (++i < n) {
+ if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
+ node = child;
+ }
+ }
+ }
+ return node;
+ }
+ function d3_layout_treeRightmost(a, b) {
+ return a.x - b.x;
+ }
+ function d3_layout_treeLeftmost(a, b) {
+ return b.x - a.x;
+ }
+ function d3_layout_treeDeepest(a, b) {
+ return a.depth - b.depth;
+ }
+ function d3_layout_treeVisitAfter(node, callback) {
+ function visit(node, previousSibling) {
+ var children = node.children;
+ if (children && (n = children.length)) {
+ var child, previousChild = null, i = -1, n;
+ while (++i < n) {
+ child = children[i];
+ visit(child, previousChild);
+ previousChild = child;
+ }
+ }
+ callback(node, previousSibling);
+ }
+ visit(node, null);
+ }
+ function d3_layout_treeShift(node) {
+ var shift = 0, change = 0, children = node.children, i = children.length, child;
+ while (--i >= 0) {
+ child = children[i]._tree;
+ child.prelim += shift;
+ child.mod += shift;
+ shift += child.shift + (change += child.change);
+ }
+ }
+ function d3_layout_treeMove(ancestor, node, shift) {
+ ancestor = ancestor._tree;
+ node = node._tree;
+ var change = shift / (node.number - ancestor.number);
+ ancestor.change += change;
+ node.change -= change;
+ node.shift += shift;
+ node.prelim += shift;
+ node.mod += shift;
+ }
+ function d3_layout_treeAncestor(vim, node, ancestor) {
+ return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
+ }
+ d3.layout.treemap = function() {
+ var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
+ function scale(children, k) {
+ var i = -1, n = children.length, child, area;
+ while (++i < n) {
+ area = (child = children[i]).value * (k < 0 ? 0 : k);
+ child.area = isNaN(area) || area <= 0 ? 0 : area;
+ }
+ }
+ function squarify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while ((n = remaining.length) > 0) {
+ row.push(child = remaining[n - 1]);
+ row.area += child.area;
+ if (mode !== "squarify" || (score = worst(row, u)) <= best) {
+ remaining.pop();
+ best = score;
+ } else {
+ row.area -= row.pop().area;
+ position(row, u, rect, false);
+ u = Math.min(rect.dx, rect.dy);
+ row.length = row.area = 0;
+ best = Infinity;
+ }
+ }
+ if (row.length) {
+ position(row, u, rect, true);
+ row.length = row.area = 0;
+ }
+ children.forEach(squarify);
+ }
+ }
+ function stickify(node) {
+ var children = node.children;
+ if (children && children.length) {
+ var rect = pad(node), remaining = children.slice(), child, row = [];
+ scale(remaining, rect.dx * rect.dy / node.value);
+ row.area = 0;
+ while (child = remaining.pop()) {
+ row.push(child);
+ row.area += child.area;
+ if (child.z != null) {
+ position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
+ row.length = row.area = 0;
+ }
+ }
+ children.forEach(stickify);
+ }
+ }
+ function worst(row, u) {
+ var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
+ while (++i < n) {
+ if (!(r = row[i].area)) continue;
+ if (r < rmin) rmin = r;
+ if (r > rmax) rmax = r;
+ }
+ s *= s;
+ u *= u;
+ return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
+ }
+ function position(row, u, rect, flush) {
+ var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
+ if (u == rect.dx) {
+ if (flush || v > rect.dy) v = rect.dy;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dy = v;
+ x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
+ }
+ o.z = true;
+ o.dx += rect.x + rect.dx - x;
+ rect.y += v;
+ rect.dy -= v;
+ } else {
+ if (flush || v > rect.dx) v = rect.dx;
+ while (++i < n) {
+ o = row[i];
+ o.x = x;
+ o.y = y;
+ o.dx = v;
+ y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
+ }
+ o.z = false;
+ o.dy += rect.y + rect.dy - y;
+ rect.x += v;
+ rect.dx -= v;
+ }
+ }
+ function treemap(d) {
+ var nodes = stickies || hierarchy(d), root = nodes[0];
+ root.x = 0;
+ root.y = 0;
+ root.dx = size[0];
+ root.dy = size[1];
+ if (stickies) hierarchy.revalue(root);
+ scale([ root ], root.dx * root.dy / root.value);
+ (stickies ? stickify : squarify)(root);
+ if (sticky) stickies = nodes;
+ return nodes;
+ }
+ treemap.size = function(x) {
+ if (!arguments.length) return size;
+ size = x;
+ return treemap;
+ };
+ treemap.padding = function(x) {
+ if (!arguments.length) return padding;
+ function padFunction(node) {
+ var p = x.call(treemap, node, node.depth);
+ return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
+ }
+ function padConstant(node) {
+ return d3_layout_treemapPad(node, x);
+ }
+ var type;
+ pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
+ padConstant) : padConstant;
+ return treemap;
+ };
+ treemap.round = function(x) {
+ if (!arguments.length) return round != Number;
+ round = x ? Math.round : Number;
+ return treemap;
+ };
+ treemap.sticky = function(x) {
+ if (!arguments.length) return sticky;
+ sticky = x;
+ stickies = null;
+ return treemap;
+ };
+ treemap.ratio = function(x) {
+ if (!arguments.length) return ratio;
+ ratio = x;
+ return treemap;
+ };
+ treemap.mode = function(x) {
+ if (!arguments.length) return mode;
+ mode = x + "";
+ return treemap;
+ };
+ return d3_layout_hierarchyRebind(treemap, hierarchy);
+ };
+ function d3_layout_treemapPadNull(node) {
+ return {
+ x: node.x,
+ y: node.y,
+ dx: node.dx,
+ dy: node.dy
+ };
+ }
+ function d3_layout_treemapPad(node, padding) {
+ var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
+ if (dx < 0) {
+ x += dx / 2;
+ dx = 0;
+ }
+ if (dy < 0) {
+ y += dy / 2;
+ dy = 0;
+ }
+ return {
+ x: x,
+ y: y,
+ dx: dx,
+ dy: dy
+ };
+ }
+ function d3_dsv(delimiter, mimeType) {
+ var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
+ function dsv(url, callback) {
+ return d3.xhr(url, mimeType, callback).response(response);
+ }
+ function response(request) {
+ return dsv.parse(request.responseText);
+ }
+ dsv.parse = function(text) {
+ var o;
+ return dsv.parseRows(text, function(row) {
+ if (o) return o(row);
+ o = new Function("d", "return {" + row.map(function(name, i) {
+ return JSON.stringify(name) + ": d[" + i + "]";
+ }).join(",") + "}");
+ });
+ };
+ dsv.parseRows = function(text, f) {
+ var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
+ function token() {
+ if (I >= N) return EOF;
+ if (eol) return eol = false, EOL;
+ var j = I;
+ if (text.charCodeAt(j) === 34) {
+ var i = j;
+ while (i++ < N) {
+ if (text.charCodeAt(i) === 34) {
+ if (text.charCodeAt(i + 1) !== 34) break;
+ ++i;
+ }
+ }
+ I = i + 2;
+ var c = text.charCodeAt(i + 1);
+ if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(i + 2) === 10) ++I;
+ } else if (c === 10) {
+ eol = true;
+ }
+ return text.substring(j + 1, i).replace(/""/g, '"');
+ }
+ while (I < N) {
+ var c = text.charCodeAt(I++), k = 1;
+ if (c === 10) eol = true; else if (c === 13) {
+ eol = true;
+ if (text.charCodeAt(I) === 10) ++I, ++k;
+ } else if (c !== delimiterCode) continue;
+ return text.substring(j, I - k);
+ }
+ return text.substring(j);
+ }
+ while ((t = token()) !== EOF) {
+ var a = [];
+ while (t !== EOL && t !== EOF) {
+ a.push(t);
+ t = token();
+ }
+ if (f && !(a = f(a, n++))) continue;
+ rows.push(a);
+ }
+ return rows;
+ };
+ dsv.format = function(rows) {
+ return rows.map(formatRow).join("\n");
+ };
+ function formatRow(row) {
+ return row.map(formatValue).join(delimiter);
+ }
+ function formatValue(text) {
+ return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
+ }
+ return dsv;
+ }
+ d3.csv = d3_dsv(",", "text/csv");
+ d3.tsv = d3_dsv(" ", "text/tab-separated-values");
+ d3.geo = {};
+ d3.geo.stream = function(object, listener) {
+ if (d3_geo_streamObjectType.hasOwnProperty(object.type)) {
+ d3_geo_streamObjectType[object.type](object, listener);
+ } else {
+ d3_geo_streamGeometry(object, listener);
+ }
+ };
+ function d3_geo_streamGeometry(geometry, listener) {
+ if (d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
+ d3_geo_streamGeometryType[geometry.type](geometry, listener);
+ }
+ }
+ var d3_geo_streamObjectType = {
+ Feature: function(feature, listener) {
+ d3_geo_streamGeometry(feature.geometry, listener);
+ },
+ FeatureCollection: function(object, listener) {
+ var features = object.features, i = -1, n = features.length;
+ while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
+ }
+ };
+ var d3_geo_streamGeometryType = {
+ Sphere: function(object, listener) {
+ listener.sphere();
+ },
+ Point: function(object, listener) {
+ var coordinate = object.coordinates;
+ listener.point(coordinate[0], coordinate[1]);
+ },
+ MultiPoint: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate;
+ while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
+ },
+ LineString: function(object, listener) {
+ d3_geo_streamLine(object.coordinates, listener, 0);
+ },
+ MultiLineString: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
+ },
+ Polygon: function(object, listener) {
+ d3_geo_streamPolygon(object.coordinates, listener);
+ },
+ MultiPolygon: function(object, listener) {
+ var coordinates = object.coordinates, i = -1, n = coordinates.length;
+ while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
+ },
+ GeometryCollection: function(object, listener) {
+ var geometries = object.geometries, i = -1, n = geometries.length;
+ while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
+ }
+ };
+ function d3_geo_streamLine(coordinates, listener, closed) {
+ var i = -1, n = coordinates.length - closed, coordinate;
+ listener.lineStart();
+ while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
+ listener.lineEnd();
+ }
+ function d3_geo_streamPolygon(coordinates, listener) {
+ var i = -1, n = coordinates.length;
+ listener.polygonStart();
+ while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
+ listener.polygonEnd();
+ }
+ function d3_geo_spherical(cartesian) {
+ return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ];
+ }
+ function d3_geo_sphericalEqual(a, b) {
+ return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε;
+ }
+ function d3_geo_cartesian(spherical) {
+ var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
+ return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
+ }
+ function d3_geo_cartesianDot(a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+ }
+ function d3_geo_cartesianCross(a, b) {
+ return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
+ }
+ function d3_geo_cartesianAdd(a, b) {
+ a[0] += b[0];
+ a[1] += b[1];
+ a[2] += b[2];
+ }
+ function d3_geo_cartesianScale(vector, k) {
+ return [ vector[0] * k, vector[1] * k, vector[2] * k ];
+ }
+ function d3_geo_cartesianNormalize(d) {
+ var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
+ d[0] /= l;
+ d[1] /= l;
+ d[2] /= l;
+ }
+ function d3_geo_resample(project) {
+ var δ2 = .5, maxDepth = 16;
+ function resample(stream) {
+ var λ0, x0, y0, a0, b0, c0;
+ var resample = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.polygonStart();
+ resample.lineStart = polygonLineStart;
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ resample.lineStart = lineStart;
+ }
+ };
+ function point(x, y) {
+ x = project(x, y);
+ stream.point(x[0], x[1]);
+ }
+ function lineStart() {
+ x0 = NaN;
+ resample.point = linePoint;
+ stream.lineStart();
+ }
+ function linePoint(λ, φ) {
+ var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
+ stream.point(x0, y0);
+ }
+ function lineEnd() {
+ resample.point = point;
+ stream.lineEnd();
+ }
+ function polygonLineStart() {
+ var λ00, φ00, x00, y00, a00, b00, c00;
+ lineStart();
+ resample.point = function(λ, φ) {
+ linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
+ resample.point = linePoint;
+ };
+ resample.lineEnd = function() {
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
+ resample.lineEnd = lineEnd;
+ lineEnd();
+ };
+ }
+ return resample;
+ }
+ function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
+ var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
+ if (d2 > 4 * δ2 && depth--) {
+ var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
+ if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) {
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
+ stream.point(x2, y2);
+ resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
+ }
+ }
+ }
+ resample.precision = function(_) {
+ if (!arguments.length) return Math.sqrt(δ2);
+ maxDepth = (δ2 = _ * _) > 0 && 16;
+ return resample;
+ };
+ return resample;
+ }
+ d3.geo.albersUsa = function() {
+ var lower48 = d3.geo.albers();
+ var alaska = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]);
+ var hawaii = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]);
+ var puertoRico = d3.geo.albers().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]);
+ function albersUsa(coordinates) {
+ return projection(coordinates)(coordinates);
+ }
+ function projection(point) {
+ var lon = point[0], lat = point[1];
+ return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48;
+ }
+ albersUsa.scale = function(x) {
+ if (!arguments.length) return lower48.scale();
+ lower48.scale(x);
+ alaska.scale(x * .6);
+ hawaii.scale(x);
+ puertoRico.scale(x * 1.5);
+ return albersUsa.translate(lower48.translate());
+ };
+ albersUsa.translate = function(x) {
+ if (!arguments.length) return lower48.translate();
+ var dz = lower48.scale(), dx = x[0], dy = x[1];
+ lower48.translate(x);
+ alaska.translate([ dx - .4 * dz, dy + .17 * dz ]);
+ hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]);
+ puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]);
+ return albersUsa;
+ };
+ return albersUsa.scale(lower48.scale());
+ };
+ function d3_geo_albers(φ0, φ1) {
+ var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
+ function albers(λ, φ) {
+ var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
+ return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
+ }
+ albers.invert = function(x, y) {
+ var ρ0_y = ρ0 - y;
+ return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
+ };
+ return albers;
+ }
+ (d3.geo.albers = function() {
+ var φ0 = 29.5 * d3_radians, φ1 = 45.5 * d3_radians, m = d3_geo_projectionMutator(d3_geo_albers), p = m(φ0, φ1);
+ p.parallels = function(_) {
+ if (!arguments.length) return [ φ0 * d3_degrees, φ1 * d3_degrees ];
+ return m(φ0 = _[0] * d3_radians, φ1 = _[1] * d3_radians);
+ };
+ return p.rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3);
+ }).raw = d3_geo_albers;
+ var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
+ return Math.sqrt(2 / (1 + cosλcosφ));
+ }, function(ρ) {
+ return 2 * Math.asin(ρ / 2);
+ });
+ (d3.geo.azimuthalEqualArea = function() {
+ return d3_geo_projection(d3_geo_azimuthalEqualArea);
+ }).raw = d3_geo_azimuthalEqualArea;
+ var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
+ var c = Math.acos(cosλcosφ);
+ return c && c / Math.sin(c);
+ }, d3_identity);
+ (d3.geo.azimuthalEquidistant = function() {
+ return d3_geo_projection(d3_geo_azimuthalEquidistant);
+ }).raw = d3_geo_azimuthalEquidistant;
+ d3.geo.bounds = d3_geo_bounds(d3_identity);
+ function d3_geo_bounds(projectStream) {
+ var x0, y0, x1, y1;
+ var bound = {
+ point: boundPoint,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ bound.lineEnd = boundPolygonLineEnd;
+ },
+ polygonEnd: function() {
+ bound.point = boundPoint;
+ }
+ };
+ function boundPoint(x, y) {
+ if (x < x0) x0 = x;
+ if (x > x1) x1 = x;
+ if (y < y0) y0 = y;
+ if (y > y1) y1 = y;
+ }
+ function boundPolygonLineEnd() {
+ bound.point = bound.lineEnd = d3_noop;
+ }
+ return function(feature) {
+ y1 = x1 = -(x0 = y0 = Infinity);
+ d3.geo.stream(feature, projectStream(bound));
+ return [ [ x0, y0 ], [ x1, y1 ] ];
+ };
+ }
+ d3.geo.centroid = function(object) {
+ d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ d3.geo.stream(object, d3_geo_centroid);
+ var m;
+ if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) {
+ return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ];
+ }
+ };
+ var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ;
+ var d3_geo_centroid = {
+ sphere: function() {
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ },
+ point: d3_geo_centroidPoint,
+ lineStart: d3_geo_centroidLineStart,
+ lineEnd: d3_geo_centroidLineEnd,
+ polygonStart: function() {
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
+ }
+ };
+ function d3_geo_centroidPoint(λ, φ) {
+ if (d3_geo_centroidDimension) return;
+ ++d3_geo_centroidW;
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians);
+ d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW;
+ d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW;
+ d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW;
+ }
+ function d3_geo_centroidRingStart() {
+ var λ00, φ00;
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidLineStart();
+ d3_geo_centroidDimension = 2;
+ var linePoint = d3_geo_centroid.point;
+ d3_geo_centroid.point = function(λ, φ) {
+ linePoint(λ00 = λ, φ00 = φ);
+ };
+ d3_geo_centroid.lineEnd = function() {
+ d3_geo_centroid.point(λ00, φ00);
+ d3_geo_centroidLineEnd();
+ d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
+ };
+ }
+ function d3_geo_centroidLineStart() {
+ var x0, y0, z0;
+ if (d3_geo_centroidDimension > 1) return;
+ if (d3_geo_centroidDimension < 1) {
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_centroid.point = function(λ, φ) {
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians);
+ x0 = cosφ * Math.cos(λ);
+ y0 = cosφ * Math.sin(λ);
+ z0 = Math.sin(φ);
+ d3_geo_centroid.point = nextPoint;
+ };
+ function nextPoint(λ, φ) {
+ λ *= d3_radians;
+ var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
+ d3_geo_centroidW += w;
+ d3_geo_centroidX += w * (x0 + (x0 = x));
+ d3_geo_centroidY += w * (y0 + (y0 = y));
+ d3_geo_centroidZ += w * (z0 + (z0 = z));
+ }
+ }
+ function d3_geo_centroidLineEnd() {
+ d3_geo_centroid.point = d3_geo_centroidPoint;
+ }
+ d3.geo.circle = function() {
+ var origin = [ 0, 0 ], angle, precision = 6, interpolate;
+ function circle() {
+ var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
+ interpolate(null, null, 1, {
+ point: function(x, y) {
+ ring.push(x = rotate(x, y));
+ x[0] *= d3_degrees, x[1] *= d3_degrees;
+ }
+ });
+ return {
+ type: "Polygon",
+ coordinates: [ ring ]
+ };
+ }
+ circle.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
+ return circle;
+ };
+ circle.angle = function(x) {
+ if (!arguments.length) return angle;
+ interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
+ return circle;
+ };
+ circle.precision = function(_) {
+ if (!arguments.length) return precision;
+ interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
+ return circle;
+ };
+ return circle.angle(90);
+ };
+ function d3_geo_circleInterpolate(radians, precision) {
+ var cr = Math.cos(radians), sr = Math.sin(radians);
+ return function(from, to, direction, listener) {
+ if (from != null) {
+ from = d3_geo_circleAngle(cr, from);
+ to = d3_geo_circleAngle(cr, to);
+ if (direction > 0 ? from < to : from > to) from += direction * 2 * π;
+ } else {
+ from = radians + direction * 2 * π;
+ to = radians;
+ }
+ var point;
+ for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) {
+ listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
+ }
+ };
+ }
+ function d3_geo_circleAngle(cr, point) {
+ var a = d3_geo_cartesian(point);
+ a[0] -= cr;
+ d3_geo_cartesianNormalize(a);
+ var angle = Math.acos(Math.max(-1, Math.min(1, -a[1])));
+ return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
+ }
+ function d3_geo_clip(pointVisible, clipLine, interpolate) {
+ return function(listener) {
+ var line = clipLine(listener);
+ var clip = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ clip.point = pointRing;
+ clip.lineStart = ringStart;
+ clip.lineEnd = ringEnd;
+ invisible = false;
+ invisibleArea = visibleArea = 0;
+ segments = [];
+ listener.polygonStart();
+ },
+ polygonEnd: function() {
+ clip.point = point;
+ clip.lineStart = lineStart;
+ clip.lineEnd = lineEnd;
+ segments = d3.merge(segments);
+ if (segments.length) {
+ d3_geo_clipPolygon(segments, interpolate, listener);
+ } else if (visibleArea < -ε || invisible && invisibleArea < -ε) {
+ listener.lineStart();
+ interpolate(null, null, 1, listener);
+ listener.lineEnd();
+ }
+ listener.polygonEnd();
+ segments = null;
+ },
+ sphere: function() {
+ listener.polygonStart();
+ listener.lineStart();
+ interpolate(null, null, 1, listener);
+ listener.lineEnd();
+ listener.polygonEnd();
+ }
+ };
+ function point(λ, φ) {
+ if (pointVisible(λ, φ)) listener.point(λ, φ);
+ }
+ function pointLine(λ, φ) {
+ line.point(λ, φ);
+ }
+ function lineStart() {
+ clip.point = pointLine;
+ line.lineStart();
+ }
+ function lineEnd() {
+ clip.point = point;
+ line.lineEnd();
+ }
+ var segments, visibleArea, invisibleArea, invisible;
+ var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring;
+ function pointRing(λ, φ) {
+ ringListener.point(λ, φ);
+ ring.push([ λ, φ ]);
+ }
+ function ringStart() {
+ ringListener.lineStart();
+ ring = [];
+ }
+ function ringEnd() {
+ pointRing(ring[0][0], ring[0][1]);
+ ringListener.lineEnd();
+ var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
+ if (!n) {
+ invisible = true;
+ invisibleArea += d3_geo_clipAreaRing(ring, -1);
+ ring = null;
+ return;
+ }
+ ring = null;
+ if (clean & 1) {
+ segment = ringSegments[0];
+ visibleArea += d3_geo_clipAreaRing(segment, 1);
+ var n = segment.length - 1, i = -1, point;
+ listener.lineStart();
+ while (++i < n) listener.point((point = segment[i])[0], point[1]);
+ listener.lineEnd();
+ return;
+ }
+ if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
+ segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
+ }
+ return clip;
+ };
+ }
+ function d3_geo_clipPolygon(segments, interpolate, listener) {
+ var subject = [], clip = [];
+ segments.forEach(function(segment) {
+ if ((n = segment.length) <= 1) return;
+ var n, p0 = segment[0], p1 = segment[n - 1];
+ if (d3_geo_sphericalEqual(p0, p1)) {
+ listener.lineStart();
+ for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
+ listener.lineEnd();
+ return;
+ }
+ var a = {
+ point: p0,
+ points: segment,
+ other: null,
+ visited: false,
+ entry: true,
+ subject: true
+ }, b = {
+ point: p0,
+ points: [ p0 ],
+ other: a,
+ visited: false,
+ entry: false,
+ subject: false
+ };
+ a.other = b;
+ subject.push(a);
+ clip.push(b);
+ a = {
+ point: p1,
+ points: [ p1 ],
+ other: null,
+ visited: false,
+ entry: false,
+ subject: true
+ };
+ b = {
+ point: p1,
+ points: [ p1 ],
+ other: a,
+ visited: false,
+ entry: true,
+ subject: false
+ };
+ a.other = b;
+ subject.push(a);
+ clip.push(b);
+ });
+ clip.sort(d3_geo_clipSort);
+ d3_geo_clipLinkCircular(subject);
+ d3_geo_clipLinkCircular(clip);
+ if (!subject.length) return;
+ var start = subject[0], current, points, point;
+ while (1) {
+ current = start;
+ while (current.visited) if ((current = current.next) === start) return;
+ points = current.points;
+ listener.lineStart();
+ do {
+ current.visited = current.other.visited = true;
+ if (current.entry) {
+ if (current.subject) {
+ for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]);
+ } else {
+ interpolate(current.point, current.next.point, 1, listener);
+ }
+ current = current.next;
+ } else {
+ if (current.subject) {
+ points = current.prev.points;
+ for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]);
+ } else {
+ interpolate(current.point, current.prev.point, -1, listener);
+ }
+ current = current.prev;
+ }
+ current = current.other;
+ points = current.points;
+ } while (!current.visited);
+ listener.lineEnd();
+ }
+ }
+ function d3_geo_clipLinkCircular(array) {
+ if (!(n = array.length)) return;
+ var n, i = 0, a = array[0], b;
+ while (++i < n) {
+ a.next = b = array[i];
+ b.prev = a;
+ a = b;
+ }
+ a.next = b = array[0];
+ b.prev = a;
+ }
+ function d3_geo_clipSort(a, b) {
+ return ((a = a.point)[0] < 0 ? a[1] - π / 2 - ε : π / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - π / 2 - ε : π / 2 - b[1]);
+ }
+ function d3_geo_clipSegmentLength1(segment) {
+ return segment.length > 1;
+ }
+ function d3_geo_clipBufferListener() {
+ var lines = [], line;
+ return {
+ lineStart: function() {
+ lines.push(line = []);
+ },
+ point: function(λ, φ) {
+ line.push([ λ, φ ]);
+ },
+ lineEnd: d3_noop,
+ buffer: function() {
+ var buffer = lines;
+ lines = [];
+ line = null;
+ return buffer;
+ }
+ };
+ }
+ function d3_geo_clipAreaRing(ring, invisible) {
+ if (!(n = ring.length)) return 0;
+ var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y;
+ while (++i < n) {
+ p = ring[i];
+ cosφ = Math.cos(φ = p[1]);
+ x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ));
+ y = 1 - invisible * Math.cos(λ) * cosφ;
+ if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue;
+ if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - π) < ε) {
+ if (y + y0 > 2) area += 4 * (x - x0);
+ } else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * π + x - x0) % (2 * π) - π) * (y0 + y);
+ x1 = x0, x0 = x, y0 = y;
+ }
+ return area;
+ }
+ var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate);
+ function d3_geo_clipAntimeridianLine(listener) {
+ var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
+ return {
+ lineStart: function() {
+ listener.lineStart();
+ clean = 1;
+ },
+ point: function(λ1, φ1) {
+ var sλ1 = λ1 > 0 ? π : -π, dλ = Math.abs(λ1 - λ0);
+ if (Math.abs(dλ - π) < ε) {
+ listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? π / 2 : -π / 2);
+ listener.point(sλ0, φ0);
+ listener.lineEnd();
+ listener.lineStart();
+ listener.point(sλ1, φ0);
+ listener.point(λ1, φ0);
+ clean = 0;
+ } else if (sλ0 !== sλ1 && dλ >= π) {
+ if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
+ if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
+ φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
+ listener.point(sλ0, φ0);
+ listener.lineEnd();
+ listener.lineStart();
+ listener.point(sλ1, φ0);
+ clean = 0;
+ }
+ listener.point(λ0 = λ1, φ0 = φ1);
+ sλ0 = sλ1;
+ },
+ lineEnd: function() {
+ listener.lineEnd();
+ λ0 = φ0 = NaN;
+ },
+ clean: function() {
+ return 2 - clean;
+ }
+ };
+ }
+ function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
+ var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
+ return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
+ }
+ function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
+ var φ;
+ if (from == null) {
+ φ = direction * π / 2;
+ listener.point(-π, φ);
+ listener.point(0, φ);
+ listener.point(π, φ);
+ listener.point(π, 0);
+ listener.point(π, -φ);
+ listener.point(0, -φ);
+ listener.point(-π, -φ);
+ listener.point(-π, 0);
+ listener.point(-π, φ);
+ } else if (Math.abs(from[0] - to[0]) > ε) {
+ var s = (from[0] < to[0] ? 1 : -1) * π;
+ φ = direction * s / 2;
+ listener.point(-s, φ);
+ listener.point(0, φ);
+ listener.point(s, φ);
+ } else {
+ listener.point(to[0], to[1]);
+ }
+ }
+ function d3_geo_clipCircle(degrees) {
+ var radians = degrees * d3_radians, cr = Math.cos(radians), interpolate = d3_geo_circleInterpolate(radians, 6 * d3_radians);
+ return d3_geo_clip(visible, clipLine, interpolate);
+ function visible(λ, φ) {
+ return Math.cos(λ) * Math.cos(φ) > cr;
+ }
+ function clipLine(listener) {
+ var point0, v0, v00, clean;
+ return {
+ lineStart: function() {
+ v00 = v0 = false;
+ clean = 1;
+ },
+ point: function(λ, φ) {
+ var point1 = [ λ, φ ], point2, v = visible(λ, φ);
+ if (!point0 && (v00 = v0 = v)) listener.lineStart();
+ if (v !== v0) {
+ point2 = intersect(point0, point1);
+ if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
+ point1[0] += ε;
+ point1[1] += ε;
+ v = visible(point1[0], point1[1]);
+ }
+ }
+ if (v !== v0) {
+ clean = 0;
+ if (v0 = v) {
+ listener.lineStart();
+ point2 = intersect(point1, point0);
+ listener.point(point2[0], point2[1]);
+ } else {
+ point2 = intersect(point0, point1);
+ listener.point(point2[0], point2[1]);
+ listener.lineEnd();
+ }
+ point0 = point2;
+ }
+ if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) listener.point(point1[0], point1[1]);
+ point0 = point1;
+ },
+ lineEnd: function() {
+ if (v0) listener.lineEnd();
+ point0 = null;
+ },
+ clean: function() {
+ return clean | (v00 && v0) << 1;
+ }
+ };
+ }
+ function intersect(a, b) {
+ var pa = d3_geo_cartesian(a, 0), pb = d3_geo_cartesian(b, 0);
+ var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
+ if (!determinant) return a;
+ var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
+ d3_geo_cartesianAdd(A, B);
+ var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t = Math.sqrt(w * w - uu * (d3_geo_cartesianDot(A, A) - 1)), q = d3_geo_cartesianScale(u, (-w - t) / uu);
+ d3_geo_cartesianAdd(q, A);
+ return d3_geo_spherical(q);
+ }
+ }
+ function d3_geo_compose(a, b) {
+ function compose(x, y) {
+ return x = a(x, y), b(x[0], x[1]);
+ }
+ if (a.invert && b.invert) compose.invert = function(x, y) {
+ return x = b.invert(x, y), x && a.invert(x[0], x[1]);
+ };
+ return compose;
+ }
+ function d3_geo_equirectangular(λ, φ) {
+ return [ λ, φ ];
+ }
+ (d3.geo.equirectangular = function() {
+ return d3_geo_projection(d3_geo_equirectangular).scale(250 / π);
+ }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
+ var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
+ return 1 / cosλcosφ;
+ }, Math.atan);
+ (d3.geo.gnomonic = function() {
+ return d3_geo_projection(d3_geo_gnomonic);
+ }).raw = d3_geo_gnomonic;
+ d3.geo.graticule = function() {
+ var x1, x0, y1, y0, dx = 22.5, dy = dx, x, y, precision = 2.5;
+ function graticule() {
+ return {
+ type: "MultiLineString",
+ coordinates: lines()
+ };
+ }
+ function lines() {
+ return d3.range(Math.ceil(x0 / dx) * dx, x1, dx).map(x).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).map(y));
+ }
+ graticule.lines = function() {
+ return lines().map(function(coordinates) {
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ });
+ };
+ graticule.outline = function() {
+ return {
+ type: "Polygon",
+ coordinates: [ x(x0).concat(y(y1).slice(1), x(x1).reverse().slice(1), y(y0).reverse().slice(1)) ]
+ };
+ };
+ graticule.extent = function(_) {
+ if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
+ x0 = +_[0][0], x1 = +_[1][0];
+ y0 = +_[0][1], y1 = +_[1][1];
+ if (x0 > x1) _ = x0, x0 = x1, x1 = _;
+ if (y0 > y1) _ = y0, y0 = y1, y1 = _;
+ return graticule.precision(precision);
+ };
+ graticule.step = function(_) {
+ if (!arguments.length) return [ dx, dy ];
+ dx = +_[0], dy = +_[1];
+ return graticule;
+ };
+ graticule.precision = function(_) {
+ if (!arguments.length) return precision;
+ precision = +_;
+ x = d3_geo_graticuleX(y0, y1, precision);
+ y = d3_geo_graticuleY(x0, x1, precision);
+ return graticule;
+ };
+ return graticule.extent([ [ -180 + ε, -90 + ε ], [ 180 - ε, 90 - ε ] ]);
+ };
+ function d3_geo_graticuleX(y0, y1, dy) {
+ var y = d3.range(y0, y1 - ε, dy).concat(y1);
+ return function(x) {
+ return y.map(function(y) {
+ return [ x, y ];
+ });
+ };
+ }
+ function d3_geo_graticuleY(x0, x1, dx) {
+ var x = d3.range(x0, x1 - ε, dx).concat(x1);
+ return function(y) {
+ return x.map(function(x) {
+ return [ x, y ];
+ });
+ };
+ }
+ function d3_geo_haversin(x) {
+ return (x = Math.sin(x / 2)) * x;
+ }
+ d3.geo.interpolate = function(source, target) {
+ return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
+ };
+ function d3_geo_interpolate(x0, y0, x1, y1) {
+ var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_geo_haversin(y1 - y0) + cy0 * cy1 * d3_geo_haversin(x1 - x0))), k = 1 / Math.sin(d);
+ var interpolate = d ? function(t) {
+ var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
+ return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
+ } : function() {
+ return [ x0 * d3_degrees, y0 * d3_degrees ];
+ };
+ interpolate.distance = d;
+ return interpolate;
+ }
+ d3.geo.greatArc = function() {
+ var source = d3_source, source_, target = d3_target, target_, precision = 6 * d3_radians, interpolate;
+ function greatArc() {
+ var p0 = source_ || source.apply(this, arguments), p1 = target_ || target.apply(this, arguments), i = interpolate || d3.geo.interpolate(p0, p1), t = 0, dt = precision / i.distance, coordinates = [ p0 ];
+ while ((t += dt) < 1) coordinates.push(i(t));
+ coordinates.push(p1);
+ return {
+ type: "LineString",
+ coordinates: coordinates
+ };
+ }
+ greatArc.distance = function() {
+ return (interpolate || d3.geo.interpolate(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments))).distance;
+ };
+ greatArc.source = function(_) {
+ if (!arguments.length) return source;
+ source = _, source_ = typeof _ === "function" ? null : _;
+ interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
+ return greatArc;
+ };
+ greatArc.target = function(_) {
+ if (!arguments.length) return target;
+ target = _, target_ = typeof _ === "function" ? null : _;
+ interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
+ return greatArc;
+ };
+ greatArc.precision = function(_) {
+ if (!arguments.length) return precision / d3_radians;
+ precision = _ * d3_radians;
+ return greatArc;
+ };
+ return greatArc;
+ };
+ function d3_geo_mercator(λ, φ) {
+ return [ λ / (2 * π), Math.max(-.5, Math.min(+.5, Math.log(Math.tan(π / 4 + φ / 2)) / (2 * π))) ];
+ }
+ d3_geo_mercator.invert = function(x, y) {
+ return [ 2 * π * x, 2 * Math.atan(Math.exp(2 * π * y)) - π / 2 ];
+ };
+ (d3.geo.mercator = function() {
+ return d3_geo_projection(d3_geo_mercator).scale(500);
+ }).raw = d3_geo_mercator;
+ var d3_geo_orthographic = d3_geo_azimuthal(function() {
+ return 1;
+ }, Math.asin);
+ (d3.geo.orthographic = function() {
+ return d3_geo_projection(d3_geo_orthographic);
+ }).raw = d3_geo_orthographic;
+ d3.geo.path = function() {
+ var pointRadius = 4.5, projection, context, projectStream, contextStream;
+ function path(object) {
+ if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius)));
+ return contextStream.result();
+ }
+ path.area = function(object) {
+ d3_geo_pathAreaSum = 0;
+ d3.geo.stream(object, projectStream(d3_geo_pathArea));
+ return d3_geo_pathAreaSum;
+ };
+ path.centroid = function(object) {
+ d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
+ return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined;
+ };
+ path.bounds = function(object) {
+ return d3_geo_bounds(projectStream)(object);
+ };
+ path.projection = function(_) {
+ if (!arguments.length) return projection;
+ projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
+ return path;
+ };
+ path.context = function(_) {
+ if (!arguments.length) return context;
+ contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
+ return path;
+ };
+ path.pointRadius = function(_) {
+ if (!arguments.length) return pointRadius;
+ pointRadius = typeof _ === "function" ? _ : +_;
+ return path;
+ };
+ return path.projection(d3.geo.albersUsa()).context(null);
+ };
+ function d3_geo_pathCircle(radius) {
+ return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
+ }
+ function d3_geo_pathProjectStream(project) {
+ var resample = d3_geo_resample(function(λ, φ) {
+ return project([ λ * d3_degrees, φ * d3_degrees ]);
+ });
+ return function(stream) {
+ stream = resample(stream);
+ return {
+ point: function(λ, φ) {
+ stream.point(λ * d3_radians, φ * d3_radians);
+ },
+ sphere: function() {
+ stream.sphere();
+ },
+ lineStart: function() {
+ stream.lineStart();
+ },
+ lineEnd: function() {
+ stream.lineEnd();
+ },
+ polygonStart: function() {
+ stream.polygonStart();
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ }
+ };
+ };
+ }
+ function d3_geo_pathBuffer() {
+ var pointCircle = d3_geo_pathCircle(4.5), buffer = [];
+ var stream = {
+ point: point,
+ lineStart: function() {
+ stream.point = pointLineStart;
+ },
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.lineEnd = lineEndPolygon;
+ },
+ polygonEnd: function() {
+ stream.lineEnd = lineEnd;
+ stream.point = point;
+ },
+ pointRadius: function(_) {
+ pointCircle = d3_geo_pathCircle(_);
+ return stream;
+ },
+ result: function() {
+ if (buffer.length) {
+ var result = buffer.join("");
+ buffer = [];
+ return result;
+ }
+ }
+ };
+ function point(x, y) {
+ buffer.push("M", x, ",", y, pointCircle);
+ }
+ function pointLineStart(x, y) {
+ buffer.push("M", x, ",", y);
+ stream.point = pointLine;
+ }
+ function pointLine(x, y) {
+ buffer.push("L", x, ",", y);
+ }
+ function lineEnd() {
+ stream.point = point;
+ }
+ function lineEndPolygon() {
+ buffer.push("Z");
+ }
+ return stream;
+ }
+ function d3_geo_pathContext(context) {
+ var pointRadius = 4.5;
+ var stream = {
+ point: point,
+ lineStart: function() {
+ stream.point = pointLineStart;
+ },
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ stream.lineEnd = lineEndPolygon;
+ },
+ polygonEnd: function() {
+ stream.lineEnd = lineEnd;
+ stream.point = point;
+ },
+ pointRadius: function(_) {
+ pointRadius = _;
+ return stream;
+ },
+ result: d3_noop
+ };
+ function point(x, y) {
+ context.moveTo(x, y);
+ context.arc(x, y, pointRadius, 0, 2 * π);
+ }
+ function pointLineStart(x, y) {
+ context.moveTo(x, y);
+ stream.point = pointLine;
+ }
+ function pointLine(x, y) {
+ context.lineTo(x, y);
+ }
+ function lineEnd() {
+ stream.point = point;
+ }
+ function lineEndPolygon() {
+ context.closePath();
+ }
+ return stream;
+ }
+ var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
+ point: d3_noop,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ d3_geo_pathAreaPolygon = 0;
+ d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
+ d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2);
+ }
+ };
+ function d3_geo_pathAreaRingStart() {
+ var x00, y00, x0, y0;
+ d3_geo_pathArea.point = function(x, y) {
+ d3_geo_pathArea.point = nextPoint;
+ x00 = x0 = x, y00 = y0 = y;
+ };
+ function nextPoint(x, y) {
+ d3_geo_pathAreaPolygon += y0 * x - x0 * y;
+ x0 = x, y0 = y;
+ }
+ d3_geo_pathArea.lineEnd = function() {
+ nextPoint(x00, y00);
+ };
+ }
+ var d3_geo_pathCentroid = {
+ point: d3_geo_pathCentroidPoint,
+ lineStart: d3_geo_pathCentroidLineStart,
+ lineEnd: d3_geo_pathCentroidLineEnd,
+ polygonStart: function() {
+ d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
+ },
+ polygonEnd: function() {
+ d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
+ d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
+ d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
+ }
+ };
+ function d3_geo_pathCentroidPoint(x, y) {
+ if (d3_geo_centroidDimension) return;
+ d3_geo_centroidX += x;
+ d3_geo_centroidY += y;
+ ++d3_geo_centroidZ;
+ }
+ function d3_geo_pathCentroidLineStart() {
+ var x0, y0;
+ if (d3_geo_centroidDimension !== 1) {
+ if (d3_geo_centroidDimension < 1) {
+ d3_geo_centroidDimension = 1;
+ d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ } else return;
+ }
+ d3_geo_pathCentroid.point = function(x, y) {
+ d3_geo_pathCentroid.point = nextPoint;
+ x0 = x, y0 = y;
+ };
+ function nextPoint(x, y) {
+ var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
+ d3_geo_centroidX += z * (x0 + x) / 2;
+ d3_geo_centroidY += z * (y0 + y) / 2;
+ d3_geo_centroidZ += z;
+ x0 = x, y0 = y;
+ }
+ }
+ function d3_geo_pathCentroidLineEnd() {
+ d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
+ }
+ function d3_geo_pathCentroidRingStart() {
+ var x00, y00, x0, y0;
+ if (d3_geo_centroidDimension < 2) {
+ d3_geo_centroidDimension = 2;
+ d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
+ }
+ d3_geo_pathCentroid.point = function(x, y) {
+ d3_geo_pathCentroid.point = nextPoint;
+ x00 = x0 = x, y00 = y0 = y;
+ };
+ function nextPoint(x, y) {
+ var z = y0 * x - x0 * y;
+ d3_geo_centroidX += z * (x0 + x);
+ d3_geo_centroidY += z * (y0 + y);
+ d3_geo_centroidZ += z * 3;
+ x0 = x, y0 = y;
+ }
+ d3_geo_pathCentroid.lineEnd = function() {
+ nextPoint(x00, y00);
+ };
+ }
+ d3.geo.area = function(object) {
+ d3_geo_areaSum = 0;
+ d3.geo.stream(object, d3_geo_area);
+ return d3_geo_areaSum;
+ };
+ var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV;
+ var d3_geo_area = {
+ sphere: function() {
+ d3_geo_areaSum += 4 * π;
+ },
+ point: d3_noop,
+ lineStart: d3_noop,
+ lineEnd: d3_noop,
+ polygonStart: function() {
+ d3_geo_areaRingU = 1, d3_geo_areaRingV = 0;
+ d3_geo_area.lineStart = d3_geo_areaRingStart;
+ },
+ polygonEnd: function() {
+ var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU);
+ d3_geo_areaSum += area < 0 ? 4 * π + area : area;
+ d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
+ }
+ };
+ function d3_geo_areaRingStart() {
+ var λ00, φ00, λ0, cosφ0, sinφ0;
+ d3_geo_area.point = function(λ, φ) {
+ d3_geo_area.point = nextPoint;
+ λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
+ sinφ0 = Math.sin(φ);
+ };
+ function nextPoint(λ, φ) {
+ λ *= d3_radians;
+ φ = φ * d3_radians / 2 + π / 4;
+ var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
+ d3_geo_areaRingU = u0 * u - v0 * v;
+ d3_geo_areaRingV = v0 * u + u0 * v;
+ λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
+ }
+ d3_geo_area.lineEnd = function() {
+ nextPoint(λ00, φ00);
+ };
+ }
+ d3.geo.projection = d3_geo_projection;
+ d3.geo.projectionMutator = d3_geo_projectionMutator;
+ function d3_geo_projection(project) {
+ return d3_geo_projectionMutator(function() {
+ return project;
+ })();
+ }
+ function d3_geo_projectionMutator(projectAt) {
+ var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
+ x = project(x, y);
+ return [ x[0] * k + δx, δy - x[1] * k ];
+ }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, clip = d3_geo_clipAntimeridian, clipAngle = null;
+ function projection(point) {
+ point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
+ return [ point[0] * k + δx, δy - point[1] * k ];
+ }
+ function invert(point) {
+ point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
+ return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
+ }
+ projection.stream = function(stream) {
+ return d3_geo_projectionRadiansRotate(rotate, clip(projectResample(stream)));
+ };
+ projection.clipAngle = function(_) {
+ if (!arguments.length) return clipAngle;
+ clip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle(clipAngle = +_);
+ return projection;
+ };
+ projection.scale = function(_) {
+ if (!arguments.length) return k;
+ k = +_;
+ return reset();
+ };
+ projection.translate = function(_) {
+ if (!arguments.length) return [ x, y ];
+ x = +_[0];
+ y = +_[1];
+ return reset();
+ };
+ projection.center = function(_) {
+ if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
+ λ = _[0] % 360 * d3_radians;
+ φ = _[1] % 360 * d3_radians;
+ return reset();
+ };
+ projection.rotate = function(_) {
+ if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
+ δλ = _[0] % 360 * d3_radians;
+ δφ = _[1] % 360 * d3_radians;
+ δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
+ return reset();
+ };
+ d3.rebind(projection, projectResample, "precision");
+ function reset() {
+ projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
+ var center = project(λ, φ);
+ δx = x - center[0] * k;
+ δy = y + center[1] * k;
+ return projection;
+ }
+ return function() {
+ project = projectAt.apply(this, arguments);
+ projection.invert = project.invert && invert;
+ return reset();
+ };
+ }
+ function d3_geo_projectionRadiansRotate(rotate, stream) {
+ return {
+ point: function(x, y) {
+ y = rotate(x * d3_radians, y * d3_radians), x = y[0];
+ stream.point(x > π ? x - 2 * π : x < -π ? x + 2 * π : x, y[1]);
+ },
+ sphere: function() {
+ stream.sphere();
+ },
+ lineStart: function() {
+ stream.lineStart();
+ },
+ lineEnd: function() {
+ stream.lineEnd();
+ },
+ polygonStart: function() {
+ stream.polygonStart();
+ },
+ polygonEnd: function() {
+ stream.polygonEnd();
+ }
+ };
+ }
+ function d3_geo_rotation(δλ, δφ, δγ) {
+ return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular;
+ }
+ function d3_geo_forwardRotationλ(δλ) {
+ return function(λ, φ) {
+ return λ += δλ, [ λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ ];
+ };
+ }
+ function d3_geo_rotationλ(δλ) {
+ var rotation = d3_geo_forwardRotationλ(δλ);
+ rotation.invert = d3_geo_forwardRotationλ(-δλ);
+ return rotation;
+ }
+ function d3_geo_rotationφγ(δφ, δγ) {
+ var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
+ function rotation(λ, φ) {
+ var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
+ return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ];
+ }
+ rotation.invert = function(λ, φ) {
+ var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
+ return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ];
+ };
+ return rotation;
+ }
+ var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
+ return 1 / (1 + cosλcosφ);
+ }, function(ρ) {
+ return 2 * Math.atan(ρ);
+ });
+ (d3.geo.stereographic = function() {
+ return d3_geo_projection(d3_geo_stereographic);
+ }).raw = d3_geo_stereographic;
+ function d3_geo_azimuthal(scale, angle) {
+ function azimuthal(λ, φ) {
+ var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
+ return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
+ }
+ azimuthal.invert = function(x, y) {
+ var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
+ return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
+ };
+ return azimuthal;
+ }
+ d3.geom = {};
+ d3.geom.hull = function(vertices) {
+ if (vertices.length < 3) return [];
+ var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
+ for (i = 1; i < len; ++i) {
+ if (vertices[i][1] < vertices[h][1]) {
+ h = i;
+ } else if (vertices[i][1] == vertices[h][1]) {
+ h = vertices[i][0] < vertices[h][0] ? i : h;
+ }
+ }
+ for (i = 0; i < len; ++i) {
+ if (i === h) continue;
+ y1 = vertices[i][1] - vertices[h][1];
+ x1 = vertices[i][0] - vertices[h][0];
+ points.push({
+ angle: Math.atan2(y1, x1),
+ index: i
+ });
+ }
+ points.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ a = points[0].angle;
+ v = points[0].index;
+ u = 0;
+ for (i = 1; i < plen; ++i) {
+ j = points[i].index;
+ if (a == points[i].angle) {
+ x1 = vertices[v][0] - vertices[h][0];
+ y1 = vertices[v][1] - vertices[h][1];
+ x2 = vertices[j][0] - vertices[h][0];
+ y2 = vertices[j][1] - vertices[h][1];
+ if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
+ points[i].index = -1;
+ } else {
+ points[u].index = -1;
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ } else {
+ a = points[i].angle;
+ u = i;
+ v = j;
+ }
+ }
+ stack.push(h);
+ for (i = 0, j = 0; i < 2; ++j) {
+ if (points[j].index !== -1) {
+ stack.push(points[j].index);
+ i++;
+ }
+ }
+ sp = stack.length;
+ for (;j < plen; ++j) {
+ if (points[j].index === -1) continue;
+ while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
+ --sp;
+ }
+ stack[sp++] = points[j].index;
+ }
+ var poly = [];
+ for (i = 0; i < sp; ++i) {
+ poly.push(vertices[stack[i]]);
+ }
+ return poly;
+ };
+ function d3_geom_hullCCW(i1, i2, i3, v) {
+ var t, a, b, c, d, e, f;
+ t = v[i1];
+ a = t[0];
+ b = t[1];
+ t = v[i2];
+ c = t[0];
+ d = t[1];
+ t = v[i3];
+ e = t[0];
+ f = t[1];
+ return (f - b) * (c - a) - (d - b) * (e - a) > 0;
+ }
+ d3.geom.polygon = function(coordinates) {
+ coordinates.area = function() {
+ var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1];
+ while (++i < n) {
+ area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1];
+ }
+ return area * .5;
+ };
+ coordinates.centroid = function(k) {
+ var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
+ if (!arguments.length) k = -1 / (6 * coordinates.area());
+ while (++i < n) {
+ a = b;
+ b = coordinates[i];
+ c = a[0] * b[1] - b[0] * a[1];
+ x += (a[0] + b[0]) * c;
+ y += (a[1] + b[1]) * c;
+ }
+ return [ x * k, y * k ];
+ };
+ coordinates.clip = function(subject) {
+ var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
+ while (++i < n) {
+ input = subject.slice();
+ subject.length = 0;
+ b = coordinates[i];
+ c = input[(m = input.length) - 1];
+ j = -1;
+ while (++j < m) {
+ d = input[j];
+ if (d3_geom_polygonInside(d, a, b)) {
+ if (!d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ subject.push(d);
+ } else if (d3_geom_polygonInside(c, a, b)) {
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
+ }
+ c = d;
+ }
+ a = b;
+ }
+ return subject;
+ };
+ return coordinates;
+ };
+ function d3_geom_polygonInside(p, a, b) {
+ return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
+ }
+ function d3_geom_polygonIntersect(c, d, a, b) {
+ var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
+ return [ x1 + ua * x21, y1 + ua * y21 ];
+ }
+ d3.geom.voronoi = function(vertices) {
+ var polygons = vertices.map(function() {
+ return [];
+ }), Z = 1e6;
+ d3_voronoi_tessellate(vertices, function(e) {
+ var s1, s2, x1, x2, y1, y2;
+ if (e.a === 1 && e.b >= 0) {
+ s1 = e.ep.r;
+ s2 = e.ep.l;
+ } else {
+ s1 = e.ep.l;
+ s2 = e.ep.r;
+ }
+ if (e.a === 1) {
+ y1 = s1 ? s1.y : -Z;
+ x1 = e.c - e.b * y1;
+ y2 = s2 ? s2.y : Z;
+ x2 = e.c - e.b * y2;
+ } else {
+ x1 = s1 ? s1.x : -Z;
+ y1 = e.c - e.a * x1;
+ x2 = s2 ? s2.x : Z;
+ y2 = e.c - e.a * x2;
+ }
+ var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
+ polygons[e.region.l.index].push(v1, v2);
+ polygons[e.region.r.index].push(v1, v2);
+ });
+ polygons = polygons.map(function(polygon, i) {
+ var cx = vertices[i][0], cy = vertices[i][1], angle = polygon.map(function(v) {
+ return Math.atan2(v[0] - cx, v[1] - cy);
+ }), order = d3.range(polygon.length).sort(function(a, b) {
+ return angle[a] - angle[b];
+ });
+ return order.filter(function(d, i) {
+ return !i || angle[d] - angle[order[i - 1]] > ε;
+ }).map(function(d) {
+ return polygon[d];
+ });
+ });
+ polygons.forEach(function(polygon, i) {
+ var n = polygon.length;
+ if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]);
+ if (n > 2) return;
+ var p0 = vertices[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1;
+ if (Math.abs(dy) < ε) {
+ var y = y0 < y1 ? -Z : Z;
+ polygon.push([ -Z, y ], [ Z, y ]);
+ } else if (dx < ε) {
+ var x = x0 < x1 ? -Z : Z;
+ polygon.push([ x, -Z ], [ x, Z ]);
+ } else {
+ var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx;
+ if (Math.abs(z) < ε) {
+ polygon.push([ dy < 0 ? y : -y, y ]);
+ } else {
+ if (z > 0) y *= -1;
+ polygon.push([ -Z, y ], [ Z, y ]);
+ }
+ }
+ });
+ return polygons;
+ };
+ var d3_voronoi_opposite = {
+ l: "r",
+ r: "l"
+ };
+ function d3_voronoi_tessellate(vertices, callback) {
+ var Sites = {
+ list: vertices.map(function(v, i) {
+ return {
+ index: i,
+ x: v[0],
+ y: v[1]
+ };
+ }).sort(function(a, b) {
+ return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
+ }),
+ bottomSite: null
+ };
+ var EdgeList = {
+ list: [],
+ leftEnd: null,
+ rightEnd: null,
+ init: function() {
+ EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
+ EdgeList.leftEnd.r = EdgeList.rightEnd;
+ EdgeList.rightEnd.l = EdgeList.leftEnd;
+ EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
+ },
+ createHalfEdge: function(edge, side) {
+ return {
+ edge: edge,
+ side: side,
+ vertex: null,
+ l: null,
+ r: null
+ };
+ },
+ insert: function(lb, he) {
+ he.l = lb;
+ he.r = lb.r;
+ lb.r.l = he;
+ lb.r = he;
+ },
+ leftBound: function(p) {
+ var he = EdgeList.leftEnd;
+ do {
+ he = he.r;
+ } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
+ he = he.l;
+ return he;
+ },
+ del: function(he) {
+ he.l.r = he.r;
+ he.r.l = he.l;
+ he.edge = null;
+ },
+ right: function(he) {
+ return he.r;
+ },
+ left: function(he) {
+ return he.l;
+ },
+ leftRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
+ },
+ rightRegion: function(he) {
+ return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
+ }
+ };
+ var Geom = {
+ bisect: function(s1, s2) {
+ var newEdge = {
+ region: {
+ l: s1,
+ r: s2
+ },
+ ep: {
+ l: null,
+ r: null
+ }
+ };
+ var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
+ newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
+ if (adx > ady) {
+ newEdge.a = 1;
+ newEdge.b = dy / dx;
+ newEdge.c /= dx;
+ } else {
+ newEdge.b = 1;
+ newEdge.a = dx / dy;
+ newEdge.c /= dy;
+ }
+ return newEdge;
+ },
+ intersect: function(el1, el2) {
+ var e1 = el1.edge, e2 = el2.edge;
+ if (!e1 || !e2 || e1.region.r == e2.region.r) {
+ return null;
+ }
+ var d = e1.a * e2.b - e1.b * e2.a;
+ if (Math.abs(d) < 1e-10) {
+ return null;
+ }
+ var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
+ if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
+ el = el1;
+ e = e1;
+ } else {
+ el = el2;
+ e = e2;
+ }
+ var rightOfSite = xint >= e.region.r.x;
+ if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
+ return null;
+ }
+ return {
+ x: xint,
+ y: yint
+ };
+ },
+ rightOf: function(he, p) {
+ var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
+ if (rightOfSite && he.side === "l") {
+ return 1;
+ }
+ if (!rightOfSite && he.side === "r") {
+ return 0;
+ }
+ if (e.a === 1) {
+ var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
+ if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
+ above = fast = dyp >= e.b * dxp;
+ } else {
+ above = p.x + p.y * e.b > e.c;
+ if (e.b < 0) {
+ above = !above;
+ }
+ if (!above) {
+ fast = 1;
+ }
+ }
+ if (!fast) {
+ var dxs = topsite.x - e.region.l.x;
+ above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
+ if (e.b < 0) {
+ above = !above;
+ }
+ }
+ } else {
+ var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
+ above = t1 * t1 > t2 * t2 + t3 * t3;
+ }
+ return he.side === "l" ? above : !above;
+ },
+ endPoint: function(edge, side, site) {
+ edge.ep[side] = site;
+ if (!edge.ep[d3_voronoi_opposite[side]]) return;
+ callback(edge);
+ },
+ distance: function(s, t) {
+ var dx = s.x - t.x, dy = s.y - t.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ };
+ var EventQueue = {
+ list: [],
+ insert: function(he, site, offset) {
+ he.vertex = site;
+ he.ystar = site.y + offset;
+ for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
+ var next = list[i];
+ if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ list.splice(i, 0, he);
+ },
+ del: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
+ ls.splice(i, 1);
+ },
+ empty: function() {
+ return EventQueue.list.length === 0;
+ },
+ nextEvent: function(he) {
+ for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
+ if (ls[i] == he) return ls[i + 1];
+ }
+ return null;
+ },
+ min: function() {
+ var elem = EventQueue.list[0];
+ return {
+ x: elem.vertex.x,
+ y: elem.ystar
+ };
+ },
+ extractMin: function() {
+ return EventQueue.list.shift();
+ }
+ };
+ EdgeList.init();
+ Sites.bottomSite = Sites.list.shift();
+ var newSite = Sites.list.shift(), newIntStar;
+ var lbnd, rbnd, llbnd, rrbnd, bisector;
+ var bot, top, temp, p, v;
+ var e, pm;
+ while (true) {
+ if (!EventQueue.empty()) {
+ newIntStar = EventQueue.min();
+ }
+ if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
+ lbnd = EdgeList.leftBound(newSite);
+ rbnd = EdgeList.right(lbnd);
+ bot = EdgeList.rightRegion(lbnd);
+ e = Geom.bisect(bot, newSite);
+ bisector = EdgeList.createHalfEdge(e, "l");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(lbnd, bisector);
+ if (p) {
+ EventQueue.del(lbnd);
+ EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
+ }
+ lbnd = bisector;
+ bisector = EdgeList.createHalfEdge(e, "r");
+ EdgeList.insert(lbnd, bisector);
+ p = Geom.intersect(bisector, rbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, newSite));
+ }
+ newSite = Sites.list.shift();
+ } else if (!EventQueue.empty()) {
+ lbnd = EventQueue.extractMin();
+ llbnd = EdgeList.left(lbnd);
+ rbnd = EdgeList.right(lbnd);
+ rrbnd = EdgeList.right(rbnd);
+ bot = EdgeList.leftRegion(lbnd);
+ top = EdgeList.rightRegion(rbnd);
+ v = lbnd.vertex;
+ Geom.endPoint(lbnd.edge, lbnd.side, v);
+ Geom.endPoint(rbnd.edge, rbnd.side, v);
+ EdgeList.del(lbnd);
+ EventQueue.del(rbnd);
+ EdgeList.del(rbnd);
+ pm = "l";
+ if (bot.y > top.y) {
+ temp = bot;
+ bot = top;
+ top = temp;
+ pm = "r";
+ }
+ e = Geom.bisect(bot, top);
+ bisector = EdgeList.createHalfEdge(e, pm);
+ EdgeList.insert(llbnd, bisector);
+ Geom.endPoint(e, d3_voronoi_opposite[pm], v);
+ p = Geom.intersect(llbnd, bisector);
+ if (p) {
+ EventQueue.del(llbnd);
+ EventQueue.insert(llbnd, p, Geom.distance(p, bot));
+ }
+ p = Geom.intersect(bisector, rrbnd);
+ if (p) {
+ EventQueue.insert(bisector, p, Geom.distance(p, bot));
+ }
+ } else {
+ break;
+ }
+ }
+ for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
+ callback(lbnd.edge);
+ }
+ }
+ d3.geom.delaunay = function(vertices) {
+ var edges = vertices.map(function() {
+ return [];
+ }), triangles = [];
+ d3_voronoi_tessellate(vertices, function(e) {
+ edges[e.region.l.index].push(vertices[e.region.r.index]);
+ });
+ edges.forEach(function(edge, i) {
+ var v = vertices[i], cx = v[0], cy = v[1];
+ edge.forEach(function(v) {
+ v.angle = Math.atan2(v[0] - cx, v[1] - cy);
+ });
+ edge.sort(function(a, b) {
+ return a.angle - b.angle;
+ });
+ for (var j = 0, m = edge.length - 1; j < m; j++) {
+ triangles.push([ v, edge[j], edge[j + 1] ]);
+ }
+ });
+ return triangles;
+ };
+ d3.geom.quadtree = function(points, x1, y1, x2, y2) {
+ var p, i = -1, n = points.length;
+ if (arguments.length < 5) {
+ if (arguments.length === 3) {
+ y2 = y1;
+ x2 = x1;
+ y1 = x1 = 0;
+ } else {
+ x1 = y1 = Infinity;
+ x2 = y2 = -Infinity;
+ while (++i < n) {
+ p = points[i];
+ if (p.x < x1) x1 = p.x;
+ if (p.y < y1) y1 = p.y;
+ if (p.x > x2) x2 = p.x;
+ if (p.y > y2) y2 = p.y;
+ }
+ }
+ }
+ var dx = x2 - x1, dy = y2 - y1;
+ if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
+ function insert(n, p, x1, y1, x2, y2) {
+ if (isNaN(p.x) || isNaN(p.y)) return;
+ if (n.leaf) {
+ var v = n.point;
+ if (v) {
+ if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
+ insertChild(n, p, x1, y1, x2, y2);
+ } else {
+ n.point = null;
+ insertChild(n, v, x1, y1, x2, y2);
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ } else {
+ n.point = p;
+ }
+ } else {
+ insertChild(n, p, x1, y1, x2, y2);
+ }
+ }
+ function insertChild(n, p, x1, y1, x2, y2) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
+ n.leaf = false;
+ n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
+ if (right) x1 = sx; else x2 = sx;
+ if (bottom) y1 = sy; else y2 = sy;
+ insert(n, p, x1, y1, x2, y2);
+ }
+ var root = d3_geom_quadtreeNode();
+ root.add = function(p) {
+ insert(root, p, x1, y1, x2, y2);
+ };
+ root.visit = function(f) {
+ d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
+ };
+ points.forEach(root.add);
+ return root;
+ };
+ function d3_geom_quadtreeNode() {
+ return {
+ leaf: true,
+ nodes: [],
+ point: null
+ };
+ }
+ function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
+ if (!f(node, x1, y1, x2, y2)) {
+ var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
+ if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
+ if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
+ if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
+ if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
+ }
+ }
+ d3.time = {};
+ var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
+ function d3_time_utc() {
+ this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
+ }
+ d3_time_utc.prototype = {
+ getDate: function() {
+ return this._.getUTCDate();
+ },
+ getDay: function() {
+ return this._.getUTCDay();
+ },
+ getFullYear: function() {
+ return this._.getUTCFullYear();
+ },
+ getHours: function() {
+ return this._.getUTCHours();
+ },
+ getMilliseconds: function() {
+ return this._.getUTCMilliseconds();
+ },
+ getMinutes: function() {
+ return this._.getUTCMinutes();
+ },
+ getMonth: function() {
+ return this._.getUTCMonth();
+ },
+ getSeconds: function() {
+ return this._.getUTCSeconds();
+ },
+ getTime: function() {
+ return this._.getTime();
+ },
+ getTimezoneOffset: function() {
+ return 0;
+ },
+ valueOf: function() {
+ return this._.valueOf();
+ },
+ setDate: function() {
+ d3_time_prototype.setUTCDate.apply(this._, arguments);
+ },
+ setDay: function() {
+ d3_time_prototype.setUTCDay.apply(this._, arguments);
+ },
+ setFullYear: function() {
+ d3_time_prototype.setUTCFullYear.apply(this._, arguments);
+ },
+ setHours: function() {
+ d3_time_prototype.setUTCHours.apply(this._, arguments);
+ },
+ setMilliseconds: function() {
+ d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
+ },
+ setMinutes: function() {
+ d3_time_prototype.setUTCMinutes.apply(this._, arguments);
+ },
+ setMonth: function() {
+ d3_time_prototype.setUTCMonth.apply(this._, arguments);
+ },
+ setSeconds: function() {
+ d3_time_prototype.setUTCSeconds.apply(this._, arguments);
+ },
+ setTime: function() {
+ d3_time_prototype.setTime.apply(this._, arguments);
+ }
+ };
+ var d3_time_prototype = Date.prototype;
+ var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S";
+ var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
+ d3.time.format = function(template) {
+ var n = template.length;
+ function format(date) {
+ var string = [], i = -1, j = 0, c, p, f;
+ while (++i < n) {
+ if (template.charCodeAt(i) === 37) {
+ string.push(template.substring(j, i));
+ if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
+ if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
+ string.push(c);
+ j = i + 1;
+ }
+ }
+ string.push(template.substring(j, i));
+ return string.join("");
+ }
+ format.parse = function(string) {
+ var d = {
+ y: 1900,
+ m: 0,
+ d: 1,
+ H: 0,
+ M: 0,
+ S: 0,
+ L: 0
+ }, i = d3_time_parse(d, template, string, 0);
+ if (i != string.length) return null;
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
+ var date = new d3_time();
+ date.setFullYear(d.y, d.m, d.d);
+ date.setHours(d.H, d.M, d.S, d.L);
+ return date;
+ };
+ format.toString = function() {
+ return template;
+ };
+ return format;
+ };
+ function d3_time_parse(date, template, string, j) {
+ var c, p, i = 0, n = template.length, m = string.length;
+ while (i < n) {
+ if (j >= m) return -1;
+ c = template.charCodeAt(i++);
+ if (c === 37) {
+ p = d3_time_parsers[template.charAt(i++)];
+ if (!p || (j = p(date, string, j)) < 0) return -1;
+ } else if (c != string.charCodeAt(j++)) {
+ return -1;
+ }
+ }
+ return j;
+ }
+ function d3_time_formatRe(names) {
+ return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
+ }
+ function d3_time_formatLookup(names) {
+ var map = new d3_Map(), i = -1, n = names.length;
+ while (++i < n) map.set(names[i].toLowerCase(), i);
+ return map;
+ }
+ function d3_time_formatPad(value, fill, width) {
+ value += "";
+ var length = value.length;
+ return length < width ? new Array(width - length + 1).join(fill) + value : value;
+ }
+ var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
+ var d3_time_formatPads = {
+ "-": "",
+ _: " ",
+ "0": "0"
+ };
+ var d3_time_formats = {
+ a: function(d) {
+ return d3_time_dayAbbreviations[d.getDay()];
+ },
+ A: function(d) {
+ return d3_time_days[d.getDay()];
+ },
+ b: function(d) {
+ return d3_time_monthAbbreviations[d.getMonth()];
+ },
+ B: function(d) {
+ return d3_time_months[d.getMonth()];
+ },
+ c: d3.time.format(d3_time_formatDateTime),
+ d: function(d, p) {
+ return d3_time_formatPad(d.getDate(), p, 2);
+ },
+ e: function(d, p) {
+ return d3_time_formatPad(d.getDate(), p, 2);
+ },
+ H: function(d, p) {
+ return d3_time_formatPad(d.getHours(), p, 2);
+ },
+ I: function(d, p) {
+ return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
+ },
+ j: function(d, p) {
+ return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3);
+ },
+ L: function(d, p) {
+ return d3_time_formatPad(d.getMilliseconds(), p, 3);
+ },
+ m: function(d, p) {
+ return d3_time_formatPad(d.getMonth() + 1, p, 2);
+ },
+ M: function(d, p) {
+ return d3_time_formatPad(d.getMinutes(), p, 2);
+ },
+ p: function(d) {
+ return d.getHours() >= 12 ? "PM" : "AM";
+ },
+ S: function(d, p) {
+ return d3_time_formatPad(d.getSeconds(), p, 2);
+ },
+ U: function(d, p) {
+ return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2);
+ },
+ w: function(d) {
+ return d.getDay();
+ },
+ W: function(d, p) {
+ return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2);
+ },
+ x: d3.time.format(d3_time_formatDate),
+ X: d3.time.format(d3_time_formatTime),
+ y: function(d, p) {
+ return d3_time_formatPad(d.getFullYear() % 100, p, 2);
+ },
+ Y: function(d, p) {
+ return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
+ },
+ Z: d3_time_zone,
+ "%": function() {
+ return "%";
+ }
+ };
+ var d3_time_parsers = {
+ a: d3_time_parseWeekdayAbbrev,
+ A: d3_time_parseWeekday,
+ b: d3_time_parseMonthAbbrev,
+ B: d3_time_parseMonth,
+ c: d3_time_parseLocaleFull,
+ d: d3_time_parseDay,
+ e: d3_time_parseDay,
+ H: d3_time_parseHour24,
+ I: d3_time_parseHour24,
+ L: d3_time_parseMilliseconds,
+ m: d3_time_parseMonthNumber,
+ M: d3_time_parseMinutes,
+ p: d3_time_parseAmPm,
+ S: d3_time_parseSeconds,
+ x: d3_time_parseLocaleDate,
+ X: d3_time_parseLocaleTime,
+ y: d3_time_parseYear,
+ Y: d3_time_parseFullYear
+ };
+ function d3_time_parseWeekdayAbbrev(date, string, i) {
+ d3_time_dayAbbrevRe.lastIndex = 0;
+ var n = d3_time_dayAbbrevRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseWeekday(date, string, i) {
+ d3_time_dayRe.lastIndex = 0;
+ var n = d3_time_dayRe.exec(string.substring(i));
+ return n ? i += n[0].length : -1;
+ }
+ function d3_time_parseMonthAbbrev(date, string, i) {
+ d3_time_monthAbbrevRe.lastIndex = 0;
+ var n = d3_time_monthAbbrevRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseMonth(date, string, i) {
+ d3_time_monthRe.lastIndex = 0;
+ var n = d3_time_monthRe.exec(string.substring(i));
+ return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
+ }
+ function d3_time_parseLocaleFull(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
+ }
+ function d3_time_parseLocaleDate(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
+ }
+ function d3_time_parseLocaleTime(date, string, i) {
+ return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
+ }
+ function d3_time_parseFullYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 4));
+ return n ? (date.y = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseYear(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
+ }
+ function d3_time_expandYear(d) {
+ return d + (d > 68 ? 1900 : 2e3);
+ }
+ function d3_time_parseMonthNumber(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
+ }
+ function d3_time_parseDay(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.d = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseHour24(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.H = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMinutes(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.M = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseSeconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 2));
+ return n ? (date.S = +n[0], i += n[0].length) : -1;
+ }
+ function d3_time_parseMilliseconds(date, string, i) {
+ d3_time_numberRe.lastIndex = 0;
+ var n = d3_time_numberRe.exec(string.substring(i, i + 3));
+ return n ? (date.L = +n[0], i += n[0].length) : -1;
+ }
+ var d3_time_numberRe = /^\s*\d+/;
+ function d3_time_parseAmPm(date, string, i) {
+ var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
+ return n == null ? -1 : (date.p = n, i);
+ }
+ var d3_time_amPmLookup = d3.map({
+ am: 0,
+ pm: 1
+ });
+ function d3_time_zone(d) {
+ var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
+ return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
+ }
+ d3.time.format.utc = function(template) {
+ var local = d3.time.format(template);
+ function format(date) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time();
+ utc._ = date;
+ return local(utc);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ format.parse = function(string) {
+ try {
+ d3_time = d3_time_utc;
+ var date = local.parse(string);
+ return date && date._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ format.toString = local.toString;
+ return format;
+ };
+ var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
+ d3.time.format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
+ function d3_time_formatIsoNative(date) {
+ return date.toISOString();
+ }
+ d3_time_formatIsoNative.parse = function(string) {
+ var date = new Date(string);
+ return isNaN(date) ? null : date;
+ };
+ d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
+ function d3_time_interval(local, step, number) {
+ function round(date) {
+ var d0 = local(date), d1 = offset(d0, 1);
+ return date - d0 < d1 - date ? d0 : d1;
+ }
+ function ceil(date) {
+ step(date = local(new d3_time(date - 1)), 1);
+ return date;
+ }
+ function offset(date, k) {
+ step(date = new d3_time(+date), k);
+ return date;
+ }
+ function range(t0, t1, dt) {
+ var time = ceil(t0), times = [];
+ if (dt > 1) {
+ while (time < t1) {
+ if (!(number(time) % dt)) times.push(new Date(+time));
+ step(time, 1);
+ }
+ } else {
+ while (time < t1) times.push(new Date(+time)), step(time, 1);
+ }
+ return times;
+ }
+ function range_utc(t0, t1, dt) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = t0;
+ return range(utc, t1, dt);
+ } finally {
+ d3_time = Date;
+ }
+ }
+ local.floor = local;
+ local.round = round;
+ local.ceil = ceil;
+ local.offset = offset;
+ local.range = range;
+ var utc = local.utc = d3_time_interval_utc(local);
+ utc.floor = utc;
+ utc.round = d3_time_interval_utc(round);
+ utc.ceil = d3_time_interval_utc(ceil);
+ utc.offset = d3_time_interval_utc(offset);
+ utc.range = range_utc;
+ return local;
+ }
+ function d3_time_interval_utc(method) {
+ return function(date, k) {
+ try {
+ d3_time = d3_time_utc;
+ var utc = new d3_time_utc();
+ utc._ = date;
+ return method(utc, k)._;
+ } finally {
+ d3_time = Date;
+ }
+ };
+ }
+ d3.time.second = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 1e3) * 1e3);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 1e3);
+ }, function(date) {
+ return date.getSeconds();
+ });
+ d3.time.seconds = d3.time.second.range;
+ d3.time.seconds.utc = d3.time.second.utc.range;
+ d3.time.minute = d3_time_interval(function(date) {
+ return new d3_time(Math.floor(date / 6e4) * 6e4);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 6e4);
+ }, function(date) {
+ return date.getMinutes();
+ });
+ d3.time.minutes = d3.time.minute.range;
+ d3.time.minutes.utc = d3.time.minute.utc.range;
+ d3.time.hour = d3_time_interval(function(date) {
+ var timezone = date.getTimezoneOffset() / 60;
+ return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
+ }, function(date, offset) {
+ date.setTime(date.getTime() + Math.floor(offset) * 36e5);
+ }, function(date) {
+ return date.getHours();
+ });
+ d3.time.hours = d3.time.hour.range;
+ d3.time.hours.utc = d3.time.hour.utc.range;
+ d3.time.day = d3_time_interval(function(date) {
+ var day = new d3_time(1970, 0);
+ day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
+ return day;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + offset);
+ }, function(date) {
+ return date.getDate() - 1;
+ });
+ d3.time.days = d3.time.day.range;
+ d3.time.days.utc = d3.time.day.utc.range;
+ d3.time.dayOfYear = function(date) {
+ var year = d3.time.year(date);
+ return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
+ };
+ d3_time_daySymbols.forEach(function(day, i) {
+ day = day.toLowerCase();
+ i = 7 - i;
+ var interval = d3.time[day] = d3_time_interval(function(date) {
+ (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
+ return date;
+ }, function(date, offset) {
+ date.setDate(date.getDate() + Math.floor(offset) * 7);
+ }, function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
+ });
+ d3.time[day + "s"] = interval.range;
+ d3.time[day + "s"].utc = interval.utc.range;
+ d3.time[day + "OfYear"] = function(date) {
+ var day = d3.time.year(date).getDay();
+ return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
+ };
+ });
+ d3.time.week = d3.time.sunday;
+ d3.time.weeks = d3.time.sunday.range;
+ d3.time.weeks.utc = d3.time.sunday.utc.range;
+ d3.time.weekOfYear = d3.time.sundayOfYear;
+ d3.time.month = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setDate(1);
+ return date;
+ }, function(date, offset) {
+ date.setMonth(date.getMonth() + offset);
+ }, function(date) {
+ return date.getMonth();
+ });
+ d3.time.months = d3.time.month.range;
+ d3.time.months.utc = d3.time.month.utc.range;
+ d3.time.year = d3_time_interval(function(date) {
+ date = d3.time.day(date);
+ date.setMonth(0, 1);
+ return date;
+ }, function(date, offset) {
+ date.setFullYear(date.getFullYear() + offset);
+ }, function(date) {
+ return date.getFullYear();
+ });
+ d3.time.years = d3.time.year.range;
+ d3.time.years.utc = d3.time.year.utc.range;
+ function d3_time_scale(linear, methods, format) {
+ function scale(x) {
+ return linear(x);
+ }
+ scale.invert = function(x) {
+ return d3_time_scaleDate(linear.invert(x));
+ };
+ scale.domain = function(x) {
+ if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
+ linear.domain(x);
+ return scale;
+ };
+ scale.nice = function(m) {
+ return scale.domain(d3_scale_nice(scale.domain(), function() {
+ return m;
+ }));
+ };
+ scale.ticks = function(m, k) {
+ var extent = d3_time_scaleExtent(scale.domain());
+ if (typeof m !== "function") {
+ var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
+ if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
+ if (!i) return linear.ticks(m).map(d3_time_scaleDate);
+ if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
+ m = methods[i];
+ k = m[1];
+ m = m[0].range;
+ }
+ return m(extent[0], new Date(+extent[1] + 1), k);
+ };
+ scale.tickFormat = function() {
+ return format;
+ };
+ scale.copy = function() {
+ return d3_time_scale(linear.copy(), methods, format);
+ };
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
+ }
+ function d3_time_scaleExtent(domain) {
+ var start = domain[0], stop = domain[domain.length - 1];
+ return start < stop ? [ start, stop ] : [ stop, start ];
+ }
+ function d3_time_scaleDate(t) {
+ return new Date(t);
+ }
+ function d3_time_scaleFormat(formats) {
+ return function(date) {
+ var i = formats.length - 1, f = formats[i];
+ while (!f[1](date)) f = formats[--i];
+ return f[0](date);
+ };
+ }
+ function d3_time_scaleSetYear(y) {
+ var d = new Date(y, 0, 1);
+ d.setFullYear(y);
+ return d;
+ }
+ function d3_time_scaleGetYear(d) {
+ var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
+ var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
+ var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) {
+ return d.getMonth();
+ } ], [ d3.time.format("%b %d"), function(d) {
+ return d.getDate() != 1;
+ } ], [ d3.time.format("%a %d"), function(d) {
+ return d.getDay() && d.getDate() != 1;
+ } ], [ d3.time.format("%I %p"), function(d) {
+ return d.getHours();
+ } ], [ d3.time.format("%I:%M"), function(d) {
+ return d.getMinutes();
+ } ], [ d3.time.format(":%S"), function(d) {
+ return d.getSeconds();
+ } ], [ d3.time.format(".%L"), function(d) {
+ return d.getMilliseconds();
+ } ] ];
+ var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
+ d3_time_scaleLocalMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
+ };
+ d3.time.scale = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
+ };
+ var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
+ return [ m[0].utc, m[1] ];
+ });
+ var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) {
+ return d.getUTCMonth();
+ } ], [ d3.time.format.utc("%b %d"), function(d) {
+ return d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%a %d"), function(d) {
+ return d.getUTCDay() && d.getUTCDate() != 1;
+ } ], [ d3.time.format.utc("%I %p"), function(d) {
+ return d.getUTCHours();
+ } ], [ d3.time.format.utc("%I:%M"), function(d) {
+ return d.getUTCMinutes();
+ } ], [ d3.time.format.utc(":%S"), function(d) {
+ return d.getUTCSeconds();
+ } ], [ d3.time.format.utc(".%L"), function(d) {
+ return d.getUTCMilliseconds();
+ } ] ];
+ var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
+ function d3_time_scaleUTCSetYear(y) {
+ var d = new Date(Date.UTC(y, 0, 1));
+ d.setUTCFullYear(y);
+ return d;
+ }
+ function d3_time_scaleUTCGetYear(d) {
+ var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
+ return y + (d - d0) / (d1 - d0);
+ }
+ d3_time_scaleUTCMethods.year = function(extent, m) {
+ return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
+ };
+ d3.time.scale.utc = function() {
+ return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
+ };
+ return d3;
+}();
\ No newline at end of file
diff --git a/web/ons-demo/d3/d3.v3.min.js b/web/ons-demo/d3/d3.v3.min.js
new file mode 100644
index 0000000..7f3faa4
--- /dev/null
+++ b/web/ons-demo/d3/d3.v3.min.js
@@ -0,0 +1,4 @@
+d3=function(){function t(t){return t.target}function n(t){return t.source}function e(t,n){try{for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}catch(r){t.prototype=n}}function r(t){for(var n=-1,e=t.length,r=[];e>++n;)r.push(t[n]);return r}function u(t){return Array.prototype.slice.call(t)}function i(){}function a(t){return t}function o(){return!0}function c(t){return"function"==typeof t?t:function(){return t}}function l(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function f(t){return null!=t&&!isNaN(t)}function s(t){return t.length}function h(t){return t.trim().replace(/\s+/g," ")}function g(t){for(var n=1;t*n%1;)n*=10;return n}function p(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}function d(t){return t.responseText}function m(t){return JSON.parse(t.responseText)}function v(t){var n=Li.createRange();return n.selectNode(Li.body),n.createContextualFragment(t.responseText)}function y(t){return t.responseXML}function M(){}function b(t){function n(){for(var n,r=e,u=-1,i=r.length;i>++u;)(n=r[u].on)&&n.apply(this,arguments);return t}var e=[],r=new i;return n.on=function(n,u){var i,a=r.get(n);return 2>arguments.length?a&&a.on:(a&&(a.on=null,e=e.slice(0,i=e.indexOf(a)).concat(e.slice(i+1)),r.remove(n)),u&&e.push(r.set(n,{on:u})),t)},n}function x(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function _(t){return t+""}function w(t,n){var e=Math.pow(10,3*Math.abs(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}function S(t){return function(n){return 0>=n?0:n>=1?1:t(n)}}function k(t){return function(n){return 1-t(1-n)}}function E(t){return function(n){return.5*(.5>n?t(2*n):2-t(2-2*n))}}function A(t){return t*t}function N(t){return t*t*t}function T(t){if(0>=t)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(.5>t?e:3*(t-n)+e-.75)}function q(t){return function(n){return Math.pow(n,t)}}function C(t){return 1-Math.cos(t*Ti/2)}function z(t){return Math.pow(2,10*(t-1))}function D(t){return 1-Math.sqrt(1-t*t)}function L(t,n){var e;return 2>arguments.length&&(n=.45),arguments.length?e=n/(2*Ti)*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Ti/n)}}function F(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}}function H(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function j(){Ci.event.stopPropagation(),Ci.event.preventDefault()}function P(){for(var t,n=Ci.event;t=n.sourceEvent;)n=t;return n}function R(t){for(var n=new M,e=0,r=arguments.length;r>++e;)n[arguments[e]]=b(n);return n.of=function(e,r){return function(u){try{var i=u.sourceEvent=Ci.event;u.target=t,Ci.event=u,n[u.type].apply(e,r)}finally{Ci.event=i}}},n}function O(t){var n=[t.a,t.b],e=[t.c,t.d],r=U(n),u=Y(n,e),i=U(I(e,n,-u))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Di,this.translate=[t.e,t.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*Di:0}function Y(t,n){return t[0]*n[0]+t[1]*n[1]}function U(t){var n=Math.sqrt(Y(t,t));return n&&(t[0]/=n,t[1]/=n),n}function I(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}function V(t){return"transform"==t?Ci.interpolateTransform:Ci.interpolate}function Z(t,n){return n=n-(t=+t)?1/(n-t):0,function(e){return(e-t)*n}}function X(t,n){return n=n-(t=+t)?1/(n-t):0,function(e){return Math.max(0,Math.min(1,(e-t)*n))}}function B(){}function $(t,n,e){return new J(t,n,e)}function J(t,n,e){this.r=t,this.g=n,this.b=e}function G(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function K(t,n,e){var r,u,i,a=0,o=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(t))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return n(nn(u[0]),nn(u[1]),nn(u[2]))}return(i=oa.get(t))?n(i.r,i.g,i.b):(null!=t&&"#"===t.charAt(0)&&(4===t.length?(a=t.charAt(1),a+=a,o=t.charAt(2),o+=o,c=t.charAt(3),c+=c):7===t.length&&(a=t.substring(1,3),o=t.substring(3,5),c=t.substring(5,7)),a=parseInt(a,16),o=parseInt(o,16),c=parseInt(c,16)),n(a,o,c))}function W(t,n,e){var r,u,i=Math.min(t/=255,n/=255,e/=255),a=Math.max(t,n,e),o=a-i,c=(a+i)/2;return o?(u=.5>c?o/(a+i):o/(2-a-i),r=t==a?(n-e)/o+(e>n?6:0):n==a?(e-t)/o+2:(t-n)/o+4,r*=60):u=r=0,en(r,u,c)}function Q(t,n,e){t=tn(t),n=tn(n),e=tn(e);var r=pn((.4124564*t+.3575761*n+.1804375*e)/sa),u=pn((.2126729*t+.7151522*n+.072175*e)/ha),i=pn((.0193339*t+.119192*n+.9503041*e)/ga);return ln(116*u-16,500*(r-u),200*(u-i))}function tn(t){return.04045>=(t/=255)?t/12.92:Math.pow((t+.055)/1.055,2.4)}function nn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}function en(t,n,e){return new rn(t,n,e)}function rn(t,n,e){this.h=t,this.s=n,this.l=e}function un(t,n,e){function r(t){return t>360?t-=360:0>t&&(t+=360),60>t?i+(a-i)*t/60:180>t?a:240>t?i+(a-i)*(240-t)/60:i}function u(t){return Math.round(255*r(t))}var i,a;return t%=360,0>t&&(t+=360),n=0>n?0:n>1?1:n,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+n):e+n-e*n,i=2*e-a,$(u(t+120),u(t),u(t-120))}function an(t,n,e){return new on(t,n,e)}function on(t,n,e){this.h=t,this.c=n,this.l=e}function cn(t,n,e){return ln(e,Math.cos(t*=zi)*n,Math.sin(t)*n)}function ln(t,n,e){return new fn(t,n,e)}function fn(t,n,e){this.l=t,this.a=n,this.b=e}function sn(t,n,e){var r=(t+16)/116,u=r+n/500,i=r-e/200;return u=gn(u)*sa,r=gn(r)*ha,i=gn(i)*ga,$(dn(3.2404542*u-1.5371385*r-.4985314*i),dn(-.969266*u+1.8760108*r+.041556*i),dn(.0556434*u-.2040259*r+1.0572252*i))}function hn(t,n,e){return an(180*(Math.atan2(e,n)/Ti),Math.sqrt(n*n+e*e),t)}function gn(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function pn(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function dn(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function mn(t){return Vi(t,ba),t}function vn(t){return function(){return da(t,this)}}function yn(t){return function(){return ma(t,this)}}function Mn(t,n){function e(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function u(){this.setAttribute(t,n)}function i(){this.setAttributeNS(t.space,t.local,n)}function a(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}function o(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}return t=Ci.ns.qualify(t),null==n?t.local?r:e:"function"==typeof n?t.local?o:a:t.local?i:u}function bn(t){return RegExp("(?:^|\\s+)"+Ci.requote(t)+"(?:\\s+|$)","g")}function xn(t,n){function e(){for(var e=-1;u>++e;)t[e](this,n)}function r(){for(var e=-1,r=n.apply(this,arguments);u>++e;)t[e](this,r)}t=t.trim().split(/\s+/).map(_n);var u=t.length;return"function"==typeof n?r:e}function _n(t){var n=bn(t);return function(e,r){if(u=e.classList)return r?u.add(t):u.remove(t);var u=e.className,i=null!=u.baseVal,a=i?u.baseVal:u;r?(n.lastIndex=0,n.test(a)||(a=h(a+" "+t),i?u.baseVal=a:e.className=a)):a&&(a=h(a.replace(n," ")),i?u.baseVal=a:e.className=a)}}function wn(t,n,e){function r(){this.style.removeProperty(t)}function u(){this.style.setProperty(t,n,e)}function i(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}return null==n?r:"function"==typeof n?i:u}function Sn(t,n){function e(){delete this[t]}function r(){this[t]=n}function u(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}return null==n?e:"function"==typeof n?u:r}function kn(t){return{__data__:t}}function En(t){return function(){return Ma(this,t)}}function An(t){return arguments.length||(t=Ci.ascending),function(n,e){return!n-!e||t(n.__data__,e.__data__)}}function Nn(t,n,e){function r(){var n=this[i];n&&(this.removeEventListener(t,n,n.$),delete this[i])}function u(){function u(t){var e=Ci.event;Ci.event=t,o[0]=a.__data__;try{n.apply(a,o)}finally{Ci.event=e}}var a=this,o=Ui(arguments);r.call(this),this.addEventListener(t,this[i]=u,u.$=e),u._=n}var i="__on"+t,a=t.indexOf(".");return a>0&&(t=t.substring(0,a)),n?u:r}function Tn(t,n){for(var e=0,r=t.length;r>e;e++)for(var u,i=t[e],a=0,o=i.length;o>a;a++)(u=i[a])&&n(u,a,e);return t}function qn(t){return Vi(t,_a),t}function Cn(t,n){return Vi(t,Sa),t.id=n,t}function zn(t,n,e,r){var u=t.__transition__||(t.__transition__={active:0,count:0}),a=u[e];if(!a){var o=r.time;return a=u[e]={tween:new i,event:Ci.dispatch("start","end"),time:o,ease:r.ease,delay:r.delay,duration:r.duration},++u.count,Ci.timer(function(r){function i(r){return u.active>e?l():(u.active=e,h.start.call(t,f,n),a.tween.forEach(function(e,r){(r=r.call(t,f,n))&&d.push(r)}),c(r)||Ci.timer(c,0,o),1)}function c(r){if(u.active!==e)return l();for(var i=(r-g)/p,a=s(i),o=d.length;o>0;)d[--o].call(t,a);return i>=1?(l(),h.end.call(t,f,n),1):void 0}function l(){return--u.count?delete u[e]:delete t.__transition__,1}var f=t.__data__,s=a.ease,h=a.event,g=a.delay,p=a.duration,d=[];return r>=g?i(r):Ci.timer(i,g,o),1},0,o),a}}function Dn(t){return null==t&&(t=""),function(){this.textContent=t}}function Ln(t,n,e,r){var u=t.id;return Tn(t,"function"==typeof e?function(t,i,a){t.__transition__[u].tween.set(n,r(e.call(t,t.__data__,i,a)))}:(e=r(e),function(t){t.__transition__[u].tween.set(n,e)}))}function Fn(){for(var t,n=Date.now(),e=Ca;e;)t=n-e.then,t>=e.delay&&(e.flush=e.callback(t)),e=e.next;var r=Hn()-n;r>24?(isFinite(r)&&(clearTimeout(Na),Na=setTimeout(Fn,r)),Aa=0):(Aa=1,za(Fn))}function Hn(){for(var t=null,n=Ca,e=1/0;n;)n.flush?(delete qa[n.callback.id],n=t?t.next=n.next:Ca=n.next):(e=Math.min(e,n.then+n.delay),n=(t=n).next);return e}function jn(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Da&&(Fi.scrollX||Fi.scrollY)){e=Ci.select(Li.body).append("svg").style("position","absolute").style("top",0).style("left",0);var u=e[0][0].getScreenCTM();Da=!(u.f||u.e),e.remove()}return Da?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]}function Pn(){}function Rn(t){var n=t[0],e=t[t.length-1];return e>n?[n,e]:[e,n]}function On(t){return t.rangeExtent?t.rangeExtent():Rn(t.range())}function Yn(t,n){var e,r=0,u=t.length-1,i=t[r],a=t[u];return i>a&&(e=r,r=u,u=e,e=i,i=a,a=e),(n=n(a-i))&&(t[r]=n.floor(i),t[u]=n.ceil(a)),t}function Un(){return Math}function In(t,n,e,r){function u(){var u=Math.min(t.length,n.length)>2?Gn:Jn,c=r?X:Z;return a=u(t,n,c,e),o=u(n,t,c,Ci.interpolate),i}function i(t){return a(t)}var a,o;return i.invert=function(t){return o(t)},i.domain=function(n){return arguments.length?(t=n.map(Number),u()):t},i.range=function(t){return arguments.length?(n=t,u()):n},i.rangeRound=function(t){return i.range(t).interpolate(Ci.interpolateRound)},i.clamp=function(t){return arguments.length?(r=t,u()):r},i.interpolate=function(t){return arguments.length?(e=t,u()):e},i.ticks=function(n){return Bn(t,n)},i.tickFormat=function(n){return $n(t,n)},i.nice=function(){return Yn(t,Zn),u()},i.copy=function(){return In(t,n,e,r)},u()}function Vn(t,n){return Ci.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Zn(t){return t=Math.pow(10,Math.round(Math.log(t)/Math.LN10)-1),t&&{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}}function Xn(t,n){var e=Rn(t),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),i=n/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Bn(t,n){return Ci.range.apply(Ci,Xn(t,n))}function $n(t,n){return Ci.format(",."+Math.max(0,-Math.floor(Math.log(Xn(t,n)[2])/Math.LN10+.01))+"f")}function Jn(t,n,e,r){var u=e(t[0],t[1]),i=r(n[0],n[1]);return function(t){return i(u(t))}}function Gn(t,n,e,r){var u=[],i=[],a=0,o=Math.min(t.length,n.length)-1;for(t[o]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());o>=++a;)u.push(e(t[a-1],t[a])),i.push(r(n[a-1],n[a]));return function(n){var e=Ci.bisect(t,n,1,o)-1;return i[e](u[e](n))}}function Kn(t,n){function e(e){return t(n(e))}var r=n.pow;return e.invert=function(n){return r(t.invert(n))},e.domain=function(u){return arguments.length?(n=0>u[0]?Qn:Wn,r=n.pow,t.domain(u.map(n)),e):t.domain().map(r)},e.nice=function(){return t.domain(Yn(t.domain(),Un)),e},e.ticks=function(){var e=Rn(t.domain()),u=[];if(e.every(isFinite)){var i=Math.floor(e[0]),a=Math.ceil(e[1]),o=r(e[0]),c=r(e[1]);if(n===Qn)for(u.push(r(i));a>i++;)for(var l=9;l>0;l--)u.push(r(i)*l);else{for(;a>i;i++)for(var l=1;10>l;l++)u.push(r(i)*l);u.push(r(i))}for(i=0;o>u[i];i++);for(a=u.length;u[a-1]>c;a--);u=u.slice(i,a)}return u},e.tickFormat=function(t,u){if(2>arguments.length&&(u=La),!arguments.length)return u;var i,a=Math.max(.1,t/e.ticks().length),o=n===Qn?(i=-1e-12,Math.floor):(i=1e-12,Math.ceil);return function(t){return a>=t/r(o(n(t)+i))?u(t):""}},e.copy=function(){return Kn(t.copy(),n)},Vn(e,t)}function Wn(t){return Math.log(0>t?0:t)/Math.LN10}function Qn(t){return-Math.log(t>0?0:-t)/Math.LN10}function te(t,n){function e(n){return t(r(n))}var r=ne(n),u=ne(1/n);return e.invert=function(n){return u(t.invert(n))},e.domain=function(n){return arguments.length?(t.domain(n.map(r)),e):t.domain().map(u)},e.ticks=function(t){return Bn(e.domain(),t)},e.tickFormat=function(t){return $n(e.domain(),t)},e.nice=function(){return e.domain(Yn(e.domain(),Zn))},e.exponent=function(t){if(!arguments.length)return n;var i=e.domain();return r=ne(n=t),u=ne(1/n),e.domain(i)},e.copy=function(){return te(t.copy(),n)},Vn(e,t)}function ne(t){return function(n){return 0>n?-Math.pow(-n,t):Math.pow(n,t)}}function ee(t,n){function e(n){return a[((u.get(n)||u.set(n,t.push(n)))-1)%a.length]}function r(n,e){return Ci.range(t.length).map(function(t){return n+e*t})}var u,a,o;return e.domain=function(r){if(!arguments.length)return t;t=[],u=new i;for(var a,o=-1,c=r.length;c>++o;)u.has(a=r[o])||u.set(a,t.push(a));return e[n.t].apply(e,n.a)},e.range=function(t){return arguments.length?(a=t,o=0,n={t:"range",a:arguments},e):a},e.rangePoints=function(u,i){2>arguments.length&&(i=0);var c=u[0],l=u[1],f=(l-c)/(Math.max(1,t.length-1)+i);return a=r(2>t.length?(c+l)/2:c+f*i/2,f),o=0,n={t:"rangePoints",a:arguments},e},e.rangeBands=function(u,i,c){2>arguments.length&&(i=0),3>arguments.length&&(c=i);var l=u[1]<u[0],f=u[l-0],s=u[1-l],h=(s-f)/(t.length-i+2*c);return a=r(f+h*c,h),l&&a.reverse(),o=h*(1-i),n={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,i,c){2>arguments.length&&(i=0),3>arguments.length&&(c=i);var l=u[1]<u[0],f=u[l-0],s=u[1-l],h=Math.floor((s-f)/(t.length-i+2*c)),g=s-f-(t.length-i)*h;return a=r(f+Math.round(g/2),h),l&&a.reverse(),o=Math.round(h*(1-i)),n={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Rn(n.a[0])},e.copy=function(){return ee(t,n)},e.domain(t)}function re(t,n){function e(){var e=0,i=n.length;for(u=[];i>++e;)u[e-1]=Ci.quantile(t,e/i);return r}function r(t){return isNaN(t=+t)?0/0:n[Ci.bisect(u,t)]}var u;return r.domain=function(n){return arguments.length?(t=n.filter(function(t){return!isNaN(t)}).sort(Ci.ascending),e()):t},r.range=function(t){return arguments.length?(n=t,e()):n},r.quantiles=function(){return u},r.copy=function(){return re(t,n)},e()}function ue(t,n,e){function r(n){return e[Math.max(0,Math.min(a,Math.floor(i*(n-t))))]}function u(){return i=e.length/(n-t),a=e.length-1,r}var i,a;return r.domain=function(e){return arguments.length?(t=+e[0],n=+e[e.length-1],u()):[t,n]},r.range=function(t){return arguments.length?(e=t,u()):e},r.copy=function(){return ue(t,n,e)},u()}function ie(t,n){function e(e){return n[Ci.bisect(t,e)]}return e.domain=function(n){return arguments.length?(t=n,e):t},e.range=function(t){return arguments.length?(n=t,e):n},e.copy=function(){return ie(t,n)},e}function ae(t){function n(t){return+t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=e.map(n),n):t},n.ticks=function(n){return Bn(t,n)},n.tickFormat=function(n){return $n(t,n)},n.copy=function(){return ae(t)},n}function oe(t){return t.innerRadius}function ce(t){return t.outerRadius}function le(t){return t.startAngle}function fe(t){return t.endAngle}function se(t){function n(n){function a(){f.push("M",i(t(s),l))}for(var o,f=[],s=[],h=-1,g=n.length,p=c(e),d=c(r);g>++h;)u.call(this,o=n[h],h)?s.push([+p.call(this,o,h),+d.call(this,o,h)]):s.length&&(a(),s=[]);return s.length&&a(),f.length?f.join(""):null}var e=he,r=ge,u=o,i=pe,a=i.key,l=.7;return n.x=function(t){return arguments.length?(e=t,n):e},n.y=function(t){return arguments.length?(r=t,n):r},n.defined=function(t){return arguments.length?(u=t,n):u},n.interpolate=function(t){return arguments.length?(a="function"==typeof t?i=t:(i=Ya.get(t)||pe).key,n):a},n.tension=function(t){return arguments.length?(l=t,n):l},n}function he(t){return t[0]}function ge(t){return t[1]}function pe(t){return t.join("L")}function de(t){return pe(t)+"Z"}function me(t){for(var n=0,e=t.length,r=t[0],u=[r[0],",",r[1]];e>++n;)u.push("V",(r=t[n])[1],"H",r[0]);return u.join("")}function ve(t){for(var n=0,e=t.length,r=t[0],u=[r[0],",",r[1]];e>++n;)u.push("H",(r=t[n])[0],"V",r[1]);return u.join("")}function ye(t,n){return 4>t.length?pe(t):t[1]+xe(t.slice(1,t.length-1),_e(t,n))}function Me(t,n){return 3>t.length?pe(t):t[0]+xe((t.push(t[0]),t),_e([t[t.length-2]].concat(t,[t[1]]),n))}function be(t,n){return 3>t.length?pe(t):t[0]+xe(t,_e(t,n))}function xe(t,n){if(1>n.length||t.length!=n.length&&t.length!=n.length+2)return pe(t);var e=t.length!=n.length,r="",u=t[0],i=t[1],a=n[0],o=a,c=1;if(e&&(r+="Q"+(i[0]-2*a[0]/3)+","+(i[1]-2*a[1]/3)+","+i[0]+","+i[1],u=t[1],c=2),n.length>1){o=n[1],i=t[c],c++,r+="C"+(u[0]+a[0])+","+(u[1]+a[1])+","+(i[0]-o[0])+","+(i[1]-o[1])+","+i[0]+","+i[1];for(var l=2;n.length>l;l++,c++)i=t[c],o=n[l],r+="S"+(i[0]-o[0])+","+(i[1]-o[1])+","+i[0]+","+i[1]}if(e){var f=t[c];r+="Q"+(i[0]+2*o[0]/3)+","+(i[1]+2*o[1]/3)+","+f[0]+","+f[1]}return r}function _e(t,n){for(var e,r=[],u=(1-n)/2,i=t[0],a=t[1],o=1,c=t.length;c>++o;)e=i,i=a,a=t[o],r.push([u*(a[0]-e[0]),u*(a[1]-e[1])]);return r}function we(t){if(3>t.length)return pe(t);var n=1,e=t.length,r=t[0],u=r[0],i=r[1],a=[u,u,u,(r=t[1])[0]],o=[i,i,i,r[1]],c=[u,",",i];for(Ne(c,a,o);e>++n;)r=t[n],a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),Ne(c,a,o);for(n=-1;2>++n;)a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),Ne(c,a,o);return c.join("")}function Se(t){if(4>t.length)return pe(t);for(var n,e=[],r=-1,u=t.length,i=[0],a=[0];3>++r;)n=t[r],i.push(n[0]),a.push(n[1]);for(e.push(Ae(Va,i)+","+Ae(Va,a)),--r;u>++r;)n=t[r],i.shift(),i.push(n[0]),a.shift(),a.push(n[1]),Ne(e,i,a);return e.join("")}function ke(t){for(var n,e,r=-1,u=t.length,i=u+4,a=[],o=[];4>++r;)e=t[r%u],a.push(e[0]),o.push(e[1]);for(n=[Ae(Va,a),",",Ae(Va,o)],--r;i>++r;)e=t[r%u],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),Ne(n,a,o);return n.join("")}function Ee(t,n){var e=t.length-1;if(e)for(var r,u,i=t[0][0],a=t[0][1],o=t[e][0]-i,c=t[e][1]-a,l=-1;e>=++l;)r=t[l],u=l/e,r[0]=n*r[0]+(1-n)*(i+u*o),r[1]=n*r[1]+(1-n)*(a+u*c);return we(t)}function Ae(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}function Ne(t,n,e){t.push("C",Ae(Ua,n),",",Ae(Ua,e),",",Ae(Ia,n),",",Ae(Ia,e),",",Ae(Va,n),",",Ae(Va,e))}function Te(t,n){return(n[1]-t[1])/(n[0]-t[0])}function qe(t){for(var n=0,e=t.length-1,r=[],u=t[0],i=t[1],a=r[0]=Te(u,i);e>++n;)r[n]=(a+(a=Te(u=i,i=t[n+1])))/2;return r[n]=a,r}function Ce(t){for(var n,e,r,u,i=[],a=qe(t),o=-1,c=t.length-1;c>++o;)n=Te(t[o],t[o+1]),1e-6>Math.abs(n)?a[o]=a[o+1]=0:(e=a[o]/n,r=a[o+1]/n,u=e*e+r*r,u>9&&(u=3*n/Math.sqrt(u),a[o]=u*e,a[o+1]=u*r));for(o=-1;c>=++o;)u=(t[Math.min(c,o+1)][0]-t[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),i.push([u||0,a[o]*u||0]);return i}function ze(t){return 3>t.length?pe(t):t[0]+xe(t,Ce(t))}function De(t){for(var n,e,r,u=-1,i=t.length;i>++u;)n=t[u],e=n[0],r=n[1]+Ra,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function Le(t){function n(n){function o(){m.push("M",l(t(y),g),h,s(t(v.reverse()),g),"Z")}for(var f,p,d,m=[],v=[],y=[],M=-1,b=n.length,x=c(e),_=c(u),w=e===r?function(){return p}:c(r),S=u===i?function(){return d}:c(i);b>++M;)a.call(this,f=n[M],M)?(v.push([p=+x.call(this,f,M),d=+_.call(this,f,M)]),y.push([+w.call(this,f,M),+S.call(this,f,M)])):v.length&&(o(),v=[],y=[]);return v.length&&o(),m.length?m.join(""):null}var e=he,r=he,u=0,i=ge,a=o,l=pe,f=l.key,s=l,h="L",g=.7;return n.x=function(t){return arguments.length?(e=r=t,n):r},n.x0=function(t){return arguments.length?(e=t,n):e},n.x1=function(t){return arguments.length?(r=t,n):r},n.y=function(t){return arguments.length?(u=i=t,n):i},n.y0=function(t){return arguments.length?(u=t,n):u},n.y1=function(t){return arguments.length?(i=t,n):i},n.defined=function(t){return arguments.length?(a=t,n):a},n.interpolate=function(t){return arguments.length?(f="function"==typeof t?l=t:(l=Ya.get(t)||pe).key,s=l.reverse||l,h=l.closed?"M":"L",n):f},n.tension=function(t){return arguments.length?(g=t,n):g},n}function Fe(t){return t.radius}function He(t){return[t.x,t.y]}function je(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]+Ra;return[e*Math.cos(r),e*Math.sin(r)]}}function Pe(){return 64}function Re(){return"circle"}function Oe(t){var n=Math.sqrt(t/Ti);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}function Ye(t,n){t.attr("transform",function(t){return"translate("+n(t)+",0)"})}function Ue(t,n){t.attr("transform",function(t){return"translate(0,"+n(t)+")"})}function Ie(t,n,e){if(r=[],e&&n.length>1){for(var r,u,i,a=Rn(t.domain()),o=-1,c=n.length,l=(n[1]-n[0])/++e;c>++o;)for(u=e;--u>0;)(i=+n[o]-u*l)>=a[0]&&r.push(i);for(--o,u=0;e>++u&&(i=+n[o]+u*l)<a[1];)r.push(i)}return r}function Ve(t){for(var n=t.source,e=t.target,r=Xe(n,e),u=[n];n!==r;)n=n.parent,u.push(n);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function Ze(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Xe(t,n){if(t===n)return t;for(var e=Ze(t),r=Ze(n),u=e.pop(),i=r.pop(),a=null;u===i;)a=u,u=e.pop(),i=r.pop();return a}function Be(t){t.fixed|=2}function $e(t){t.fixed&=-7}function Je(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Ge(t){t.fixed&=-5}function Ke(t,n,e){var r=0,u=0;if(t.charge=0,!t.leaf)for(var i,a=t.nodes,o=a.length,c=-1;o>++c;)i=a[c],null!=i&&(Ke(i,n,e),t.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var l=n*e[t.point.index];t.charge+=t.pointCharge=l,r+=l*t.point.x,u+=l*t.point.y}t.cx=r/t.charge,t.cy=u/t.charge}function We(t){return t.x}function Qe(t){return t.y}function tr(t,n,e){t.y0=n,t.y=e}function nr(t){return Ci.range(t.length)}function er(t){for(var n=-1,e=t[0].length,r=[];e>++n;)r[n]=0;return r}function rr(t){for(var n,e=1,r=0,u=t[0][1],i=t.length;i>e;++e)(n=t[e][1])>u&&(r=e,u=n);return r}function ur(t){return t.reduce(ir,0)}function ir(t,n){return t+n[1]}function ar(t,n){return or(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function or(t,n){for(var e=-1,r=+t[0],u=(t[1]-r)/n,i=[];n>=++e;)i[e]=u*e+r;return i}function cr(t){return[Ci.min(t),Ci.max(t)]}function lr(t,n){return Ci.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=gr,t}function fr(t){return t.children}function sr(t){return t.value}function hr(t,n){return n.value-t.value}function gr(t){return Ci.merge(t.map(function(t){return(t.children||[]).map(function(n){return{source:t,target:n}})}))}function pr(t,n){return t.value-n.value}function dr(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function mr(t,n){t._pack_next=n,n._pack_prev=t}function vr(t,n){var e=n.x-t.x,r=n.y-t.y,u=t.r+n.r;return u*u-e*e-r*r>.001}function yr(t){function n(t){f=Math.min(t.x-t.r,f),s=Math.max(t.x+t.r,s),h=Math.min(t.y-t.r,h),g=Math.max(t.y+t.r,g)}if((e=t.children)&&(l=e.length)){var e,r,u,i,a,o,c,l,f=1/0,s=-1/0,h=1/0,g=-1/0;if(e.forEach(Mr),r=e[0],r.x=-r.r,r.y=0,n(r),l>1&&(u=e[1],u.x=u.r,u.y=0,n(u),l>2))for(i=e[2],_r(r,u,i),n(i),dr(r,i),r._pack_prev=i,dr(i,u),u=r._pack_next,a=3;l>a;a++){_r(r,u,i=e[a]);var p=0,d=1,m=1;for(o=u._pack_next;o!==u;o=o._pack_next,d++)if(vr(o,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==o._pack_prev&&!vr(c,i);c=c._pack_prev,m++);p?(m>d||d==m&&u.r<r.r?mr(r,u=o):mr(r=c,u),a--):(dr(r,i),u=i,n(i))}var v=(f+s)/2,y=(h+g)/2,M=0;for(a=0;l>a;a++)i=e[a],i.x-=v,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));t.r=M,e.forEach(br)}}function Mr(t){t._pack_next=t._pack_prev=t}function br(t){delete t._pack_next,delete t._pack_prev}function xr(t,n,e,r){var u=t.children;if(t.x=n+=r*t.x,t.y=e+=r*t.y,t.r*=r,u)for(var i=-1,a=u.length;a>++i;)xr(u[i],n,e,r)}function _r(t,n,e){var r=t.r+e.r,u=n.x-t.x,i=n.y-t.y;if(r&&(u||i)){var a=n.r+e.r,o=u*u+i*i;a*=a,r*=r;var c=.5+(r-a)/(2*o),l=Math.sqrt(Math.max(0,2*a*(r+o)-(r-=o)*r-a*a))/(2*o);e.x=t.x+c*u+l*i,e.y=t.y+c*i-l*u}else e.x=t.x+r,e.y=t.y}function wr(t){return 1+Ci.max(t,function(t){return t.y})}function Sr(t){return t.reduce(function(t,n){return t+n.x},0)/t.length}function kr(t){var n=t.children;return n&&n.length?kr(n[0]):t}function Er(t){var n,e=t.children;return e&&(n=e.length)?Er(e[n-1]):t}function Ar(t,n){return t.parent==n.parent?1:2}function Nr(t){var n=t.children;return n&&n.length?n[0]:t._tree.thread}function Tr(t){var n,e=t.children;return e&&(n=e.length)?e[n-1]:t._tree.thread}function qr(t,n){var e=t.children;if(e&&(u=e.length))for(var r,u,i=-1;u>++i;)n(r=qr(e[i],n),t)>0&&(t=r);return t}function Cr(t,n){return t.x-n.x}function zr(t,n){return n.x-t.x}function Dr(t,n){return t.depth-n.depth}function Lr(t,n){function e(t,r){var u=t.children;if(u&&(a=u.length))for(var i,a,o=null,c=-1;a>++c;)i=u[c],e(i,o),o=i;n(t,r)}e(t,null)}function Fr(t){for(var n,e=0,r=0,u=t.children,i=u.length;--i>=0;)n=u[i]._tree,n.prelim+=e,n.mod+=e,e+=n.shift+(r+=n.change)}function Hr(t,n,e){t=t._tree,n=n._tree;var r=e/(n.number-t.number);t.change+=r,n.change-=r,n.shift+=e,n.prelim+=e,n.mod+=e}function jr(t,n,e){return t._tree.ancestor.parent==n.parent?t._tree.ancestor:e}function Pr(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Rr(t,n){var e=t.x+n[3],r=t.y+n[0],u=t.dx-n[1]-n[3],i=t.dy-n[0]-n[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Or(t,n){function e(t,e){return Ci.xhr(t,n,e).response(r)}function r(t){return e.parse(t.responseText)}function u(n){return n.map(i).join(t)}function i(t){return a.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var a=RegExp('["'+t+"\n]"),o=t.charCodeAt(0);return e.parse=function(t){var n;return e.parseRows(t,function(t){return n?n(t):(n=Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}"),void 0)})},e.parseRows=function(t,n){function e(){if(f>=l)return a;if(u)return u=!1,i;var n=f;if(34===t.charCodeAt(n)){for(var e=n;l>e++;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}f=e+2;var r=t.charCodeAt(e+1);return 13===r?(u=!0,10===t.charCodeAt(e+2)&&++f):10===r&&(u=!0),t.substring(n+1,e).replace(/""/g,'"')}for(;l>f;){var r=t.charCodeAt(f++),c=1;if(10===r)u=!0;else if(13===r)u=!0,10===t.charCodeAt(f)&&(++f,++c);else if(r!==o)continue;return t.substring(n,f-c)}return t.substring(n)}for(var r,u,i={},a={},c=[],l=t.length,f=0,s=0;(r=e())!==a;){for(var h=[];r!==i&&r!==a;)h.push(r),r=e();(!n||(h=n(h,s++)))&&c.push(h)}return c},e.format=function(t){return t.map(u).join("\n")},e}function Yr(t,n){oo.hasOwnProperty(t.type)&&oo[t.type](t,n)}function Ur(t,n,e){var r,u=-1,i=t.length-e;for(n.lineStart();i>++u;)r=t[u],n.point(r[0],r[1]);n.lineEnd()}function Ir(t,n){var e=-1,r=t.length;for(n.polygonStart();r>++e;)Ur(t[e],n,1);n.polygonEnd()}function Vr(t){return[Math.atan2(t[1],t[0]),Math.asin(Math.max(-1,Math.min(1,t[2])))]}function Zr(t,n){return qi>Math.abs(t[0]-n[0])&&qi>Math.abs(t[1]-n[1])}function Xr(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function Br(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function $r(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Jr(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Gr(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Kr(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Wr(t){function n(n){function r(e,r){e=t(e,r),n.point(e[0],e[1])}function i(){f=0/0,d.point=a,n.lineStart()}function a(r,i){var a=Xr([r,i]),o=t(r,i);e(f,s,l,h,g,p,f=o[0],s=o[1],l=r,h=a[0],g=a[1],p=a[2],u,n),n.point(f,s)}function o(){d.point=r,n.lineEnd()}function c(){var t,r,c,m,v,y,M;i(),d.point=function(n,e){a(t=n,r=e),c=f,m=s,v=h,y=g,M=p,d.point=a},d.lineEnd=function(){e(f,s,l,h,g,p,c,m,t,v,y,M,u,n),d.lineEnd=o,o()}}var l,f,s,h,g,p,d={point:r,lineStart:i,lineEnd:o,polygonStart:function(){n.polygonStart(),d.lineStart=c},polygonEnd:function(){n.polygonEnd(),d.lineStart=i}};return d}function e(n,u,i,a,o,c,l,f,s,h,g,p,d,m){var v=l-n,y=f-u,M=v*v+y*y;if(M>4*r&&d--){var b=a+h,x=o+g,_=c+p,w=Math.sqrt(b*b+x*x+_*_),S=Math.asin(_/=w),k=qi>Math.abs(Math.abs(_)-1)?(i+s)/2:Math.atan2(x,b),E=t(k,S),A=E[0],N=E[1],T=A-n,q=N-u,C=y*T-v*q;(C*C/M>r||Math.abs((v*T+y*q)/M-.5)>.3)&&(e(n,u,i,a,o,c,A,N,k,b/=w,x/=w,_,d,m),m.point(A,N),e(A,N,k,b,x,_,l,f,s,h,g,p,d,m))}}var r=.5,u=16;return n.precision=function(t){return arguments.length?(u=(r=t*t)>0&&16,n):Math.sqrt(r)},n}function Qr(t,n){function e(t,n){var e=Math.sqrt(i-2*u*Math.sin(n))/u;return[e*Math.sin(t*=u),a-e*Math.cos(t)]}var r=Math.sin(t),u=(r+Math.sin(n))/2,i=1+r*(2*u-r),a=Math.sqrt(i)/u;return e.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/u,Math.asin((i-(t*t+e*e)*u*u)/(2*u))]},e}function tu(t){function n(t,n){r>t&&(r=t),t>i&&(i=t),u>n&&(u=n),n>a&&(a=n)}function e(){o.point=o.lineEnd=Pn}var r,u,i,a,o={point:n,lineStart:Pn,lineEnd:Pn,polygonStart:function(){o.lineEnd=e},polygonEnd:function(){o.point=n}};return function(n){return a=i=-(r=u=1/0),Ci.geo.stream(n,t(o)),[[r,u],[i,a]]}}function nu(t,n){if(!fo){++so,t*=zi;var e=Math.cos(n*=zi);ho+=(e*Math.cos(t)-ho)/so,go+=(e*Math.sin(t)-go)/so,po+=(Math.sin(n)-po)/so}}function eu(){var t,n;fo=1,ru(),fo=2;var e=mo.point;mo.point=function(r,u){e(t=r,n=u)},mo.lineEnd=function(){mo.point(t,n),uu(),mo.lineEnd=uu}}function ru(){function t(t,u){t*=zi;var i=Math.cos(u*=zi),a=i*Math.cos(t),o=i*Math.sin(t),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=e*c-r*o)*l+(l=r*a-n*c)*l+(l=n*o-e*a)*l),n*a+e*o+r*c);so+=l,ho+=l*(n+(n=a)),go+=l*(e+(e=o)),po+=l*(r+(r=c))}var n,e,r;fo>1||(1>fo&&(fo=1,so=ho=go=po=0),mo.point=function(u,i){u*=zi;var a=Math.cos(i*=zi);n=a*Math.cos(u),e=a*Math.sin(u),r=Math.sin(i),mo.point=t})}function uu(){mo.point=nu}function iu(t,n){var e=Math.cos(t),r=Math.sin(t);return function(u,i,a,o){null!=u?(u=au(e,u),i=au(e,i),(a>0?i>u:u>i)&&(u+=2*a*Ti)):(u=t+2*a*Ti,i=t);for(var c,l=a*n,f=u;a>0?f>i:i>f;f-=l)o.point((c=Vr([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function au(t,n){var e=Xr(n);e[0]-=t,Kr(e);var r=Math.acos(Math.max(-1,Math.min(1,-e[1])));return((0>-e[2]?-r:r)+2*Math.PI-qi)%(2*Math.PI)}function ou(t,n,e){return function(r){function u(n,e){t(n,e)&&r.point(n,e)}function i(t,n){m.point(t,n)}function a(){v.point=i,m.lineStart()}function o(){v.point=u,m.lineEnd()}function c(t,n){M.point(t,n),d.push([t,n])}function l(){M.lineStart(),d=[]}function f(){c(d[0][0],d[0][1]),M.lineEnd();var t,n=M.clean(),e=y.buffer(),u=e.length;if(!u)return p=!0,g+=gu(d,-1),d=null,void 0;if(d=null,1&n){t=e[0],h+=gu(t,1);var i,u=t.length-1,a=-1;for(r.lineStart();u>++a;)r.point((i=t[a])[0],i[1]);return r.lineEnd(),void 0}u>1&&2&n&&e.push(e.pop().concat(e.shift())),s.push(e.filter(su))}var s,h,g,p,d,m=n(r),v={point:u,lineStart:a,lineEnd:o,polygonStart:function(){v.point=c,v.lineStart=l,v.lineEnd=f,p=!1,g=h=0,s=[],r.polygonStart()},polygonEnd:function(){v.point=u,v.lineStart=a,v.lineEnd=o,s=Ci.merge(s),s.length?cu(s,e,r):(-qi>h||p&&-qi>g)&&(r.lineStart(),e(null,null,1,r),r.lineEnd()),r.polygonEnd(),s=null},sphere:function(){r.polygonStart(),r.lineStart(),e(null,null,1,r),r.lineEnd(),r.polygonEnd()}},y=hu(),M=n(y);return v}}function cu(t,n,e){var r=[],u=[];if(t.forEach(function(t){if(!(1>=(n=t.length))){var n,i=t[0],a=t[n-1];if(Zr(i,a)){e.lineStart();
+for(var o=0;n>o;++o)e.point((i=t[o])[0],i[1]);return e.lineEnd(),void 0}var c={point:i,points:t,other:null,visited:!1,entry:!0,subject:!0},l={point:i,points:[i],other:c,visited:!1,entry:!1,subject:!1};c.other=l,r.push(c),u.push(l),c={point:a,points:[a],other:null,visited:!1,entry:!1,subject:!0},l={point:a,points:[a],other:c,visited:!1,entry:!0,subject:!1},c.other=l,r.push(c),u.push(l)}}),u.sort(fu),lu(r),lu(u),r.length)for(var i,a,o,c=r[0];;){for(i=c;i.visited;)if((i=i.next)===c)return;a=i.points,e.lineStart();do{if(i.visited=i.other.visited=!0,i.entry){if(i.subject)for(var l=0;a.length>l;l++)e.point((o=a[l])[0],o[1]);else n(i.point,i.next.point,1,e);i=i.next}else{if(i.subject){a=i.prev.points;for(var l=a.length;--l>=0;)e.point((o=a[l])[0],o[1])}else n(i.point,i.prev.point,-1,e);i=i.prev}i=i.other,a=i.points}while(!i.visited);e.lineEnd()}}function lu(t){if(n=t.length){for(var n,e,r=0,u=t[0];n>++r;)u.next=e=t[r],e.prev=u,u=e;u.next=e=t[0],e.prev=u}}function fu(t,n){return(0>(t=t.point)[0]?t[1]-Ti/2-qi:Ti/2-t[1])-(0>(n=n.point)[0]?n[1]-Ti/2-qi:Ti/2-n[1])}function su(t){return t.length>1}function hu(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:Pn,buffer:function(){var e=n;return n=[],t=null,e}}}function gu(t,n){if(!(e=t.length))return 0;for(var e,r,u,i=0,a=0,o=t[0],c=o[0],l=o[1],f=Math.cos(l),s=Math.atan2(n*Math.sin(c)*f,Math.sin(l)),h=1-n*Math.cos(c)*f,g=s;e>++i;)o=t[i],f=Math.cos(l=o[1]),r=Math.atan2(n*Math.sin(c=o[0])*f,Math.sin(l)),u=1-n*Math.cos(c)*f,qi>Math.abs(h-2)&&qi>Math.abs(u-2)||(qi>Math.abs(u)||qi>Math.abs(h)||(qi>Math.abs(Math.abs(r-s)-Ti)?u+h>2&&(a+=4*(r-s)):a+=qi>Math.abs(h-2)?4*(r-g):((3*Ti+r-s)%(2*Ti)-Ti)*(h+u)),g=s,s=r,h=u);return a}function pu(t){var n,e=0/0,r=0/0,u=0/0;return{lineStart:function(){t.lineStart(),n=1},point:function(i,a){var o=i>0?Ti:-Ti,c=Math.abs(i-e);qi>Math.abs(c-Ti)?(t.point(e,r=(r+a)/2>0?Ti/2:-Ti/2),t.point(u,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(i,r),n=0):u!==o&&c>=Ti&&(qi>Math.abs(e-u)&&(e-=u*qi),qi>Math.abs(i-o)&&(i-=o*qi),r=du(e,r,i,a),t.point(u,r),t.lineEnd(),t.lineStart(),t.point(o,r),n=0),t.point(e=i,r=a),u=o},lineEnd:function(){t.lineEnd(),e=r=0/0},clean:function(){return 2-n}}}function du(t,n,e,r){var u,i,a=Math.sin(t-e);return Math.abs(a)>qi?Math.atan((Math.sin(n)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(n))*Math.sin(t))/(u*i*a)):(n+r)/2}function mu(t,n,e,r){var u;if(null==t)u=e*Ti/2,r.point(-Ti,u),r.point(0,u),r.point(Ti,u),r.point(Ti,0),r.point(Ti,-u),r.point(0,-u),r.point(-Ti,-u),r.point(-Ti,0),r.point(-Ti,u);else if(Math.abs(t[0]-n[0])>qi){var i=(t[0]<n[0]?1:-1)*Ti;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(n[0],n[1])}function vu(t){function n(t,n){return Math.cos(t)*Math.cos(n)>i}function e(t){var e,u,i,a;return{lineStart:function(){i=u=!1,a=1},point:function(o,c){var l,f=[o,c],s=n(o,c);!e&&(i=u=s)&&t.lineStart(),s!==u&&(l=r(e,f),(Zr(e,l)||Zr(f,l))&&(f[0]+=qi,f[1]+=qi,s=n(f[0],f[1]))),s!==u&&(a=0,(u=s)?(t.lineStart(),l=r(f,e),t.point(l[0],l[1])):(l=r(e,f),t.point(l[0],l[1]),t.lineEnd()),e=l),!s||e&&Zr(e,f)||t.point(f[0],f[1]),e=f},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return a|(i&&u)<<1}}}function r(t,n){var e=Xr(t,0),r=Xr(n,0),u=[1,0,0],a=$r(e,r),o=Br(a,a),c=a[0],l=o-c*c;if(!l)return t;var f=i*o/l,s=-i*c/l,h=$r(u,a),g=Gr(u,f),p=Gr(a,s);Jr(g,p);var d=h,m=Br(g,d),v=Br(d,d),y=Math.sqrt(m*m-v*(Br(g,g)-1)),M=Gr(d,(-m-y)/v);return Jr(M,g),Vr(M)}var u=t*zi,i=Math.cos(u),a=iu(u,6*zi);return ou(n,e,a)}function yu(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return e=n.invert(e,r),e&&t.invert(e[0],e[1])}),e}function Mu(t,n){return[t,n]}function bu(t,n,e){var r=Ci.range(t,n-qi,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function xu(t,n,e){var r=Ci.range(t,n-qi,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function _u(t){return(t=Math.sin(t/2))*t}function wu(t,n,e,r){var u=Math.cos(n),i=Math.sin(n),a=Math.cos(r),o=Math.sin(r),c=u*Math.cos(t),l=u*Math.sin(t),f=a*Math.cos(e),s=a*Math.sin(e),h=2*Math.asin(Math.sqrt(_u(r-n)+u*a*_u(e-t))),g=1/Math.sin(h),p=h?function(t){var n=Math.sin(t*=h)*g,e=Math.sin(h-t)*g,r=e*c+n*f,u=e*l+n*s,a=e*i+n*o;return[Math.atan2(u,r)*Di,Math.atan2(a,Math.sqrt(r*r+u*u))*Di]}:function(){return[t*Di,n*Di]};return p.distance=h,p}function Su(t,n){return[t/(2*Ti),Math.max(-.5,Math.min(.5,Math.log(Math.tan(Ti/4+n/2))/(2*Ti)))]}function ku(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Eu(t){var n=Wr(function(n,e){return t([n*Di,e*Di])});return function(t){return t=n(t),{point:function(n,e){t.point(n*zi,e*zi)},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}}function Au(){function t(t,n){a.push("M",t,",",n,i)}function n(t,n){a.push("M",t,",",n),o.point=e}function e(t,n){a.push("L",t,",",n)}function r(){o.point=t}function u(){a.push("Z")}var i=ku(4.5),a=[],o={point:t,lineStart:function(){o.point=n},lineEnd:r,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=r,o.point=t},pointRadius:function(t){return i=ku(t),o},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return o}function Nu(t){function n(n,e){t.moveTo(n,e),t.arc(n,e,a,0,2*Ti)}function e(n,e){t.moveTo(n,e),o.point=r}function r(n,e){t.lineTo(n,e)}function u(){o.point=n}function i(){t.closePath()}var a=4.5,o={point:n,lineStart:function(){o.point=e},lineEnd:u,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=u,o.point=n},pointRadius:function(t){return a=t,o},result:Pn};return o}function Tu(){function t(t,n){xo+=u*t-r*n,r=t,u=n}var n,e,r,u;_o.point=function(i,a){_o.point=t,n=r=i,e=u=a},_o.lineEnd=function(){t(n,e)}}function qu(t,n){fo||(ho+=t,go+=n,++po)}function Cu(){function t(t,r){var u=t-n,i=r-e,a=Math.sqrt(u*u+i*i);ho+=a*(n+t)/2,go+=a*(e+r)/2,po+=a,n=t,e=r}var n,e;if(1!==fo){if(!(1>fo))return;fo=1,ho=go=po=0}wo.point=function(r,u){wo.point=t,n=r,e=u}}function zu(){wo.point=qu}function Du(){function t(t,n){var e=u*t-r*n;ho+=e*(r+t),go+=e*(u+n),po+=3*e,r=t,u=n}var n,e,r,u;2>fo&&(fo=2,ho=go=po=0),wo.point=function(i,a){wo.point=t,n=r=i,e=u=a},wo.lineEnd=function(){t(n,e)}}function Lu(){function t(t,n){t*=zi,n=n*zi/2+Ti/4;var e=t-r,a=Math.cos(n),o=Math.sin(n),c=i*o,l=ko,f=Eo,s=u*a+c*Math.cos(e),h=c*Math.sin(e);ko=l*s-f*h,Eo=f*s+l*h,r=t,u=a,i=o}var n,e,r,u,i;Ao.point=function(a,o){Ao.point=t,r=(n=a)*zi,u=Math.cos(o=(e=o)*zi/2+Ti/4),i=Math.sin(o)},Ao.lineEnd=function(){t(n,e)}}function Fu(t){return Hu(function(){return t})()}function Hu(t){function n(t){return t=a(t[0]*zi,t[1]*zi),[t[0]*f+o,c-t[1]*f]}function e(t){return t=a.invert((t[0]-o)/f,(c-t[1])/f),t&&[t[0]*Di,t[1]*Di]}function r(){a=yu(i=Pu(d,m,v),u);var t=u(g,p);return o=s-t[0]*f,c=h+t[1]*f,n}var u,i,a,o,c,l=Wr(function(t,n){return t=u(t,n),[t[0]*f+o,c-t[1]*f]}),f=150,s=480,h=250,g=0,p=0,d=0,m=0,v=0,y=vo,M=null;return n.stream=function(t){return ju(i,y(l(t)))},n.clipAngle=function(t){return arguments.length?(y=null==t?(M=t,vo):vu(M=+t),n):M},n.scale=function(t){return arguments.length?(f=+t,r()):f},n.translate=function(t){return arguments.length?(s=+t[0],h=+t[1],r()):[s,h]},n.center=function(t){return arguments.length?(g=t[0]%360*zi,p=t[1]%360*zi,r()):[g*Di,p*Di]},n.rotate=function(t){return arguments.length?(d=t[0]%360*zi,m=t[1]%360*zi,v=t.length>2?t[2]%360*zi:0,r()):[d*Di,m*Di,v*Di]},Ci.rebind(n,l,"precision"),function(){return u=t.apply(this,arguments),n.invert=u.invert&&e,r()}}function ju(t,n){return{point:function(e,r){r=t(e*zi,r*zi),e=r[0],n.point(e>Ti?e-2*Ti:-Ti>e?e+2*Ti:e,r[1])},sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function Pu(t,n,e){return t?n||e?yu(Ou(t),Yu(n,e)):Ou(t):n||e?Yu(n,e):Mu}function Ru(t){return function(n,e){return n+=t,[n>Ti?n-2*Ti:-Ti>n?n+2*Ti:n,e]}}function Ou(t){var n=Ru(t);return n.invert=Ru(-t),n}function Yu(t,n){function e(t,n){var e=Math.cos(n),o=Math.cos(t)*e,c=Math.sin(t)*e,l=Math.sin(n),f=l*r+o*u;return[Math.atan2(c*i-f*a,o*r-l*u),Math.asin(Math.max(-1,Math.min(1,f*i+c*a)))]}var r=Math.cos(t),u=Math.sin(t),i=Math.cos(n),a=Math.sin(n);return e.invert=function(t,n){var e=Math.cos(n),o=Math.cos(t)*e,c=Math.sin(t)*e,l=Math.sin(n),f=l*i-c*a;return[Math.atan2(c*i+l*a,o*r+f*u),Math.asin(Math.max(-1,Math.min(1,f*r-o*u)))]},e}function Uu(t,n){function e(n,e){var r=Math.cos(n),u=Math.cos(e),i=t(r*u);return[i*u*Math.sin(n),i*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),u=n(r),i=Math.sin(u),a=Math.cos(u);return[Math.atan2(t*i,r*a),Math.asin(r&&e*i/r)]},e}function Iu(t,n,e,r){var u,i,a,o,c,l,f;return u=r[t],i=u[0],a=u[1],u=r[n],o=u[0],c=u[1],u=r[e],l=u[0],f=u[1],(f-a)*(o-i)-(c-a)*(l-i)>0}function Vu(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function Zu(t,n,e,r){var u=t[0],i=e[0],a=n[0]-u,o=r[0]-i,c=t[1],l=e[1],f=n[1]-c,s=r[1]-l,h=(o*(c-l)-s*(u-i))/(s*a-o*f);return[u+h*a,c+h*f]}function Xu(t,n){var e={list:t.map(function(t,n){return{index:n,x:t[0],y:t[1]}}).sort(function(t,n){return t.y<n.y?-1:t.y>n.y?1:t.x<n.x?-1:t.x>n.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(t,n){return{edge:t,side:n,vertex:null,l:null,r:null}},insert:function(t,n){n.l=t,n.r=t.r,t.r.l=n,t.r=n},leftBound:function(t){var n=r.leftEnd;do n=n.r;while(n!=r.rightEnd&&u.rightOf(n,t));return n=n.l},del:function(t){t.l.r=t.r,t.r.l=t.l,t.edge=null},right:function(t){return t.r},left:function(t){return t.l},leftRegion:function(t){return null==t.edge?e.bottomSite:t.edge.region[t.side]},rightRegion:function(t){return null==t.edge?e.bottomSite:t.edge.region[To[t.side]]}},u={bisect:function(t,n){var e={region:{l:t,r:n},ep:{l:null,r:null}},r=n.x-t.x,u=n.y-t.y,i=r>0?r:-r,a=u>0?u:-u;return e.c=t.x*r+t.y*u+.5*(r*r+u*u),i>a?(e.a=1,e.b=u/r,e.c/=r):(e.b=1,e.a=r/u,e.c/=u),e},intersect:function(t,n){var e=t.edge,r=n.edge;if(!e||!r||e.region.r==r.region.r)return null;var u=e.a*r.b-e.b*r.a;if(1e-10>Math.abs(u))return null;var i,a,o=(e.c*r.b-r.c*e.b)/u,c=(r.c*e.a-e.c*r.a)/u,l=e.region.r,f=r.region.r;l.y<f.y||l.y==f.y&&l.x<f.x?(i=t,a=e):(i=n,a=r);var s=o>=a.region.r.x;return s&&"l"===i.side||!s&&"r"===i.side?null:{x:o,y:c}},rightOf:function(t,n){var e=t.edge,r=e.region.r,u=n.x>r.x;if(u&&"l"===t.side)return 1;if(!u&&"r"===t.side)return 0;if(1===e.a){var i=n.y-r.y,a=n.x-r.x,o=0,c=0;if(!u&&0>e.b||u&&e.b>=0?c=o=i>=e.b*a:(c=n.x+n.y*e.b>e.c,0>e.b&&(c=!c),c||(o=1)),!o){var l=r.x-e.region.l.x;c=e.b*(a*a-i*i)<l*i*(1+2*a/l+e.b*e.b),0>e.b&&(c=!c)}}else{var f=e.c-e.a*n.x,s=n.y-f,h=n.x-r.x,g=f-r.y;c=s*s>h*h+g*g}return"l"===t.side?c:!c},endPoint:function(t,e,r){t.ep[e]=r,t.ep[To[e]]&&n(t)},distance:function(t,n){var e=t.x-n.x,r=t.y-n.y;return Math.sqrt(e*e+r*r)}},i={list:[],insert:function(t,n,e){t.vertex=n,t.ystar=n.y+e;for(var r=0,u=i.list,a=u.length;a>r;r++){var o=u[r];if(!(t.ystar>o.ystar||t.ystar==o.ystar&&n.x>o.vertex.x))break}u.splice(r,0,t)},del:function(t){for(var n=0,e=i.list,r=e.length;r>n&&e[n]!=t;++n);e.splice(n,1)},empty:function(){return 0===i.list.length},nextEvent:function(t){for(var n=0,e=i.list,r=e.length;r>n;++n)if(e[n]==t)return e[n+1];return null},min:function(){var t=i.list[0];return{x:t.vertex.x,y:t.ystar}},extractMin:function(){return i.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var a,o,c,l,f,s,h,g,p,d,m,v,y,M=e.list.shift();;)if(i.empty()||(a=i.min()),M&&(i.empty()||M.y<a.y||M.y==a.y&&M.x<a.x))o=r.leftBound(M),c=r.right(o),h=r.rightRegion(o),v=u.bisect(h,M),s=r.createHalfEdge(v,"l"),r.insert(o,s),d=u.intersect(o,s),d&&(i.del(o),i.insert(o,d,u.distance(d,M))),o=s,s=r.createHalfEdge(v,"r"),r.insert(o,s),d=u.intersect(s,c),d&&i.insert(s,d,u.distance(d,M)),M=e.list.shift();else{if(i.empty())break;o=i.extractMin(),l=r.left(o),c=r.right(o),f=r.right(c),h=r.leftRegion(o),g=r.rightRegion(c),m=o.vertex,u.endPoint(o.edge,o.side,m),u.endPoint(c.edge,c.side,m),r.del(o),i.del(c),r.del(c),y="l",h.y>g.y&&(p=h,h=g,g=p,y="r"),v=u.bisect(h,g),s=r.createHalfEdge(v,y),r.insert(l,s),u.endPoint(v,To[y],m),d=u.intersect(l,s),d&&(i.del(l),i.insert(l,d,u.distance(d,h))),d=u.intersect(s,f),d&&i.insert(s,d,u.distance(d,h))}for(o=r.right(r.leftEnd);o!=r.rightEnd;o=r.right(o))n(o.edge)}function Bu(){return{leaf:!0,nodes:[],point:null}}function $u(t,n,e,r,u,i){if(!t(n,e,r,u,i)){var a=.5*(e+u),o=.5*(r+i),c=n.nodes;c[0]&&$u(t,c[0],e,r,a,o),c[1]&&$u(t,c[1],a,r,u,o),c[2]&&$u(t,c[2],e,o,a,i),c[3]&&$u(t,c[3],a,o,u,i)}}function Ju(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Gu(t,n,e,r){for(var u,i,a=0,o=n.length,c=e.length;o>a;){if(r>=c)return-1;if(u=n.charCodeAt(a++),37===u){if(i=$o[n.charAt(a++)],!i||0>(r=i(t,e,r)))return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function Ku(t){return RegExp("^(?:"+t.map(Ci.requote).join("|")+")","i")}function Wu(t){for(var n=new i,e=-1,r=t.length;r>++e;)n.set(t[e].toLowerCase(),e);return n}function Qu(t,n,e){t+="";var r=t.length;return e>r?Array(e-r+1).join(n)+t:t}function ti(t,n,e){Yo.lastIndex=0;var r=Yo.exec(n.substring(e));return r?e+=r[0].length:-1}function ni(t,n,e){Oo.lastIndex=0;var r=Oo.exec(n.substring(e));return r?e+=r[0].length:-1}function ei(t,n,e){Vo.lastIndex=0;var r=Vo.exec(n.substring(e));return r?(t.m=Zo.get(r[0].toLowerCase()),e+=r[0].length):-1}function ri(t,n,e){Uo.lastIndex=0;var r=Uo.exec(n.substring(e));return r?(t.m=Io.get(r[0].toLowerCase()),e+=r[0].length):-1}function ui(t,n,e){return Gu(t,""+Bo.c,n,e)}function ii(t,n,e){return Gu(t,""+Bo.x,n,e)}function ai(t,n,e){return Gu(t,""+Bo.X,n,e)}function oi(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+4));return r?(t.y=+r[0],e+=r[0].length):-1}function ci(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.y=li(+r[0]),e+=r[0].length):-1}function li(t){return t+(t>68?1900:2e3)}function fi(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.m=r[0]-1,e+=r[0].length):-1}function si(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.d=+r[0],e+=r[0].length):-1}function hi(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.H=+r[0],e+=r[0].length):-1}function gi(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.M=+r[0],e+=r[0].length):-1}function pi(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+2));return r?(t.S=+r[0],e+=r[0].length):-1}function di(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e,e+3));return r?(t.L=+r[0],e+=r[0].length):-1}function mi(t,n,e){var r=Go.get(n.substring(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)}function vi(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=~~(Math.abs(n)/60),u=Math.abs(n)%60;return e+Qu(r,"0",2)+Qu(u,"0",2)}function yi(t){return t.toISOString()}function Mi(t,n,e){function r(n){var e=t(n),r=i(e,1);return r-n>n-e?e:r}function u(e){return n(e=t(new qo(e-1)),1),e}function i(t,e){return n(t=new qo(+t),e),t}function a(t,r,i){var a=u(t),o=[];if(i>1)for(;r>a;)e(a)%i||o.push(new Date(+a)),n(a,1);else for(;r>a;)o.push(new Date(+a)),n(a,1);return o}function o(t,n,e){try{qo=Ju;var r=new Ju;return r._=t,a(r,n,e)}finally{qo=Date}}t.floor=t,t.round=r,t.ceil=u,t.offset=i,t.range=a;var c=t.utc=bi(t);return c.floor=c,c.round=bi(r),c.ceil=bi(u),c.offset=bi(i),c.range=o,t}function bi(t){return function(n,e){try{qo=Ju;var r=new Ju;return r._=n,t(r,e)._}finally{qo=Date}}}function xi(t,n,e){function r(n){return t(n)}return r.invert=function(n){return wi(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(wi)},r.nice=function(t){return r.domain(Yn(r.domain(),function(){return t}))},r.ticks=function(e,u){var i=_i(r.domain());if("function"!=typeof e){var a=i[1]-i[0],o=a/e,c=Ci.bisect(Wo,o);if(c==Wo.length)return n.year(i,e);if(!c)return t.ticks(e).map(wi);Math.log(o/Wo[c-1])<Math.log(Wo[c]/o)&&--c,e=n[c],u=e[1],e=e[0].range}return e(i[0],new Date(+i[1]+1),u)},r.tickFormat=function(){return e},r.copy=function(){return xi(t.copy(),n,e)},Ci.rebind(r,t,"range","rangeRound","interpolate","clamp")}function _i(t){var n=t[0],e=t[t.length-1];return e>n?[n,e]:[e,n]}function wi(t){return new Date(t)}function Si(t){return function(n){for(var e=t.length-1,r=t[e];!r[1](n);)r=t[--e];return r[0](n)}}function ki(t){var n=new Date(t,0,1);return n.setFullYear(t),n}function Ei(t){var n=t.getFullYear(),e=ki(n),r=ki(n+1);return n+(t-e)/(r-e)}function Ai(t){var n=new Date(Date.UTC(t,0,1));return n.setUTCFullYear(t),n}function Ni(t){var n=t.getUTCFullYear(),e=Ai(n),r=Ai(n+1);return n+(t-e)/(r-e)}var Ti=Math.PI,qi=1e-6,Ci={version:"3.0.8"},zi=Ti/180,Di=180/Ti,Li=document,Fi=window,Hi=".",ji=",",Pi=[3,3];Date.now||(Date.now=function(){return+new Date});try{Li.createElement("div").style.setProperty("opacity",0,"")}catch(Ri){var Oi=Fi.CSSStyleDeclaration.prototype,Yi=Oi.setProperty;Oi.setProperty=function(t,n,e){Yi.call(this,t,n+"",e)}}var Ui=u;try{Ui(Li.documentElement.childNodes)[0].nodeType}catch(Ii){Ui=r}var Vi=[].__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};Ci.map=function(t){var n=new i;for(var e in t)n.set(e,t[e]);return n},e(i,{has:function(t){return Zi+t in this},get:function(t){return this[Zi+t]},set:function(t,n){return this[Zi+t]=n},remove:function(t){return t=Zi+t,t in this&&delete this[t]},keys:function(){var t=[];return this.forEach(function(n){t.push(n)}),t},values:function(){var t=[];return this.forEach(function(n,e){t.push(e)}),t},entries:function(){var t=[];return this.forEach(function(n,e){t.push({key:n,value:e})}),t},forEach:function(t){for(var n in this)n.charCodeAt(0)===Xi&&t.call(this,n.substring(1),this[n])}});var Zi="\0",Xi=Zi.charCodeAt(0);Ci.functor=c,Ci.rebind=function(t,n){for(var e,r=1,u=arguments.length;u>++r;)t[e=arguments[r]]=l(t,n,n[e]);return t},Ci.ascending=function(t,n){return n>t?-1:t>n?1:t>=n?0:0/0},Ci.descending=function(t,n){return t>n?-1:n>t?1:n>=t?0:0/0},Ci.mean=function(t,n){var e,r=t.length,u=0,i=-1,a=0;if(1===arguments.length)for(;r>++i;)f(e=t[i])&&(u+=(e-u)/++a);else for(;r>++i;)f(e=n.call(t,t[i],i))&&(u+=(e-u)/++a);return a?u:void 0},Ci.median=function(t,n){return arguments.length>1&&(t=t.map(n)),t=t.filter(f),t.length?Ci.quantile(t.sort(Ci.ascending),.5):void 0},Ci.min=function(t,n){var e,r,u=-1,i=t.length;if(1===arguments.length){for(;i>++u&&(null==(e=t[u])||e!=e);)e=void 0;for(;i>++u;)null!=(r=t[u])&&e>r&&(e=r)}else{for(;i>++u&&(null==(e=n.call(t,t[u],u))||e!=e);)e=void 0;for(;i>++u;)null!=(r=n.call(t,t[u],u))&&e>r&&(e=r)}return e},Ci.max=function(t,n){var e,r,u=-1,i=t.length;if(1===arguments.length){for(;i>++u&&(null==(e=t[u])||e!=e);)e=void 0;for(;i>++u;)null!=(r=t[u])&&r>e&&(e=r)}else{for(;i>++u&&(null==(e=n.call(t,t[u],u))||e!=e);)e=void 0;for(;i>++u;)null!=(r=n.call(t,t[u],u))&&r>e&&(e=r)}return e},Ci.extent=function(t,n){var e,r,u,i=-1,a=t.length;if(1===arguments.length){for(;a>++i&&(null==(e=u=t[i])||e!=e);)e=u=void 0;for(;a>++i;)null!=(r=t[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;a>++i&&(null==(e=u=n.call(t,t[i],i))||e!=e);)e=void 0;for(;a>++i;)null!=(r=n.call(t,t[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},Ci.random={normal:function(t,n){var e=arguments.length;return 2>e&&(n=1),1>e&&(t=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return t+n*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var t=Ci.random.normal.apply(Ci,arguments);return function(){return Math.exp(t())}},irwinHall:function(t){return function(){for(var n=0,e=0;t>e;e++)n+=Math.random();return n/t}}},Ci.sum=function(t,n){var e,r=0,u=t.length,i=-1;if(1===arguments.length)for(;u>++i;)isNaN(e=+t[i])||(r+=e);else for(;u>++i;)isNaN(e=+n.call(t,t[i],i))||(r+=e);return r},Ci.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),u=+t[r-1],i=e-r;return i?u+i*(t[r]-u):u},Ci.shuffle=function(t){for(var n,e,r=t.length;r;)e=0|Math.random()*r--,n=t[r],t[r]=t[e],t[e]=n;return t},Ci.transpose=function(t){return Ci.zip.apply(Ci,t)},Ci.zip=function(){if(!(r=arguments.length))return[];for(var t=-1,n=Ci.min(arguments,s),e=Array(n);n>++t;)for(var r,u=-1,i=e[t]=Array(r);r>++u;)i[u]=arguments[u][t];return e},Ci.bisector=function(t){return{left:function(n,e,r,u){for(3>arguments.length&&(r=0),4>arguments.length&&(u=n.length);u>r;){var i=r+u>>>1;e>t.call(n,n[i],i)?r=i+1:u=i}return r},right:function(n,e,r,u){for(3>arguments.length&&(r=0),4>arguments.length&&(u=n.length);u>r;){var i=r+u>>>1;t.call(n,n[i],i)>e?u=i:r=i+1}return r}}};var Bi=Ci.bisector(function(t){return t});Ci.bisectLeft=Bi.left,Ci.bisect=Ci.bisectRight=Bi.right,Ci.nest=function(){function t(n,o){if(o>=a.length)return r?r.call(u,n):e?n.sort(e):n;for(var c,l,f,s=-1,h=n.length,g=a[o++],p=new i,d={};h>++s;)(f=p.get(c=g(l=n[s])))?f.push(l):p.set(c,[l]);return p.forEach(function(n,e){d[n]=t(e,o)}),d}function n(t,e){if(e>=a.length)return t;var r,u=[],i=o[e++];for(r in t)u.push({key:r,values:n(t[r],e)});return i&&u.sort(function(t,n){return i(t.key,n.key)}),u}var e,r,u={},a=[],o=[];return u.map=function(n){return t(n,0)},u.entries=function(e){return n(t(e,0),0)},u.key=function(t){return a.push(t),u},u.sortKeys=function(t){return o[a.length-1]=t,u},u.sortValues=function(t){return e=t,u},u.rollup=function(t){return r=t,u},u},Ci.keys=function(t){var n=[];for(var e in t)n.push(e);return n},Ci.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},Ci.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},Ci.permute=function(t,n){for(var e=[],r=-1,u=n.length;u>++r;)e[r]=t[n[r]];return e},Ci.merge=function(t){return Array.prototype.concat.apply([],t)},Ci.range=function(t,n,e){if(3>arguments.length&&(e=1,2>arguments.length&&(n=t,t=0)),1/0===(n-t)/e)throw Error("infinite range");var r,u=[],i=g(Math.abs(e)),a=-1;if(t*=i,n*=i,e*=i,0>e)for(;(r=t+e*++a)>n;)u.push(r/i);else for(;n>(r=t+e*++a);)u.push(r/i);return u},Ci.requote=function(t){return t.replace($i,"\\$&")};var $i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Ci.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)},Ci.xhr=function(t,n,e){function r(){var t=l.status;!t&&l.responseText||t>=200&&300>t||304===t?i.load.call(u,c.call(u,l)):i.error.call(u,l)}var u={},i=Ci.dispatch("progress","load","error"),o={},c=a,l=new(Fi.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);return"onload"in l?l.onload=l.onerror=r:l.onreadystatechange=function(){l.readyState>3&&r()},l.onprogress=function(t){var n=Ci.event;Ci.event=t;try{i.progress.call(u,l)}finally{Ci.event=n}},u.header=function(t,n){return t=(t+"").toLowerCase(),2>arguments.length?o[t]:(null==n?delete o[t]:o[t]=n+"",u)},u.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",u):n},u.response=function(t){return c=t,u},["get","post"].forEach(function(t){u[t]=function(){return u.send.apply(u,[t].concat(Ui(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(e,t,!0),null==n||"accept"in o||(o.accept=n+",*/*"),l.setRequestHeader)for(var a in o)l.setRequestHeader(a,o[a]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=i&&u.on("error",i).on("load",function(t){i(null,t)}),l.send(null==r?null:r),u},u.abort=function(){return l.abort(),u},Ci.rebind(u,i,"on"),2===arguments.length&&"function"==typeof n&&(e=n,n=null),null==e?u:u.get(p(e))},Ci.text=function(){return Ci.xhr.apply(Ci,arguments).response(d)},Ci.json=function(t,n){return Ci.xhr(t,"application/json",n).response(m)},Ci.html=function(t,n){return Ci.xhr(t,"text/html",n).response(v)},Ci.xml=function(){return Ci.xhr.apply(Ci,arguments).response(y)};var Ji={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Ci.ns={prefix:Ji,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&(e=t.substring(0,n),t=t.substring(n+1)),Ji.hasOwnProperty(e)?{space:Ji[e],local:t}:t}},Ci.dispatch=function(){for(var t=new M,n=-1,e=arguments.length;e>++n;)t[arguments[n]]=b(t);return t},M.prototype.on=function(t,n){var e=t.indexOf("."),r="";return e>0&&(r=t.substring(e+1),t=t.substring(0,e)),2>arguments.length?this[t].on(r):this[t].on(r,n)},Ci.format=function(t){var n=Gi.exec(t),e=n[1]||" ",r=n[2]||">",u=n[3]||"",i=n[4]||"",a=n[5],o=+n[6],c=n[7],l=n[8],f=n[9],s=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(a||"0"===e&&"="===r)&&(a=e="0",r="=",c&&(o-=Math.floor((o-1)/4))),f){case"n":c=!0,f="g";break;case"%":s=100,h="%",f="f";break;case"p":s=100,h="%",f="r";break;case"b":case"o":case"x":case"X":i&&(i="0"+f.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":s=-1,f="r"}"#"===i&&(i=""),"r"!=f||l||(f="g"),f=Ki.get(f)||_;var p=a&&c;return function(t){if(g&&t%1)return"";var n=0>t||0===t&&0>1/t?(t=-t,"-"):u;if(0>s){var d=Ci.formatPrefix(t,l);t=d.scale(t),h=d.symbol}else t*=s;t=f(t,l),!a&&c&&(t=Wi(t));var m=i.length+t.length+(p?0:n.length),v=o>m?Array(m=o-m+1).join(e):"";return p&&(t=Wi(v+t)),Hi&&t.replace(".",Hi),n+=i,("<"===r?n+t+v:">"===r?v+n+t:"^"===r?v.substring(0,m>>=1)+n+t+v.substring(m):n+(p?t:v+t))+h}};var Gi=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,Ki=Ci.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=Ci.round(t,x(t,n))).toFixed(Math.max(0,Math.min(20,x(t*(1+1e-15),n))))}}),Wi=a;if(Pi){var Qi=Pi.length;Wi=function(t){for(var n=t.lastIndexOf("."),e=n>=0?"."+t.substring(n+1):(n=t.length,""),r=[],u=0,i=Pi[0];n>0&&i>0;)r.push(t.substring(n-=i,n+i)),i=Pi[u=(u+1)%Qi];return r.reverse().join(ji||"")+e}}var ta=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(w);Ci.formatPrefix=function(t,n){var e=0;return t&&(0>t&&(t*=-1),n&&(t=Ci.round(t,x(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),ta[8+e/3]};var na=function(){return a},ea=Ci.map({linear:na,poly:q,quad:function(){return A},cubic:function(){return N},sin:function(){return C},exp:function(){return z},circle:function(){return D},elastic:L,back:F,bounce:function(){return H}}),ra=Ci.map({"in":a,out:k,"in-out":E,"out-in":function(t){return E(k(t))}});Ci.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.substring(0,n):t,r=n>=0?t.substring(n+1):"in";return e=ea.get(e)||na,r=ra.get(r)||a,S(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},Ci.event=null,Ci.transform=function(t){var n=Li.createElementNS(Ci.ns.prefix.svg,"g");return(Ci.transform=function(t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate();return new O(e?e.matrix:ua)})(t)},O.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ua={a:1,b:0,c:0,d:1,e:0,f:0};Ci.interpolate=function(t,n){for(var e,r=Ci.interpolators.length;--r>=0&&!(e=Ci.interpolators[r](t,n)););return e},Ci.interpolateNumber=function(t,n){return n-=t,function(e){return t+n*e}},Ci.interpolateRound=function(t,n){return n-=t,function(e){return Math.round(t+n*e)}},Ci.interpolateString=function(t,n){var e,r,u,i,a,o=0,c=0,l=[],f=[];for(ia.lastIndex=0,r=0;e=ia.exec(n);++r)e.index&&l.push(n.substring(o,c=e.index)),f.push({i:l.length,x:e[0]}),l.push(null),o=ia.lastIndex;for(n.length>o&&l.push(n.substring(o)),r=0,i=f.length;(e=ia.exec(t))&&i>r;++r)if(a=f[r],a.x==e[0]){if(a.i)if(null==l[a.i+1])for(l[a.i-1]+=a.x,l.splice(a.i,1),u=r+1;i>u;++u)f[u].i--;else for(l[a.i-1]+=a.x+l[a.i+1],l.splice(a.i,2),u=r+1;i>u;++u)f[u].i-=2;else if(null==l[a.i+1])l[a.i]=a.x;else for(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1),u=r+1;i>u;++u)f[u].i--;f.splice(r,1),i--,r--}else a.x=Ci.interpolateNumber(parseFloat(e[0]),parseFloat(a.x));for(;i>r;)a=f.pop(),null==l[a.i+1]?l[a.i]=a.x:(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1)),i--;return 1===l.length?null==l[0]?f[0].x:function(){return n}:function(t){for(r=0;i>r;++r)l[(a=f[r]).i]=a.x(t);return l.join("")}},Ci.interpolateTransform=function(t,n){var e,r=[],u=[],i=Ci.transform(t),a=Ci.transform(n),o=i.translate,c=a.translate,l=i.rotate,f=a.rotate,s=i.skew,h=a.skew,g=i.scale,p=a.scale;return o[0]!=c[0]||o[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:Ci.interpolateNumber(o[0],c[0])},{i:3,x:Ci.interpolateNumber(o[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=f?(l-f>180?f+=360:f-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Ci.interpolateNumber(l,f)})):f&&r.push(r.pop()+"rotate("+f+")"),s!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Ci.interpolateNumber(s,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:Ci.interpolateNumber(g[0],p[0])},{i:e-2,x:Ci.interpolateNumber(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(t){for(var n,i=-1;e>++i;)r[(n=u[i]).i]=n.x(t);return r.join("")}},Ci.interpolateRgb=function(t,n){t=Ci.rgb(t),n=Ci.rgb(n);var e=t.r,r=t.g,u=t.b,i=n.r-e,a=n.g-r,o=n.b-u;return function(t){return"#"+G(Math.round(e+i*t))+G(Math.round(r+a*t))+G(Math.round(u+o*t))}},Ci.interpolateHsl=function(t,n){t=Ci.hsl(t),n=Ci.hsl(n);var e=t.h,r=t.s,u=t.l,i=n.h-e,a=n.s-r,o=n.l-u;return i>180?i-=360:-180>i&&(i+=360),function(t){return un(e+i*t,r+a*t,u+o*t)+""}},Ci.interpolateLab=function(t,n){t=Ci.lab(t),n=Ci.lab(n);var e=t.l,r=t.a,u=t.b,i=n.l-e,a=n.a-r,o=n.b-u;return function(t){return sn(e+i*t,r+a*t,u+o*t)+""}},Ci.interpolateHcl=function(t,n){t=Ci.hcl(t),n=Ci.hcl(n);var e=t.h,r=t.c,u=t.l,i=n.h-e,a=n.c-r,o=n.l-u;return i>180?i-=360:-180>i&&(i+=360),function(t){return cn(e+i*t,r+a*t,u+o*t)+""}},Ci.interpolateArray=function(t,n){var e,r=[],u=[],i=t.length,a=n.length,o=Math.min(t.length,n.length);for(e=0;o>e;++e)r.push(Ci.interpolate(t[e],n[e]));for(;i>e;++e)u[e]=t[e];for(;a>e;++e)u[e]=n[e];return function(t){for(e=0;o>e;++e)u[e]=r[e](t);return u}},Ci.interpolateObject=function(t,n){var e,r={},u={};for(e in t)e in n?r[e]=V(e)(t[e],n[e]):u[e]=t[e];for(e in n)e in t||(u[e]=n[e]);return function(t){for(e in r)u[e]=r[e](t);return u}};var ia=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;Ci.interpolators=[Ci.interpolateObject,function(t,n){return n instanceof Array&&Ci.interpolateArray(t,n)},function(t,n){return("string"==typeof t||"string"==typeof n)&&Ci.interpolateString(t+"",n+"")},function(t,n){return("string"==typeof n?oa.has(n)||/^(#|rgb\(|hsl\()/.test(n):n instanceof B)&&Ci.interpolateRgb(t,n)},function(t,n){return!isNaN(t=+t)&&!isNaN(n=+n)&&Ci.interpolateNumber(t,n)}],B.prototype.toString=function(){return this.rgb()+""},Ci.rgb=function(t,n,e){return 1===arguments.length?t instanceof J?$(t.r,t.g,t.b):K(""+t,$,un):$(~~t,~~n,~~e)};var aa=J.prototype=new B;aa.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,u=30;return n||e||r?(n&&u>n&&(n=u),e&&u>e&&(e=u),r&&u>r&&(r=u),$(Math.min(255,Math.floor(n/t)),Math.min(255,Math.floor(e/t)),Math.min(255,Math.floor(r/t)))):$(u,u,u)},aa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),$(Math.floor(t*this.r),Math.floor(t*this.g),Math.floor(t*this.b))},aa.hsl=function(){return W(this.r,this.g,this.b)},aa.toString=function(){return"#"+G(this.r)+G(this.g)+G(this.b)};var oa=Ci.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});
+oa.forEach(function(t,n){oa.set(t,K(n,$,un))}),Ci.hsl=function(t,n,e){return 1===arguments.length?t instanceof rn?en(t.h,t.s,t.l):K(""+t,W,en):en(+t,+n,+e)};var ca=rn.prototype=new B;ca.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),en(this.h,this.s,this.l/t)},ca.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),en(this.h,this.s,t*this.l)},ca.rgb=function(){return un(this.h,this.s,this.l)},Ci.hcl=function(t,n,e){return 1===arguments.length?t instanceof on?an(t.h,t.c,t.l):t instanceof fn?hn(t.l,t.a,t.b):hn((t=Q((t=Ci.rgb(t)).r,t.g,t.b)).l,t.a,t.b):an(+t,+n,+e)};var la=on.prototype=new B;la.brighter=function(t){return an(this.h,this.c,Math.min(100,this.l+fa*(arguments.length?t:1)))},la.darker=function(t){return an(this.h,this.c,Math.max(0,this.l-fa*(arguments.length?t:1)))},la.rgb=function(){return cn(this.h,this.c,this.l).rgb()},Ci.lab=function(t,n,e){return 1===arguments.length?t instanceof fn?ln(t.l,t.a,t.b):t instanceof on?cn(t.l,t.c,t.h):Q((t=Ci.rgb(t)).r,t.g,t.b):ln(+t,+n,+e)};var fa=18,sa=.95047,ha=1,ga=1.08883,pa=fn.prototype=new B;pa.brighter=function(t){return ln(Math.min(100,this.l+fa*(arguments.length?t:1)),this.a,this.b)},pa.darker=function(t){return ln(Math.max(0,this.l-fa*(arguments.length?t:1)),this.a,this.b)},pa.rgb=function(){return sn(this.l,this.a,this.b)};var da=function(t,n){return n.querySelector(t)},ma=function(t,n){return n.querySelectorAll(t)},va=Li.documentElement,ya=va.matchesSelector||va.webkitMatchesSelector||va.mozMatchesSelector||va.msMatchesSelector||va.oMatchesSelector,Ma=function(t,n){return ya.call(t,n)};"function"==typeof Sizzle&&(da=function(t,n){return Sizzle(t,n)[0]||null},ma=function(t,n){return Sizzle.uniqueSort(Sizzle(t,n))},Ma=Sizzle.matchesSelector);var ba=[];Ci.selection=function(){return xa},Ci.selection.prototype=ba,ba.select=function(t){var n,e,r,u,i=[];"function"!=typeof t&&(t=vn(t));for(var a=-1,o=this.length;o>++a;){i.push(n=[]),n.parentNode=(r=this[a]).parentNode;for(var c=-1,l=r.length;l>++c;)(u=r[c])?(n.push(e=t.call(u,u.__data__,c)),e&&"__data__"in u&&(e.__data__=u.__data__)):n.push(null)}return mn(i)},ba.selectAll=function(t){var n,e,r=[];"function"!=typeof t&&(t=yn(t));for(var u=-1,i=this.length;i>++u;)for(var a=this[u],o=-1,c=a.length;c>++o;)(e=a[o])&&(r.push(n=Ui(t.call(e,e.__data__,o))),n.parentNode=e);return mn(r)},ba.attr=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node();return t=Ci.ns.qualify(t),t.local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(Mn(n,t[n]));return this}return this.each(Mn(t,n))},ba.classed=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node(),r=(t=t.trim().split(/^|\s+/g)).length,u=-1;if(n=e.classList){for(;r>++u;)if(!n.contains(t[u]))return!1}else for(n=e.className,null!=n.baseVal&&(n=n.baseVal);r>++u;)if(!bn(t[u]).test(n))return!1;return!0}for(n in t)this.each(xn(n,t[n]));return this}return this.each(xn(t,n))},ba.style=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n="");for(e in t)this.each(wn(e,t[e],n));return this}if(2>r)return Fi.getComputedStyle(this.node(),null).getPropertyValue(t);e=""}return this.each(wn(t,n,e))},ba.property=function(t,n){if(2>arguments.length){if("string"==typeof t)return this.node()[t];for(n in t)this.each(Sn(n,t[n]));return this}return this.each(Sn(t,n))},ba.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},ba.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},ba.append=function(t){function n(){return this.appendChild(Li.createElementNS(this.namespaceURI,t))}function e(){return this.appendChild(Li.createElementNS(t.space,t.local))}return t=Ci.ns.qualify(t),this.select(t.local?e:n)},ba.insert=function(t,n){function e(){return this.insertBefore(Li.createElementNS(this.namespaceURI,t),da(n,this))}function r(){return this.insertBefore(Li.createElementNS(t.space,t.local),da(n,this))}return t=Ci.ns.qualify(t),this.select(t.local?r:e)},ba.remove=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},ba.data=function(t,n){function e(t,e){var r,u,a,o=t.length,s=e.length,h=Math.min(o,s),g=Array(s),p=Array(s),d=Array(o);if(n){var m,v=new i,y=new i,M=[];for(r=-1;o>++r;)m=n.call(u=t[r],u.__data__,r),v.has(m)?d[r]=u:v.set(m,u),M.push(m);for(r=-1;s>++r;)m=n.call(e,a=e[r],r),(u=v.get(m))?(g[r]=u,u.__data__=a):y.has(m)||(p[r]=kn(a)),y.set(m,a),v.remove(m);for(r=-1;o>++r;)v.has(M[r])&&(d[r]=t[r])}else{for(r=-1;h>++r;)u=t[r],a=e[r],u?(u.__data__=a,g[r]=u):p[r]=kn(a);for(;s>r;++r)p[r]=kn(e[r]);for(;o>r;++r)d[r]=t[r]}p.update=g,p.parentNode=g.parentNode=d.parentNode=t.parentNode,c.push(p),l.push(g),f.push(d)}var r,u,a=-1,o=this.length;if(!arguments.length){for(t=Array(o=(r=this[0]).length);o>++a;)(u=r[a])&&(t[a]=u.__data__);return t}var c=qn([]),l=mn([]),f=mn([]);if("function"==typeof t)for(;o>++a;)e(r=this[a],t.call(r,r.parentNode.__data__,a));else for(;o>++a;)e(r=this[a],t);return l.enter=function(){return c},l.exit=function(){return f},l},ba.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},ba.filter=function(t){var n,e,r,u=[];"function"!=typeof t&&(t=En(t));for(var i=0,a=this.length;a>i;i++){u.push(n=[]),n.parentNode=(e=this[i]).parentNode;for(var o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return mn(u)},ba.order=function(){for(var t=-1,n=this.length;n>++t;)for(var e,r=this[t],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},ba.sort=function(t){t=An.apply(this,arguments);for(var n=-1,e=this.length;e>++n;)this[n].sort(t);return this.order()},ba.on=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n=!1);for(e in t)this.each(Nn(e,t[e],n));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(Nn(t,n,e))},ba.each=function(t){return Tn(this,function(n,e,r){t.call(n,n.__data__,e,r)})},ba.call=function(t){var n=Ui(arguments);return t.apply(n[0]=this,n),this},ba.empty=function(){return!this.node()},ba.node=function(){for(var t=0,n=this.length;n>t;t++)for(var e=this[t],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},ba.transition=function(){var t,n,e=wa||++ka,r=[],u=Object.create(Ea);u.time=Date.now();for(var i=-1,a=this.length;a>++i;){r.push(t=[]);for(var o=this[i],c=-1,l=o.length;l>++c;)(n=o[c])&&zn(n,c,e,u),t.push(n)}return Cn(r,e)};var xa=mn([[Li]]);xa[0].parentNode=va,Ci.select=function(t){return"string"==typeof t?xa.select(t):mn([[t]])},Ci.selectAll=function(t){return"string"==typeof t?xa.selectAll(t):mn([Ui(t)])};var _a=[];Ci.selection.enter=qn,Ci.selection.enter.prototype=_a,_a.append=ba.append,_a.insert=ba.insert,_a.empty=ba.empty,_a.node=ba.node,_a.select=function(t){for(var n,e,r,u,i,a=[],o=-1,c=this.length;c>++o;){r=(u=this[o]).update,a.push(n=[]),n.parentNode=u.parentNode;for(var l=-1,f=u.length;f>++l;)(i=u[l])?(n.push(r[l]=e=t.call(u.parentNode,i.__data__,l)),e.__data__=i.__data__):n.push(null)}return mn(a)};var wa,Sa=[],ka=0,Ea={ease:T,delay:0,duration:250};Sa.call=ba.call,Sa.empty=ba.empty,Sa.node=ba.node,Ci.transition=function(t){return arguments.length?wa?t.transition():t:xa.transition()},Ci.transition.prototype=Sa,Sa.select=function(t){var n,e,r,u=this.id,i=[];"function"!=typeof t&&(t=vn(t));for(var a=-1,o=this.length;o>++a;){i.push(n=[]);for(var c=this[a],l=-1,f=c.length;f>++l;)(r=c[l])&&(e=t.call(r,r.__data__,l))?("__data__"in r&&(e.__data__=r.__data__),zn(e,l,u,r.__transition__[u]),n.push(e)):n.push(null)}return Cn(i,u)},Sa.selectAll=function(t){var n,e,r,u,i,a=this.id,o=[];"function"!=typeof t&&(t=yn(t));for(var c=-1,l=this.length;l>++c;)for(var f=this[c],s=-1,h=f.length;h>++s;)if(r=f[s]){i=r.__transition__[a],e=t.call(r,r.__data__,s),o.push(n=[]);for(var g=-1,p=e.length;p>++g;)zn(u=e[g],g,a,i),n.push(u)}return Cn(o,a)},Sa.filter=function(t){var n,e,r,u=[];"function"!=typeof t&&(t=En(t));for(var i=0,a=this.length;a>i;i++){u.push(n=[]);for(var e=this[i],o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return Cn(u,this.id,this.time).ease(this.ease())},Sa.attr=function(t,n){function e(){this.removeAttribute(i)}function r(){this.removeAttributeNS(i.space,i.local)}if(2>arguments.length){for(n in t)this.attr(n,t[n]);return this}var u=V(t),i=Ci.ns.qualify(t);return Ln(this,"attr."+t,n,function(t){function n(){var n,e=this.getAttribute(i);return e!==t&&(n=u(e,t),function(t){this.setAttribute(i,n(t))})}function a(){var n,e=this.getAttributeNS(i.space,i.local);return e!==t&&(n=u(e,t),function(t){this.setAttributeNS(i.space,i.local,n(t))})}return null==t?i.local?r:e:(t+="",i.local?a:n)})},Sa.attrTween=function(t,n){function e(t,e){var r=n.call(this,t,e,this.getAttribute(u));return r&&function(t){this.setAttribute(u,r(t))}}function r(t,e){var r=n.call(this,t,e,this.getAttributeNS(u.space,u.local));return r&&function(t){this.setAttributeNS(u.space,u.local,r(t))}}var u=Ci.ns.qualify(t);return this.tween("attr."+t,u.local?r:e)},Sa.style=function(t,n,e){function r(){this.style.removeProperty(t)}var u=arguments.length;if(3>u){if("string"!=typeof t){2>u&&(n="");for(e in t)this.style(e,t[e],n);return this}e=""}var i=V(t);return Ln(this,"style."+t,n,function(n){function u(){var r,u=Fi.getComputedStyle(this,null).getPropertyValue(t);return u!==n&&(r=i(u,n),function(n){this.style.setProperty(t,r(n),e)})}return null==n?r:(n+="",u)})},Sa.styleTween=function(t,n,e){return 3>arguments.length&&(e=""),this.tween("style."+t,function(r,u){var i=n.call(this,r,u,Fi.getComputedStyle(this,null).getPropertyValue(t));return i&&function(n){this.style.setProperty(t,i(n),e)}})},Sa.text=function(t){return Ln(this,"text",t,Dn)},Sa.remove=function(){return this.each("end.transition",function(){var t;!this.__transition__&&(t=this.parentNode)&&t.removeChild(this)})},Sa.ease=function(t){var n=this.id;return 1>arguments.length?this.node().__transition__[n].ease:("function"!=typeof t&&(t=Ci.ease.apply(Ci,arguments)),Tn(this,function(e){e.__transition__[n].ease=t}))},Sa.delay=function(t){var n=this.id;return Tn(this,"function"==typeof t?function(e,r,u){e.__transition__[n].delay=0|t.call(e,e.__data__,r,u)}:(t|=0,function(e){e.__transition__[n].delay=t}))},Sa.duration=function(t){var n=this.id;return Tn(this,"function"==typeof t?function(e,r,u){e.__transition__[n].duration=Math.max(1,0|t.call(e,e.__data__,r,u))}:(t=Math.max(1,0|t),function(e){e.__transition__[n].duration=t}))},Sa.each=function(t,n){var e=this.id;if(2>arguments.length){var r=Ea,u=wa;wa=e,Tn(this,function(n,r,u){Ea=n.__transition__[e],t.call(n,n.__data__,r,u)}),Ea=r,wa=u}else Tn(this,function(r){r.__transition__[e].event.on(t,n)});return this},Sa.transition=function(){for(var t,n,e,r,u=this.id,i=++ka,a=[],o=0,c=this.length;c>o;o++){a.push(t=[]);for(var n=this[o],l=0,f=n.length;f>l;l++)(e=n[l])&&(r=Object.create(e.__transition__[u]),r.delay+=r.duration,zn(e,l,i,r)),t.push(e)}return Cn(a,i)},Sa.tween=function(t,n){var e=this.id;return 2>arguments.length?this.node().__transition__[e].tween.get(t):Tn(this,null==n?function(n){n.__transition__[e].tween.remove(t)}:function(r){r.__transition__[e].tween.set(t,n)})};var Aa,Na,Ta=0,qa={},Ca=null;Ci.timer=function(t,n,e){if(3>arguments.length){if(2>arguments.length)n=0;else if(!isFinite(n))return;e=Date.now()}var r=qa[t.id];r&&r.callback===t?(r.then=e,r.delay=n):qa[t.id=++Ta]=Ca={callback:t,then:e,delay:n,next:Ca},Aa||(Na=clearTimeout(Na),Aa=1,za(Fn))},Ci.timer.flush=function(){for(var t,n=Date.now(),e=Ca;e;)t=n-e.then,e.delay||(e.flush=e.callback(t)),e=e.next;Hn()};var za=Fi.requestAnimationFrame||Fi.webkitRequestAnimationFrame||Fi.mozRequestAnimationFrame||Fi.oRequestAnimationFrame||Fi.msRequestAnimationFrame||function(t){setTimeout(t,17)};Ci.mouse=function(t){return jn(t,P())};var Da=/WebKit/.test(Fi.navigator.userAgent)?-1:0;Ci.touches=function(t,n){return 2>arguments.length&&(n=P().touches),n?Ui(n).map(function(n){var e=jn(t,n);return e.identifier=n.identifier,e}):[]},Ci.scale={},Ci.scale.linear=function(){return In([0,1],[0,1],Ci.interpolate,!1)},Ci.scale.log=function(){return Kn(Ci.scale.linear(),Wn)};var La=Ci.format(".0e");Wn.pow=function(t){return Math.pow(10,t)},Qn.pow=function(t){return-Math.pow(10,-t)},Ci.scale.pow=function(){return te(Ci.scale.linear(),1)},Ci.scale.sqrt=function(){return Ci.scale.pow().exponent(.5)},Ci.scale.ordinal=function(){return ee([],{t:"range",a:[[]]})},Ci.scale.category10=function(){return Ci.scale.ordinal().range(Fa)},Ci.scale.category20=function(){return Ci.scale.ordinal().range(Ha)},Ci.scale.category20b=function(){return Ci.scale.ordinal().range(ja)},Ci.scale.category20c=function(){return Ci.scale.ordinal().range(Pa)};var Fa=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ha=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],ja=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Pa=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];Ci.scale.quantile=function(){return re([],[])},Ci.scale.quantize=function(){return ue(0,1,[0,1])},Ci.scale.threshold=function(){return ie([.5],[0,1])},Ci.scale.identity=function(){return ae([0,1])},Ci.svg={},Ci.svg.arc=function(){function t(){var t=n.apply(this,arguments),i=e.apply(this,arguments),a=r.apply(this,arguments)+Ra,o=u.apply(this,arguments)+Ra,c=(a>o&&(c=a,a=o,o=c),o-a),l=Ti>c?"0":"1",f=Math.cos(a),s=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=Oa?t?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":t?"M"+i*f+","+i*s+"A"+i+","+i+" 0 "+l+",1 "+i*h+","+i*g+"L"+t*h+","+t*g+"A"+t+","+t+" 0 "+l+",0 "+t*f+","+t*s+"Z":"M"+i*f+","+i*s+"A"+i+","+i+" 0 "+l+",1 "+i*h+","+i*g+"L0,0"+"Z"}var n=oe,e=ce,r=le,u=fe;return t.innerRadius=function(e){return arguments.length?(n=c(e),t):n},t.outerRadius=function(n){return arguments.length?(e=c(n),t):e},t.startAngle=function(n){return arguments.length?(r=c(n),t):r},t.endAngle=function(n){return arguments.length?(u=c(n),t):u},t.centroid=function(){var t=(n.apply(this,arguments)+e.apply(this,arguments))/2,i=(r.apply(this,arguments)+u.apply(this,arguments))/2+Ra;return[Math.cos(i)*t,Math.sin(i)*t]},t};var Ra=-Ti/2,Oa=2*Ti-1e-6;Ci.svg.line=function(){return se(a)};var Ya=Ci.map({linear:pe,"linear-closed":de,"step-before":me,"step-after":ve,basis:we,"basis-open":Se,"basis-closed":ke,bundle:Ee,cardinal:be,"cardinal-open":ye,"cardinal-closed":Me,monotone:ze});Ya.forEach(function(t,n){n.key=t,n.closed=/-closed$/.test(t)});var Ua=[0,2/3,1/3,0],Ia=[0,1/3,2/3,0],Va=[0,1/6,2/3,1/6];Ci.svg.line.radial=function(){var t=se(De);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},me.reverse=ve,ve.reverse=me,Ci.svg.area=function(){return Le(a)},Ci.svg.area.radial=function(){var t=Le(De);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},Ci.svg.chord=function(){function e(t,n){var e=r(this,o,t,n),c=r(this,l,t,n);return"M"+e.p0+i(e.r,e.p1,e.a1-e.a0)+(u(e,c)?a(e.r,e.p1,e.r,e.p0):a(e.r,e.p1,c.r,c.p0)+i(c.r,c.p1,c.a1-c.a0)+a(c.r,c.p1,e.r,e.p0))+"Z"}function r(t,n,e,r){var u=n.call(t,e,r),i=f.call(t,u,r),a=s.call(t,u,r)+Ra,o=h.call(t,u,r)+Ra;return{r:i,a0:a,a1:o,p0:[i*Math.cos(a),i*Math.sin(a)],p1:[i*Math.cos(o),i*Math.sin(o)]}}function u(t,n){return t.a0==n.a0&&t.a1==n.a1}function i(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Ti)+",1 "+n}function a(t,n,e,r){return"Q 0,0 "+r}var o=n,l=t,f=Fe,s=le,h=fe;return e.radius=function(t){return arguments.length?(f=c(t),e):f},e.source=function(t){return arguments.length?(o=c(t),e):o},e.target=function(t){return arguments.length?(l=c(t),e):l},e.startAngle=function(t){return arguments.length?(s=c(t),e):s},e.endAngle=function(t){return arguments.length?(h=c(t),e):h},e},Ci.svg.diagonal=function(){function e(t,n){var e=r.call(this,t,n),a=u.call(this,t,n),o=(e.y+a.y)/2,c=[e,{x:e.x,y:o},{x:a.x,y:o},a];return c=c.map(i),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var r=n,u=t,i=He;return e.source=function(t){return arguments.length?(r=c(t),e):r},e.target=function(t){return arguments.length?(u=c(t),e):u},e.projection=function(t){return arguments.length?(i=t,e):i},e},Ci.svg.diagonal.radial=function(){var t=Ci.svg.diagonal(),n=He,e=t.projection;return t.projection=function(t){return arguments.length?e(je(n=t)):n},t},Ci.svg.symbol=function(){function t(t,r){return(Za.get(n.call(this,t,r))||Oe)(e.call(this,t,r))}var n=Re,e=Pe;return t.type=function(e){return arguments.length?(n=c(e),t):n},t.size=function(n){return arguments.length?(e=c(n),t):e},t};var Za=Ci.map({circle:Oe,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*Ba)),e=n*Ba;return"M0,"+-n+"L"+e+",0"+" 0,"+n+" "+-e+",0"+"Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/Xa),e=n*Xa/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/Xa),e=n*Xa/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});Ci.svg.symbolTypes=Za.keys();var Xa=Math.sqrt(3),Ba=Math.tan(30*zi);Ci.svg.axis=function(){function t(t){t.each(function(){var t,s=Ci.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==n?e.tickFormat?e.tickFormat.apply(e,c):String:n,p=Ie(e,h,f),d=s.selectAll(".tick.minor").data(p,String),m=d.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),v=Ci.transition(d.exit()).style("opacity",1e-6).remove(),y=Ci.transition(d).style("opacity",1),M=s.selectAll(".tick.major").data(h,String),b=M.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),x=Ci.transition(M.exit()).style("opacity",1e-6).remove(),_=Ci.transition(M).style("opacity",1),w=On(e),S=s.selectAll(".domain").data([0]),k=(S.enter().append("path").attr("class","domain"),Ci.transition(S)),E=e.copy(),A=this.__chart__||E;this.__chart__=E,b.append("line"),b.append("text");var N=b.select("line"),T=_.select("line"),q=M.select("text").text(g),C=b.select("text"),z=_.select("text");switch(r){case"bottom":t=Ye,m.attr("y2",i),y.attr("x2",0).attr("y2",i),N.attr("y2",u),C.attr("y",Math.max(u,0)+o),T.attr("x2",0).attr("y2",u),z.attr("x",0).attr("y",Math.max(u,0)+o),q.attr("dy",".71em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+a+"V0H"+w[1]+"V"+a);break;case"top":t=Ye,m.attr("y2",-i),y.attr("x2",0).attr("y2",-i),N.attr("y2",-u),C.attr("y",-(Math.max(u,0)+o)),T.attr("x2",0).attr("y2",-u),z.attr("x",0).attr("y",-(Math.max(u,0)+o)),q.attr("dy","0em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+-a+"V0H"+w[1]+"V"+-a);break;case"left":t=Ue,m.attr("x2",-i),y.attr("x2",-i).attr("y2",0),N.attr("x2",-u),C.attr("x",-(Math.max(u,0)+o)),T.attr("x2",-u).attr("y2",0),z.attr("x",-(Math.max(u,0)+o)).attr("y",0),q.attr("dy",".32em").style("text-anchor","end"),k.attr("d","M"+-a+","+w[0]+"H0V"+w[1]+"H"+-a);break;case"right":t=Ue,m.attr("x2",i),y.attr("x2",i).attr("y2",0),N.attr("x2",u),C.attr("x",Math.max(u,0)+o),T.attr("x2",u).attr("y2",0),z.attr("x",Math.max(u,0)+o).attr("y",0),q.attr("dy",".32em").style("text-anchor","start"),k.attr("d","M"+a+","+w[0]+"H0V"+w[1]+"H"+a)}if(e.ticks)b.call(t,A),_.call(t,E),x.call(t,E),m.call(t,A),y.call(t,E),v.call(t,E);else{var D=E.rangeBand()/2,L=function(t){return E(t)+D};b.call(t,L),_.call(t,L)}})}var n,e=Ci.scale.linear(),r=$a,u=6,i=6,a=6,o=3,c=[10],l=null,f=0;return t.scale=function(n){return arguments.length?(e=n,t):e},t.orient=function(n){return arguments.length?(r=n in Ja?n+"":$a,t):r},t.ticks=function(){return arguments.length?(c=arguments,t):c},t.tickValues=function(n){return arguments.length?(l=n,t):l},t.tickFormat=function(e){return arguments.length?(n=e,t):n},t.tickSize=function(n,e){if(!arguments.length)return u;var r=arguments.length-1;return u=+n,i=r>1?+e:u,a=r>0?+arguments[r]:u,t},t.tickPadding=function(n){return arguments.length?(o=+n,t):o},t.tickSubdivide=function(n){return arguments.length?(f=+n,t):f},t};var $a="bottom",Ja={top:1,right:1,bottom:1,left:1};Ci.svg.brush=function(){function t(i){i.each(function(){var i,a=Ci.select(this),f=a.selectAll(".background").data([0]),s=a.selectAll(".extent").data([0]),h=a.selectAll(".resize").data(l,String);a.style("pointer-events","all").on("mousedown.brush",u).on("touchstart.brush",u),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),s.enter().append("rect").attr("class","extent").style("cursor","move"),h.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ga[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),h.style("display",t.empty()?"none":null),h.exit().remove(),o&&(i=On(o),f.attr("x",i[0]).attr("width",i[1]-i[0]),e(a)),c&&(i=On(c),f.attr("y",i[0]).attr("height",i[1]-i[0]),r(a)),n(a)})}function n(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)][0]+","+f[+/^s/.test(t)][1]+")"})}function e(t){t.select(".extent").attr("x",f[0][0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(t){t.select(".extent").attr("y",f[0][1]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function u(){function u(){var t=Ci.event.changedTouches;return t?Ci.touches(v,t)[0]:Ci.mouse(v)}function l(){32==Ci.event.keyCode&&(S||(d=null,k[0]-=f[1][0],k[1]-=f[1][1],S=2),j())}function s(){32==Ci.event.keyCode&&2==S&&(k[0]+=f[1][0],k[1]+=f[1][1],S=0,j())}function h(){var t=u(),i=!1;m&&(t[0]+=m[0],t[1]+=m[1]),S||(Ci.event.altKey?(d||(d=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),k[0]=f[+(t[0]<d[0])][0],k[1]=f[+(t[1]<d[1])][1]):d=null),_&&g(t,o,0)&&(e(b),i=!0),w&&g(t,c,1)&&(r(b),i=!0),i&&(n(b),M({type:"brush",mode:S?"move":"resize"}))}function g(t,n,e){var r,u,a=On(n),o=a[0],c=a[1],l=k[e],s=f[1][e]-f[0][e];return S&&(o-=l,c-=s+l),r=Math.max(o,Math.min(c,t[e])),S?u=(r+=l)+s:(d&&(l=Math.max(o,Math.min(c,2*d[e]-r))),r>l?(u=r,r=l):u=l),f[0][e]!==r||f[1][e]!==u?(i=null,f[0][e]=r,f[1][e]=u,!0):void 0}function p(){h(),b.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Ci.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),M({type:"brushend"}),j()}var d,m,v=this,y=Ci.select(Ci.event.target),M=a.of(v,arguments),b=Ci.select(v),x=y.datum(),_=!/^(n|s)$/.test(x)&&o,w=!/^(e|w)$/.test(x)&&c,S=y.classed("extent"),k=u(),E=Ci.select(Fi).on("mousemove.brush",h).on("mouseup.brush",p).on("touchmove.brush",h).on("touchend.brush",p).on("keydown.brush",l).on("keyup.brush",s);if(S)k[0]=f[0][0]-k[0],k[1]=f[0][1]-k[1];else if(x){var A=+/w$/.test(x),N=+/^n/.test(x);m=[f[1-A][0]-k[0],f[1-N][1]-k[1]],k[0]=f[A][0],k[1]=f[N][1]}else Ci.event.altKey&&(d=k.slice());b.style("pointer-events","none").selectAll(".resize").style("display",null),Ci.select("body").style("cursor",y.style("cursor")),M({type:"brushstart"}),h(),j()}var i,a=R(t,"brushstart","brush","brushend"),o=null,c=null,l=Ka[0],f=[[0,0],[0,0]];return t.x=function(n){return arguments.length?(o=n,l=Ka[!o<<1|!c],t):o},t.y=function(n){return arguments.length?(c=n,l=Ka[!o<<1|!c],t):c},t.extent=function(n){var e,r,u,a,l;return arguments.length?(i=[[0,0],[0,0]],o&&(e=n[0],r=n[1],c&&(e=e[0],r=r[0]),i[0][0]=e,i[1][0]=r,o.invert&&(e=o(e),r=o(r)),e>r&&(l=e,e=r,r=l),f[0][0]=0|e,f[1][0]=0|r),c&&(u=n[0],a=n[1],o&&(u=u[1],a=a[1]),i[0][1]=u,i[1][1]=a,c.invert&&(u=c(u),a=c(a)),u>a&&(l=u,u=a,a=l),f[0][1]=0|u,f[1][1]=0|a),t):(n=i||f,o&&(e=n[0][0],r=n[1][0],i||(e=f[0][0],r=f[1][0],o.invert&&(e=o.invert(e),r=o.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(u=n[0][1],a=n[1][1],i||(u=f[0][1],a=f[1][1],c.invert&&(u=c.invert(u),a=c.invert(a)),u>a&&(l=u,u=a,a=l))),o&&c?[[e,u],[r,a]]:o?[e,r]:c&&[u,a])},t.clear=function(){return i=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,t},t.empty=function(){return o&&f[0][0]===f[1][0]||c&&f[0][1]===f[1][1]},Ci.rebind(t,a,"on")};var Ga={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ka=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];Ci.behavior={},Ci.behavior.drag=function(){function t(){this.on("mousedown.drag",n).on("touchstart.drag",n)}function n(){function t(){var t=o.parentNode;return null!=f?Ci.touches(t).filter(function(t){return t.identifier===f})[0]:Ci.mouse(t)}function n(){if(!o.parentNode)return u();var n=t(),e=n[0]-s[0],r=n[1]-s[1];h|=e|r,s=n,j(),c({type:"drag",x:n[0]+a[0],y:n[1]+a[1],dx:e,dy:r})}function u(){c({type:"dragend"}),h&&(j(),Ci.event.target===l&&g.on("click.drag",i,!0)),g.on(null!=f?"touchmove.drag-"+f:"mousemove.drag",null).on(null!=f?"touchend.drag-"+f:"mouseup.drag",null)}function i(){j(),g.on("click.drag",null)}var a,o=this,c=e.of(o,arguments),l=Ci.event.target,f=Ci.event.touches?Ci.event.changedTouches[0].identifier:null,s=t(),h=0,g=Ci.select(Fi).on(null!=f?"touchmove.drag-"+f:"mousemove.drag",n).on(null!=f?"touchend.drag-"+f:"mouseup.drag",u,!0);r?(a=r.apply(o,arguments),a=[a.x-s[0],a.y-s[1]]):a=[0,0],null==f&&j(),c({type:"dragstart"})}var e=R(t,"drag","dragstart","dragend"),r=null;return t.origin=function(n){return arguments.length?(r=n,t):r},Ci.rebind(t,e,"on")},Ci.behavior.zoom=function(){function t(){this.on("mousedown.zoom",o).on("mousemove.zoom",l).on(to+".zoom",c).on("dblclick.zoom",f).on("touchstart.zoom",s).on("touchmove.zoom",h).on("touchend.zoom",s)}function n(t){return[(t[0]-b[0])/x,(t[1]-b[1])/x]}function e(t){return[t[0]*x+b[0],t[1]*x+b[1]]}function r(t){x=Math.max(_[0],Math.min(_[1],t))}function u(t,n){n=e(n),b[0]+=t[0]-n[0],b[1]+=t[1]-n[1]}function i(){m&&m.domain(d.range().map(function(t){return(t-b[0])/x}).map(d.invert)),y&&y.domain(v.range().map(function(t){return(t-b[1])/x}).map(v.invert))}function a(t){i(),Ci.event.preventDefault(),t({type:"zoom",scale:x,translate:b})}function o(){function t(){l=1,u(Ci.mouse(i),s),a(o)}function e(){l&&j(),f.on("mousemove.zoom",null).on("mouseup.zoom",null),l&&Ci.event.target===c&&f.on("click.zoom",r,!0)}function r(){j(),f.on("click.zoom",null)}var i=this,o=w.of(i,arguments),c=Ci.event.target,l=0,f=Ci.select(Fi).on("mousemove.zoom",t).on("mouseup.zoom",e),s=n(Ci.mouse(i));Fi.focus(),j()}function c(){g||(g=n(Ci.mouse(this))),r(Math.pow(2,.002*Wa())*x),u(Ci.mouse(this),g),a(w.of(this,arguments))}function l(){g=null}function f(){var t=Ci.mouse(this),e=n(t),i=Math.log(x)/Math.LN2;r(Math.pow(2,Ci.event.shiftKey?Math.ceil(i)-1:Math.floor(i)+1)),u(t,e),a(w.of(this,arguments))}function s(){var t=Ci.touches(this),e=Date.now();if(p=x,g={},t.forEach(function(t){g[t.identifier]=n(t)}),j(),1===t.length){if(500>e-M){var i=t[0],o=n(t[0]);r(2*x),u(i,o),a(w.of(this,arguments))}M=e}}function h(){var t=Ci.touches(this),n=t[0],e=g[n.identifier];if(i=t[1]){var i,o=g[i.identifier];n=[(n[0]+i[0])/2,(n[1]+i[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(Ci.event.scale*p)}u(n,e),M=null,a(w.of(this,arguments))}var g,p,d,m,v,y,M,b=[0,0],x=1,_=Qa,w=R(t,"zoom");return t.translate=function(n){return arguments.length?(b=n.map(Number),i(),t):b},t.scale=function(n){return arguments.length?(x=+n,i(),t):x},t.scaleExtent=function(n){return arguments.length?(_=null==n?Qa:n.map(Number),t):_},t.x=function(n){return arguments.length?(m=n,d=n.copy(),b=[0,0],x=1,t):m},t.y=function(n){return arguments.length?(y=n,v=n.copy(),b=[0,0],x=1,t):y},Ci.rebind(t,w,"on")};var Wa,Qa=[0,1/0],to="onwheel"in document?(Wa=function(){return-Ci.event.deltaY*(Ci.event.deltaMode?120:1)},"wheel"):"onmousewheel"in document?(Wa=function(){return Ci.event.wheelDelta},"mousewheel"):(Wa=function(){return-Ci.event.detail},"MozMousePixelScroll");Ci.layout={},Ci.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;r>++e;)n.push(Ve(t[e]));return n}},Ci.layout.chord=function(){function t(){var t,l,s,h,g,p={},d=[],m=Ci.range(i),v=[];for(e=[],r=[],t=0,h=-1;i>++h;){for(l=0,g=-1;i>++g;)l+=u[h][g];d.push(l),v.push(Ci.range(i)),t+=l}for(a&&m.sort(function(t,n){return a(d[t],d[n])}),o&&v.forEach(function(t,n){t.sort(function(t,e){return o(u[n][t],u[n][e])})}),t=(2*Ti-f*i)/t,l=0,h=-1;i>++h;){for(s=l,g=-1;i>++g;){var y=m[h],M=v[y][g],b=u[y][M],x=l,_=l+=b*t;p[y+"-"+M]={index:y,subindex:M,startAngle:x,endAngle:_,value:b}}r[y]={index:y,startAngle:s,endAngle:l,value:(l-s)/t},l+=f}for(h=-1;i>++h;)for(g=h-1;i>++g;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&n()}function n(){e.sort(function(t,n){return c((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)})}var e,r,u,i,a,o,c,l={},f=0;return l.matrix=function(t){return arguments.length?(i=(u=t)&&u.length,e=r=null,l):u},l.padding=function(t){return arguments.length?(f=t,e=r=null,l):f},l.sortGroups=function(t){return arguments.length?(a=t,e=r=null,l):a},l.sortSubgroups=function(t){return arguments.length?(o=t,e=null,l):o},l.sortChords=function(t){return arguments.length?(c=t,e&&n(),l):c},l.chords=function(){return e||t(),e},l.groups=function(){return r||t(),r},l},Ci.layout.force=function(){function t(t){return function(n,e,r,u){if(n.point!==t){var i=n.cx-t.x,a=n.cy-t.y,o=1/Math.sqrt(i*i+a*a);if(m>(u-e)*o){var c=n.charge*o*o;return t.px-=i*c,t.py-=a*c,!0}if(n.point&&isFinite(o)){var c=n.pointCharge*o*o;t.px-=i*c,t.py-=a*c}}return!n.charge}}function n(t){t.px=Ci.event.x,t.py=Ci.event.y,c.resume()}var e,r,u,i,o,c={},l=Ci.dispatch("start","tick","end"),f=[1,1],s=.9,h=no,g=eo,p=-30,d=.1,m=.8,v=[],y=[];return c.tick=function(){if(.005>(r*=.99))return l.end({type:"end",alpha:r=0}),!0;var n,e,a,c,h,g,m,M,b,x=v.length,_=y.length;for(e=0;_>e;++e)a=y[e],c=a.source,h=a.target,M=h.x-c.x,b=h.y-c.y,(g=M*M+b*b)&&(g=r*i[e]*((g=Math.sqrt(g))-u[e])/g,M*=g,b*=g,h.x-=M*(m=c.weight/(h.weight+c.weight)),h.y-=b*m,c.x+=M*(m=1-m),c.y+=b*m);if((m=r*d)&&(M=f[0]/2,b=f[1]/2,e=-1,m))for(;x>++e;)a=v[e],a.x+=(M-a.x)*m,a.y+=(b-a.y)*m;if(p)for(Ke(n=Ci.geom.quadtree(v),r,o),e=-1;x>++e;)(a=v[e]).fixed||n.visit(t(a));for(e=-1;x>++e;)a=v[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);l.tick({type:"tick",alpha:r})},c.nodes=function(t){return arguments.length?(v=t,c):v},c.links=function(t){return arguments.length?(y=t,c):y},c.size=function(t){return arguments.length?(f=t,c):f},c.linkDistance=function(t){return arguments.length?(h="function"==typeof t?t:+t,c):h},c.distance=c.linkDistance,c.linkStrength=function(t){return arguments.length?(g="function"==typeof t?t:+t,c):g},c.friction=function(t){return arguments.length?(s=+t,c):s},c.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,c):p},c.gravity=function(t){return arguments.length?(d=+t,c):d},c.theta=function(t){return arguments.length?(m=+t,c):m},c.alpha=function(t){return arguments.length?(t=+t,r?r=t>0?t:0:t>0&&(l.start({type:"start",alpha:r=t}),Ci.timer(c.tick)),c):r},c.start=function(){function t(t,r){for(var u,i=n(e),a=-1,o=i.length;o>++a;)if(!isNaN(u=i[a][t]))return u;
+return Math.random()*r}function n(){if(!a){for(a=[],r=0;s>r;++r)a[r]=[];for(r=0;d>r;++r){var t=y[r];a[t.source.index].push(t.target),a[t.target.index].push(t.source)}}return a[e]}var e,r,a,l,s=v.length,d=y.length,m=f[0],M=f[1];for(e=0;s>e;++e)(l=v[e]).index=e,l.weight=0;for(e=0;d>e;++e)l=y[e],"number"==typeof l.source&&(l.source=v[l.source]),"number"==typeof l.target&&(l.target=v[l.target]),++l.source.weight,++l.target.weight;for(e=0;s>e;++e)l=v[e],isNaN(l.x)&&(l.x=t("x",m)),isNaN(l.y)&&(l.y=t("y",M)),isNaN(l.px)&&(l.px=l.x),isNaN(l.py)&&(l.py=l.y);if(u=[],"function"==typeof h)for(e=0;d>e;++e)u[e]=+h.call(this,y[e],e);else for(e=0;d>e;++e)u[e]=h;if(i=[],"function"==typeof g)for(e=0;d>e;++e)i[e]=+g.call(this,y[e],e);else for(e=0;d>e;++e)i[e]=g;if(o=[],"function"==typeof p)for(e=0;s>e;++e)o[e]=+p.call(this,v[e],e);else for(e=0;s>e;++e)o[e]=p;return c.resume()},c.resume=function(){return c.alpha(.1)},c.stop=function(){return c.alpha(0)},c.drag=function(){return e||(e=Ci.behavior.drag().origin(a).on("dragstart.force",Be).on("drag.force",n).on("dragend.force",$e)),arguments.length?(this.on("mouseover.force",Je).on("mouseout.force",Ge).call(e),void 0):e},Ci.rebind(c,l,"on")};var no=20,eo=1;Ci.layout.partition=function(){function t(n,e,r,u){var i=n.children;if(n.x=e,n.y=n.depth*u,n.dx=r,n.dy=u,i&&(a=i.length)){var a,o,c,l=-1;for(r=n.value?r/n.value:0;a>++l;)t(o=i[l],e,c=o.value*r,u),e+=c}}function n(t){var e=t.children,r=0;if(e&&(u=e.length))for(var u,i=-1;u>++i;)r=Math.max(r,n(e[i]));return 1+r}function e(e,i){var a=r.call(this,e,i);return t(a[0],0,u[0],u[1]/n(a[0])),a}var r=Ci.layout.hierarchy(),u=[1,1];return e.size=function(t){return arguments.length?(u=t,e):u},lr(e,r)},Ci.layout.pie=function(){function t(i){var a=i.map(function(e,r){return+n.call(t,e,r)}),o=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof u?u.apply(this,arguments):u)-r)/Ci.sum(a),l=Ci.range(i.length);null!=e&&l.sort(e===ro?function(t,n){return a[n]-a[t]}:function(t,n){return e(i[t],i[n])});var f=[];return l.forEach(function(t){var n;f[t]={data:i[t],value:n=a[t],startAngle:o,endAngle:o+=n*c}}),f}var n=Number,e=ro,r=0,u=2*Ti;return t.value=function(e){return arguments.length?(n=e,t):n},t.sort=function(n){return arguments.length?(e=n,t):e},t.startAngle=function(n){return arguments.length?(r=n,t):r},t.endAngle=function(n){return arguments.length?(u=n,t):u},t};var ro={};Ci.layout.stack=function(){function t(a,c){var l=a.map(function(e,r){return n.call(t,e,r)}),f=l.map(function(n){return n.map(function(n,e){return[i.call(t,n,e),o.call(t,n,e)]})}),s=e.call(t,f,c);l=Ci.permute(l,s),f=Ci.permute(f,s);var h,g,p,d=r.call(t,f,c),m=l.length,v=l[0].length;for(g=0;v>g;++g)for(u.call(t,l[0][g],p=d[g],f[0][g][1]),h=1;m>h;++h)u.call(t,l[h][g],p+=f[h-1][g][1],f[h][g][1]);return a}var n=a,e=nr,r=er,u=tr,i=We,o=Qe;return t.values=function(e){return arguments.length?(n=e,t):n},t.order=function(n){return arguments.length?(e="function"==typeof n?n:uo.get(n)||nr,t):e},t.offset=function(n){return arguments.length?(r="function"==typeof n?n:io.get(n)||er,t):r},t.x=function(n){return arguments.length?(i=n,t):i},t.y=function(n){return arguments.length?(o=n,t):o},t.out=function(n){return arguments.length?(u=n,t):u},t};var uo=Ci.map({"inside-out":function(t){var n,e,r=t.length,u=t.map(rr),i=t.map(ur),a=Ci.range(r).sort(function(t,n){return u[t]-u[n]}),o=0,c=0,l=[],f=[];for(n=0;r>n;++n)e=a[n],c>o?(o+=i[e],l.push(e)):(c+=i[e],f.push(e));return f.reverse().concat(l)},reverse:function(t){return Ci.range(t.length).reverse()},"default":nr}),io=Ci.map({silhouette:function(t){var n,e,r,u=t.length,i=t[0].length,a=[],o=0,c=[];for(e=0;i>e;++e){for(n=0,r=0;u>n;n++)r+=t[n][e][1];r>o&&(o=r),a.push(r)}for(e=0;i>e;++e)c[e]=(o-a[e])/2;return c},wiggle:function(t){var n,e,r,u,i,a,o,c,l,f=t.length,s=t[0],h=s.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(n=0,u=0;f>n;++n)u+=t[n][e][1];for(n=0,i=0,o=s[e][0]-s[e-1][0];f>n;++n){for(r=0,a=(t[n][e][1]-t[n][e-1][1])/(2*o);n>r;++r)a+=(t[r][e][1]-t[r][e-1][1])/o;i+=a*t[n][e][1]}g[e]=c-=u?i/u*o:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(t){var n,e,r,u=t.length,i=t[0].length,a=1/u,o=[];for(e=0;i>e;++e){for(n=0,r=0;u>n;n++)r+=t[n][e][1];if(r)for(n=0;u>n;n++)t[n][e][1]/=r;else for(n=0;u>n;n++)t[n][e][1]=a}for(e=0;i>e;++e)o[e]=0;return o},zero:er});Ci.layout.histogram=function(){function t(t,i){for(var a,o,c=[],l=t.map(e,this),f=r.call(this,l,i),s=u.call(this,f,l,i),i=-1,h=l.length,g=s.length-1,p=n?1:1/h;g>++i;)a=c[i]=[],a.dx=s[i+1]-(a.x=s[i]),a.y=0;if(g>0)for(i=-1;h>++i;)o=l[i],o>=f[0]&&f[1]>=o&&(a=c[Ci.bisect(s,o,1,g)-1],a.y+=p,a.push(t[i]));return c}var n=!0,e=Number,r=cr,u=ar;return t.value=function(n){return arguments.length?(e=n,t):e},t.range=function(n){return arguments.length?(r=c(n),t):r},t.bins=function(n){return arguments.length?(u="number"==typeof n?function(t){return or(t,n)}:c(n),t):u},t.frequency=function(e){return arguments.length?(n=!!e,t):n},t},Ci.layout.hierarchy=function(){function t(n,a,o){var c=u.call(e,n,a);if(n.depth=a,o.push(n),c&&(l=c.length)){for(var l,f,s=-1,h=n.children=[],g=0,p=a+1;l>++s;)f=t(c[s],p,o),f.parent=n,h.push(f),g+=f.value;r&&h.sort(r),i&&(n.value=g)}else i&&(n.value=+i.call(e,n,a)||0);return n}function n(t,r){var u=t.children,a=0;if(u&&(o=u.length))for(var o,c=-1,l=r+1;o>++c;)a+=n(u[c],l);else i&&(a=+i.call(e,t,r)||0);return i&&(t.value=a),a}function e(n){var e=[];return t(n,0,e),e}var r=hr,u=fr,i=sr;return e.sort=function(t){return arguments.length?(r=t,e):r},e.children=function(t){return arguments.length?(u=t,e):u},e.value=function(t){return arguments.length?(i=t,e):i},e.revalue=function(t){return n(t,0),t},e},Ci.layout.pack=function(){function t(t,u){var i=n.call(this,t,u),a=i[0];a.x=0,a.y=0,Lr(a,function(t){t.r=Math.sqrt(t.value)}),Lr(a,yr);var o=r[0],c=r[1],l=Math.max(2*a.r/o,2*a.r/c);if(e>0){var f=e*l/2;Lr(a,function(t){t.r+=f}),Lr(a,yr),Lr(a,function(t){t.r-=f}),l=Math.max(2*a.r/o,2*a.r/c)}return xr(a,o/2,c/2,1/l),i}var n=Ci.layout.hierarchy().sort(pr),e=0,r=[1,1];return t.size=function(n){return arguments.length?(r=n,t):r},t.padding=function(n){return arguments.length?(e=+n,t):e},lr(t,n)},Ci.layout.cluster=function(){function t(t,u){var i,a=n.call(this,t,u),o=a[0],c=0;Lr(o,function(t){var n=t.children;n&&n.length?(t.x=Sr(n),t.y=wr(n)):(t.x=i?c+=e(t,i):0,t.y=0,i=t)});var l=kr(o),f=Er(o),s=l.x-e(l,f)/2,h=f.x+e(f,l)/2;return Lr(o,function(t){t.x=(t.x-s)/(h-s)*r[0],t.y=(1-(o.y?t.y/o.y:1))*r[1]}),a}var n=Ci.layout.hierarchy().sort(null).value(null),e=Ar,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},lr(t,n)},Ci.layout.tree=function(){function t(t,u){function i(t,n){var r=t.children,u=t._tree;if(r&&(a=r.length)){for(var a,c,l,f=r[0],s=f,h=-1;a>++h;)l=r[h],i(l,c),s=o(l,c,s),c=l;Fr(t);var g=.5*(f._tree.prelim+l._tree.prelim);n?(u.prelim=n._tree.prelim+e(t,n),u.mod=u.prelim-g):u.prelim=g}else n&&(u.prelim=n._tree.prelim+e(t,n))}function a(t,n){t.x=t._tree.prelim+n;var e=t.children;if(e&&(r=e.length)){var r,u=-1;for(n+=t._tree.mod;r>++u;)a(e[u],n)}}function o(t,n,r){if(n){for(var u,i=t,a=t,o=n,c=t.parent.children[0],l=i._tree.mod,f=a._tree.mod,s=o._tree.mod,h=c._tree.mod;o=Tr(o),i=Nr(i),o&&i;)c=Nr(c),a=Tr(a),a._tree.ancestor=t,u=o._tree.prelim+s-i._tree.prelim-l+e(o,i),u>0&&(Hr(jr(o,t,r),t,u),l+=u,f+=u),s+=o._tree.mod,l+=i._tree.mod,h+=c._tree.mod,f+=a._tree.mod;o&&!Tr(a)&&(a._tree.thread=o,a._tree.mod+=s-f),i&&!Nr(c)&&(c._tree.thread=i,c._tree.mod+=l-h,r=t)}return r}var c=n.call(this,t,u),l=c[0];Lr(l,function(t,n){t._tree={ancestor:t,prelim:0,mod:0,change:0,shift:0,number:n?n._tree.number+1:0}}),i(l),a(l,-l._tree.prelim);var f=qr(l,zr),s=qr(l,Cr),h=qr(l,Dr),g=f.x-e(f,s)/2,p=s.x+e(s,f)/2,d=h.depth||1;return Lr(l,function(t){t.x=(t.x-g)/(p-g)*r[0],t.y=t.depth/d*r[1],delete t._tree}),c}var n=Ci.layout.hierarchy().sort(null).value(null),e=Ar,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},lr(t,n)},Ci.layout.treemap=function(){function t(t,n){for(var e,r,u=-1,i=t.length;i>++u;)r=(e=t[u]).value*(0>n?0:n),e.area=isNaN(r)||0>=r?0:r}function n(e){var i=e.children;if(i&&i.length){var a,o,c,l=s(e),f=[],h=i.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(t(h,l.dx*l.dy/e.value),f.area=0;(c=h.length)>0;)f.push(a=h[c-1]),f.area+=a.area,"squarify"!==g||p>=(o=r(f,d))?(h.pop(),p=o):(f.area-=f.pop().area,u(f,d,l,!1),d=Math.min(l.dx,l.dy),f.length=f.area=0,p=1/0);f.length&&(u(f,d,l,!0),f.length=f.area=0),i.forEach(n)}}function e(n){var r=n.children;if(r&&r.length){var i,a=s(n),o=r.slice(),c=[];for(t(o,a.dx*a.dy/n.value),c.area=0;i=o.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);r.forEach(e)}}function r(t,n){for(var e,r=t.area,u=0,i=1/0,a=-1,o=t.length;o>++a;)(e=t[a].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,n*=n,r?Math.max(n*u*p/r,r/(n*i*p)):1/0}function u(t,n,e,r){var u,i=-1,a=t.length,o=e.x,l=e.y,f=n?c(t.area/n):0;if(n==e.dx){for((r||f>e.dy)&&(f=e.dy);a>++i;)u=t[i],u.x=o,u.y=l,u.dy=f,o+=u.dx=Math.min(e.x+e.dx-o,f?c(u.area/f):0);u.z=!0,u.dx+=e.x+e.dx-o,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);a>++i;)u=t[i],u.x=o,u.y=l,u.dx=f,l+=u.dy=Math.min(e.y+e.dy-l,f?c(u.area/f):0);u.z=!1,u.dy+=e.y+e.dy-l,e.x+=f,e.dx-=f}}function i(r){var u=a||o(r),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],a&&o.revalue(i),t([i],i.dx*i.dy/i.value),(a?e:n)(i),h&&(a=u),u}var a,o=Ci.layout.hierarchy(),c=Math.round,l=[1,1],f=null,s=Pr,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(t){return arguments.length?(l=t,i):l},i.padding=function(t){function n(n){var e=t.call(i,n,n.depth);return null==e?Pr(n):Rr(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return Rr(n,t)}if(!arguments.length)return f;var r;return s=null==(f=t)?Pr:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,i},i.round=function(t){return arguments.length?(c=t?Math.round:Number,i):c!=Number},i.sticky=function(t){return arguments.length?(h=t,a=null,i):h},i.ratio=function(t){return arguments.length?(p=t,i):p},i.mode=function(t){return arguments.length?(g=t+"",i):g},lr(i,o)},Ci.csv=Or(",","text/csv"),Ci.tsv=Or(" ","text/tab-separated-values"),Ci.geo={},Ci.geo.stream=function(t,n){ao.hasOwnProperty(t.type)?ao[t.type](t,n):Yr(t,n)};var ao={Feature:function(t,n){Yr(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,u=e.length;u>++r;)Yr(e[r].geometry,n)}},oo={Sphere:function(t,n){n.sphere()},Point:function(t,n){var e=t.coordinates;n.point(e[0],e[1])},MultiPoint:function(t,n){for(var e,r=t.coordinates,u=-1,i=r.length;i>++u;)e=r[u],n.point(e[0],e[1])},LineString:function(t,n){Ur(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,u=e.length;u>++r;)Ur(e[r],n,0)},Polygon:function(t,n){Ir(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,u=e.length;u>++r;)Ir(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,u=e.length;u>++r;)Yr(e[r],n)}};Ci.geo.albersUsa=function(){function t(t){return n(t)(t)}function n(t){var n=t[0],a=t[1];return a>50?r:-140>n?u:21>a?i:e}var e=Ci.geo.albers(),r=Ci.geo.albers().rotate([160,0]).center([0,60]).parallels([55,65]),u=Ci.geo.albers().rotate([160,0]).center([0,20]).parallels([8,18]),i=Ci.geo.albers().rotate([60,0]).center([0,10]).parallels([8,18]);return t.scale=function(n){return arguments.length?(e.scale(n),r.scale(.6*n),u.scale(n),i.scale(1.5*n),t.translate(e.translate())):e.scale()},t.translate=function(n){if(!arguments.length)return e.translate();var a=e.scale(),o=n[0],c=n[1];return e.translate(n),r.translate([o-.4*a,c+.17*a]),u.translate([o-.19*a,c+.2*a]),i.translate([o+.58*a,c+.43*a]),t},t.scale(e.scale())},(Ci.geo.albers=function(){var t=29.5*zi,n=45.5*zi,e=Hu(Qr),r=e(t,n);return r.parallels=function(r){return arguments.length?e(t=r[0]*zi,n=r[1]*zi):[t*Di,n*Di]},r.rotate([98,0]).center([0,38]).scale(1e3)}).raw=Qr;var co=Uu(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Ci.geo.azimuthalEqualArea=function(){return Fu(co)}).raw=co;var lo=Uu(function(t){var n=Math.acos(t);return n&&n/Math.sin(n)},a);(Ci.geo.azimuthalEquidistant=function(){return Fu(lo)}).raw=lo,Ci.geo.bounds=tu(a),Ci.geo.centroid=function(t){fo=so=ho=go=po=0,Ci.geo.stream(t,mo);var n;return so&&Math.abs(n=Math.sqrt(ho*ho+go*go+po*po))>qi?[Math.atan2(go,ho)*Di,Math.asin(Math.max(-1,Math.min(1,po/n)))*Di]:void 0};var fo,so,ho,go,po,mo={sphere:function(){2>fo&&(fo=2,so=ho=go=po=0)},point:nu,lineStart:ru,lineEnd:uu,polygonStart:function(){2>fo&&(fo=2,so=ho=go=po=0),mo.lineStart=eu},polygonEnd:function(){mo.lineStart=ru}};Ci.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,n=Pu(-t[0]*zi,-t[1]*zi,0).invert,u=[];return e(null,null,1,{point:function(t,e){u.push(t=n(t,e)),t[0]*=Di,t[1]*=Di}}),{type:"Polygon",coordinates:[u]}}var n,e,r=[0,0],u=6;return t.origin=function(n){return arguments.length?(r=n,t):r},t.angle=function(r){return arguments.length?(e=iu((n=+r)*zi,u*zi),t):n},t.precision=function(r){return arguments.length?(e=iu(n*zi,(u=+r)*zi),t):u},t.angle(90)};var vo=ou(o,pu,mu);(Ci.geo.equirectangular=function(){return Fu(Mu).scale(250/Ti)}).raw=Mu.invert=Mu;var yo=Uu(function(t){return 1/t},Math.atan);(Ci.geo.gnomonic=function(){return Fu(yo)}).raw=yo,Ci.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return Ci.range(Math.ceil(r/c)*c,e,c).map(a).concat(Ci.range(Math.ceil(i/l)*l,u,l).map(o))}var e,r,u,i,a,o,c=22.5,l=c,f=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[a(r).concat(o(u).slice(1),a(e).reverse().slice(1),o(i).reverse().slice(1))]}},t.extent=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],i=+n[0][1],u=+n[1][1],r>e&&(n=r,r=e,e=n),i>u&&(n=i,i=u,u=n),t.precision(f)):[[r,i],[e,u]]},t.step=function(n){return arguments.length?(c=+n[0],l=+n[1],t):[c,l]},t.precision=function(n){return arguments.length?(f=+n,a=bu(i,u,f),o=xu(r,e,f),t):f},t.extent([[-180+qi,-90+qi],[180-qi,90-qi]])},Ci.geo.interpolate=function(t,n){return wu(t[0]*zi,t[1]*zi,n[0]*zi,n[1]*zi)},Ci.geo.greatArc=function(){function e(){for(var t=r||a.apply(this,arguments),n=u||o.apply(this,arguments),e=i||Ci.geo.interpolate(t,n),l=0,f=c/e.distance,s=[t];1>(l+=f);)s.push(e(l));return s.push(n),{type:"LineString",coordinates:s}}var r,u,i,a=n,o=t,c=6*zi;return e.distance=function(){return(i||Ci.geo.interpolate(r||a.apply(this,arguments),u||o.apply(this,arguments))).distance},e.source=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i=r&&u?Ci.geo.interpolate(r,u):null,e):a},e.target=function(t){return arguments.length?(o=t,u="function"==typeof t?null:t,i=r&&u?Ci.geo.interpolate(r,u):null,e):o},e.precision=function(t){return arguments.length?(c=t*zi,e):c/zi},e},Su.invert=function(t,n){return[2*Ti*t,2*Math.atan(Math.exp(2*Ti*n))-Ti/2]},(Ci.geo.mercator=function(){return Fu(Su).scale(500)}).raw=Su;var Mo=Uu(function(){return 1},Math.asin);(Ci.geo.orthographic=function(){return Fu(Mo)}).raw=Mo,Ci.geo.path=function(){function t(t){return t&&Ci.geo.stream(t,r(u.pointRadius("function"==typeof i?+i.apply(this,arguments):i))),u.result()}var n,e,r,u,i=4.5;return t.area=function(t){return bo=0,Ci.geo.stream(t,r(_o)),bo},t.centroid=function(t){return fo=ho=go=po=0,Ci.geo.stream(t,r(wo)),po?[ho/po,go/po]:void 0},t.bounds=function(t){return tu(r)(t)},t.projection=function(e){return arguments.length?(r=(n=e)?e.stream||Eu(e):a,t):n},t.context=function(n){return arguments.length?(u=null==(e=n)?new Au:new Nu(n),t):e},t.pointRadius=function(n){return arguments.length?(i="function"==typeof n?n:+n,t):i},t.projection(Ci.geo.albersUsa()).context(null)};var bo,xo,_o={point:Pn,lineStart:Pn,lineEnd:Pn,polygonStart:function(){xo=0,_o.lineStart=Tu},polygonEnd:function(){_o.lineStart=_o.lineEnd=_o.point=Pn,bo+=Math.abs(xo/2)}},wo={point:qu,lineStart:Cu,lineEnd:zu,polygonStart:function(){wo.lineStart=Du},polygonEnd:function(){wo.point=qu,wo.lineStart=Cu,wo.lineEnd=zu}};Ci.geo.area=function(t){return So=0,Ci.geo.stream(t,Ao),So};var So,ko,Eo,Ao={sphere:function(){So+=4*Ti},point:Pn,lineStart:Pn,lineEnd:Pn,polygonStart:function(){ko=1,Eo=0,Ao.lineStart=Lu},polygonEnd:function(){var t=2*Math.atan2(Eo,ko);So+=0>t?4*Ti+t:t,Ao.lineStart=Ao.lineEnd=Ao.point=Pn}};Ci.geo.projection=Fu,Ci.geo.projectionMutator=Hu;var No=Uu(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Ci.geo.stereographic=function(){return Fu(No)}).raw=No,Ci.geom={},Ci.geom.hull=function(t){if(3>t.length)return[];var n,e,r,u,i,a,o,c,l,f,s=t.length,h=s-1,g=[],p=[],d=0;for(n=1;s>n;++n)t[n][1]<t[d][1]?d=n:t[n][1]==t[d][1]&&(d=t[n][0]<t[d][0]?n:d);for(n=0;s>n;++n)n!==d&&(u=t[n][1]-t[d][1],r=t[n][0]-t[d][0],g.push({angle:Math.atan2(u,r),index:n}));for(g.sort(function(t,n){return t.angle-n.angle}),l=g[0].angle,c=g[0].index,o=0,n=1;h>n;++n)e=g[n].index,l==g[n].angle?(r=t[c][0]-t[d][0],u=t[c][1]-t[d][1],i=t[e][0]-t[d][0],a=t[e][1]-t[d][1],r*r+u*u>=i*i+a*a?g[n].index=-1:(g[o].index=-1,l=g[n].angle,o=n,c=e)):(l=g[n].angle,o=n,c=e);for(p.push(d),n=0,e=0;2>n;++e)-1!==g[e].index&&(p.push(g[e].index),n++);for(f=p.length;h>e;++e)if(-1!==g[e].index){for(;!Iu(p[f-2],p[f-1],g[e].index,t);)--f;p[f++]=g[e].index}var m=[];for(n=0;f>n;++n)m.push(t[p[n]]);return m},Ci.geom.polygon=function(t){return t.area=function(){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];e>++n;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return.5*r},t.centroid=function(n){var e,r,u=-1,i=t.length,a=0,o=0,c=t[i-1];for(arguments.length||(n=-1/(6*t.area()));i>++u;)e=c,c=t[u],r=e[0]*c[1]-c[0]*e[1],a+=(e[0]+c[0])*r,o+=(e[1]+c[1])*r;return[a*n,o*n]},t.clip=function(n){for(var e,r,u,i,a,o,c=-1,l=t.length,f=t[l-1];l>++c;){for(e=n.slice(),n.length=0,i=t[c],a=e[(u=e.length)-1],r=-1;u>++r;)o=e[r],Vu(o,f,i)?(Vu(a,f,i)||n.push(Zu(a,o,f,i)),n.push(o)):Vu(a,f,i)&&n.push(Zu(a,o,f,i)),a=o;f=i}return n},t},Ci.geom.voronoi=function(t){var n=t.map(function(){return[]}),e=1e6;return Xu(t,function(t){var r,u,i,a,o,c;1===t.a&&t.b>=0?(r=t.ep.r,u=t.ep.l):(r=t.ep.l,u=t.ep.r),1===t.a?(o=r?r.y:-e,i=t.c-t.b*o,c=u?u.y:e,a=t.c-t.b*c):(i=r?r.x:-e,o=t.c-t.a*i,a=u?u.x:e,c=t.c-t.a*a);var l=[i,o],f=[a,c];n[t.region.l.index].push(l,f),n[t.region.r.index].push(l,f)}),n=n.map(function(n,e){var r=t[e][0],u=t[e][1],i=n.map(function(t){return Math.atan2(t[0]-r,t[1]-u)}),a=Ci.range(n.length).sort(function(t,n){return i[t]-i[n]});return a.filter(function(t,n){return!n||i[t]-i[a[n-1]]>qi}).map(function(t){return n[t]})}),n.forEach(function(n,r){var u=n.length;if(!u)return n.push([-e,-e],[-e,e],[e,e],[e,-e]);if(!(u>2)){var i=t[r],a=n[0],o=n[1],c=i[0],l=i[1],f=a[0],s=a[1],h=o[0],g=o[1],p=Math.abs(h-f),d=g-s;if(qi>Math.abs(d)){var m=s>l?-e:e;n.push([-e,m],[e,m])}else if(qi>p){var v=f>c?-e:e;n.push([v,-e],[v,e])}else{var m=(f-c)*(g-s)>(h-f)*(s-l)?e:-e,y=Math.abs(d)-p;qi>Math.abs(y)?n.push([0>d?m:-m,m]):(y>0&&(m*=-1),n.push([-e,m],[e,m]))}}}),n};var To={l:"r",r:"l"};Ci.geom.delaunay=function(t){var n=t.map(function(){return[]}),e=[];return Xu(t,function(e){n[e.region.l.index].push(t[e.region.r.index])}),n.forEach(function(n,r){var u=t[r],i=u[0],a=u[1];n.forEach(function(t){t.angle=Math.atan2(t[0]-i,t[1]-a)}),n.sort(function(t,n){return t.angle-n.angle});for(var o=0,c=n.length-1;c>o;o++)e.push([u,n[o],n[o+1]])}),e},Ci.geom.quadtree=function(t,n,e,r,u){function i(t,n,e,r,u,i){if(!isNaN(n.x)&&!isNaN(n.y))if(t.leaf){var o=t.point;o?.01>Math.abs(o.x-n.x)+Math.abs(o.y-n.y)?a(t,n,e,r,u,i):(t.point=null,a(t,o,e,r,u,i),a(t,n,e,r,u,i)):t.point=n}else a(t,n,e,r,u,i)}function a(t,n,e,r,u,a){var o=.5*(e+u),c=.5*(r+a),l=n.x>=o,f=n.y>=c,s=(f<<1)+l;t.leaf=!1,t=t.nodes[s]||(t.nodes[s]=Bu()),l?e=o:u=o,f?r=c:a=c,i(t,n,e,r,u,a)}var o,c=-1,l=t.length;if(5>arguments.length)if(3===arguments.length)u=e,r=n,e=n=0;else for(n=e=1/0,r=u=-1/0;l>++c;)o=t[c],n>o.x&&(n=o.x),e>o.y&&(e=o.y),o.x>r&&(r=o.x),o.y>u&&(u=o.y);var f=r-n,s=u-e;f>s?u=e+f:r=n+s;var h=Bu();return h.add=function(t){i(h,t,n,e,r,u)},h.visit=function(t){$u(t,h,n,e,r,u)},t.forEach(h.add),h},Ci.time={};var qo=Date,Co=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Ju.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){zo.setUTCDate.apply(this._,arguments)},setDay:function(){zo.setUTCDay.apply(this._,arguments)},setFullYear:function(){zo.setUTCFullYear.apply(this._,arguments)},setHours:function(){zo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){zo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){zo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){zo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){zo.setUTCSeconds.apply(this._,arguments)},setTime:function(){zo.setTime.apply(this._,arguments)}};var zo=Date.prototype,Do="%a %b %e %X %Y",Lo="%m/%d/%Y",Fo="%H:%M:%S",Ho=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],jo=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Po=["January","February","March","April","May","June","July","August","September","October","November","December"],Ro=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Ci.time.format=function(t){function n(n){for(var r,u,i,a=[],o=-1,c=0;e>++o;)37===t.charCodeAt(o)&&(a.push(t.substring(c,o)),null!=(u=Xo[r=t.charAt(++o)])&&(r=t.charAt(++o)),(i=Bo[r])&&(r=i(n,null==u?"e"===r?" ":"0":u)),a.push(r),c=o+1);return a.push(t.substring(c,o)),a.join("")}var e=t.length;return n.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=Gu(e,t,n,0);if(r!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var u=new qo;return u.setFullYear(e.y,e.m,e.d),u.setHours(e.H,e.M,e.S,e.L),u},n.toString=function(){return t},n};var Oo=Ku(Ho),Yo=Ku(jo),Uo=Ku(Po),Io=Wu(Po),Vo=Ku(Ro),Zo=Wu(Ro),Xo={"-":"",_:" ",0:"0"},Bo={a:function(t){return jo[t.getDay()]},A:function(t){return Ho[t.getDay()]},b:function(t){return Ro[t.getMonth()]},B:function(t){return Po[t.getMonth()]},c:Ci.time.format(Do),d:function(t,n){return Qu(t.getDate(),n,2)},e:function(t,n){return Qu(t.getDate(),n,2)},H:function(t,n){return Qu(t.getHours(),n,2)},I:function(t,n){return Qu(t.getHours()%12||12,n,2)},j:function(t,n){return Qu(1+Ci.time.dayOfYear(t),n,3)},L:function(t,n){return Qu(t.getMilliseconds(),n,3)},m:function(t,n){return Qu(t.getMonth()+1,n,2)},M:function(t,n){return Qu(t.getMinutes(),n,2)},p:function(t){return t.getHours()>=12?"PM":"AM"},S:function(t,n){return Qu(t.getSeconds(),n,2)},U:function(t,n){return Qu(Ci.time.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Qu(Ci.time.mondayOfYear(t),n,2)},x:Ci.time.format(Lo),X:Ci.time.format(Fo),y:function(t,n){return Qu(t.getFullYear()%100,n,2)},Y:function(t,n){return Qu(t.getFullYear()%1e4,n,4)},Z:vi,"%":function(){return"%"}},$o={a:ti,A:ni,b:ei,B:ri,c:ui,d:si,e:si,H:hi,I:hi,L:di,m:fi,M:gi,p:mi,S:pi,x:ii,X:ai,y:ci,Y:oi},Jo=/^\s*\d+/,Go=Ci.map({am:0,pm:1});Ci.time.format.utc=function(t){function n(t){try{qo=Ju;var n=new qo;return n._=t,e(n)}finally{qo=Date}}var e=Ci.time.format(t);return n.parse=function(t){try{qo=Ju;var n=e.parse(t);return n&&n._}finally{qo=Date}},n.toString=e.toString,n};var Ko=Ci.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");Ci.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?yi:Ko,yi.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},yi.toString=Ko.toString,Ci.time.second=Mi(function(t){return new qo(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))},function(t){return t.getSeconds()}),Ci.time.seconds=Ci.time.second.range,Ci.time.seconds.utc=Ci.time.second.utc.range,Ci.time.minute=Mi(function(t){return new qo(6e4*Math.floor(t/6e4))},function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))},function(t){return t.getMinutes()}),Ci.time.minutes=Ci.time.minute.range,Ci.time.minutes.utc=Ci.time.minute.utc.range,Ci.time.hour=Mi(function(t){var n=t.getTimezoneOffset()/60;return new qo(36e5*(Math.floor(t/36e5-n)+n))},function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))},function(t){return t.getHours()}),Ci.time.hours=Ci.time.hour.range,Ci.time.hours.utc=Ci.time.hour.utc.range,Ci.time.day=Mi(function(t){var n=new qo(1970,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n},function(t,n){t.setDate(t.getDate()+n)},function(t){return t.getDate()-1}),Ci.time.days=Ci.time.day.range,Ci.time.days.utc=Ci.time.day.utc.range,Ci.time.dayOfYear=function(t){var n=Ci.time.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},Co.forEach(function(t,n){t=t.toLowerCase(),n=7-n;var e=Ci.time[t]=Mi(function(t){return(t=Ci.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t},function(t,n){t.setDate(t.getDate()+7*Math.floor(n))},function(t){var e=Ci.time.year(t).getDay();return Math.floor((Ci.time.dayOfYear(t)+(e+n)%7)/7)-(e!==n)});Ci.time[t+"s"]=e.range,Ci.time[t+"s"].utc=e.utc.range,Ci.time[t+"OfYear"]=function(t){var e=Ci.time.year(t).getDay();return Math.floor((Ci.time.dayOfYear(t)+(e+n)%7)/7)}}),Ci.time.week=Ci.time.sunday,Ci.time.weeks=Ci.time.sunday.range,Ci.time.weeks.utc=Ci.time.sunday.utc.range,Ci.time.weekOfYear=Ci.time.sundayOfYear,Ci.time.month=Mi(function(t){return t=Ci.time.day(t),t.setDate(1),t},function(t,n){t.setMonth(t.getMonth()+n)},function(t){return t.getMonth()}),Ci.time.months=Ci.time.month.range,Ci.time.months.utc=Ci.time.month.utc.range,Ci.time.year=Mi(function(t){return t=Ci.time.day(t),t.setMonth(0,1),t},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t){return t.getFullYear()}),Ci.time.years=Ci.time.year.range,Ci.time.years.utc=Ci.time.year.utc.range;var Wo=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Qo=[[Ci.time.second,1],[Ci.time.second,5],[Ci.time.second,15],[Ci.time.second,30],[Ci.time.minute,1],[Ci.time.minute,5],[Ci.time.minute,15],[Ci.time.minute,30],[Ci.time.hour,1],[Ci.time.hour,3],[Ci.time.hour,6],[Ci.time.hour,12],[Ci.time.day,1],[Ci.time.day,2],[Ci.time.week,1],[Ci.time.month,1],[Ci.time.month,3],[Ci.time.year,1]],tc=[[Ci.time.format("%Y"),o],[Ci.time.format("%B"),function(t){return t.getMonth()}],[Ci.time.format("%b %d"),function(t){return 1!=t.getDate()}],[Ci.time.format("%a %d"),function(t){return t.getDay()&&1!=t.getDate()}],[Ci.time.format("%I %p"),function(t){return t.getHours()}],[Ci.time.format("%I:%M"),function(t){return t.getMinutes()}],[Ci.time.format(":%S"),function(t){return t.getSeconds()}],[Ci.time.format(".%L"),function(t){return t.getMilliseconds()}]],nc=Ci.scale.linear(),ec=Si(tc);Qo.year=function(t,n){return nc.domain(t.map(Ei)).ticks(n).map(ki)},Ci.time.scale=function(){return xi(Ci.scale.linear(),Qo,ec)};var rc=Qo.map(function(t){return[t[0].utc,t[1]]}),uc=[[Ci.time.format.utc("%Y"),o],[Ci.time.format.utc("%B"),function(t){return t.getUTCMonth()}],[Ci.time.format.utc("%b %d"),function(t){return 1!=t.getUTCDate()}],[Ci.time.format.utc("%a %d"),function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],[Ci.time.format.utc("%I %p"),function(t){return t.getUTCHours()}],[Ci.time.format.utc("%I:%M"),function(t){return t.getUTCMinutes()}],[Ci.time.format.utc(":%S"),function(t){return t.getUTCSeconds()}],[Ci.time.format.utc(".%L"),function(t){return t.getUTCMilliseconds()}]],ic=Si(uc);return rc.year=function(t,n){return nc.domain(t.map(Ni)).ticks(n).map(Ai)},Ci.time.scale.utc=function(){return xi(Ci.scale.linear(),rc,ic)},Ci}();
\ No newline at end of file
diff --git a/web/ons-demo/d3/topojson.v0.min.js b/web/ons-demo/d3/topojson.v0.min.js
new file mode 100644
index 0000000..c6aa3cd
--- /dev/null
+++ b/web/ons-demo/d3/topojson.v0.min.js
@@ -0,0 +1 @@
+topojson=function(){function t(t,e){function n(e){var n=t.arcs[e],r=n[0],o=[0,0];return n.forEach(function(t){o[0]+=t[0],o[1]+=t[1]}),[r,o]}var r={},o={},a={};e.forEach(function(t){var e=n(t);(r[e[0]]||(r[e[0]]=[])).push(t),(r[e[1]]||(r[e[1]]=[])).push(~t)}),e.forEach(function(t){var e,r,i=n(t),c=i[0],s=i[1];if(e=a[c])if(delete a[e.end],e.push(t),e.end=s,r=o[s]){delete o[r.start];var u=r===e?e:e.concat(r);o[u.start=e.start]=a[u.end=r.end]=u}else if(r=a[s]){delete o[r.start],delete a[r.end];var u=e.concat(r.map(function(t){return~t}).reverse());o[u.start=e.start]=a[u.end=r.start]=u}else o[e.start]=a[e.end]=e;else if(e=o[s])if(delete o[e.start],e.unshift(t),e.start=c,r=a[c]){delete a[r.end];var f=r===e?e:r.concat(e);o[f.start=r.start]=a[f.end=e.end]=f}else if(r=o[c]){delete o[r.start],delete a[r.end];var f=r.map(function(t){return~t}).reverse().concat(e);o[f.start=r.end]=a[f.end=e.end]=f}else o[e.start]=a[e.end]=e;else if(e=o[c])if(delete o[e.start],e.unshift(~t),e.start=s,r=a[s]){delete a[r.end];var f=r===e?e:r.concat(e);o[f.start=r.start]=a[f.end=e.end]=f}else if(r=o[s]){delete o[r.start],delete a[r.end];var f=r.map(function(t){return~t}).reverse().concat(e);o[f.start=r.end]=a[f.end=e.end]=f}else o[e.start]=a[e.end]=e;else if(e=a[s])if(delete a[e.end],e.push(~t),e.end=c,r=a[c]){delete o[r.start];var u=r===e?e:e.concat(r);o[u.start=e.start]=a[u.end=r.end]=u}else if(r=o[c]){delete o[r.start],delete a[r.end];var u=e.concat(r.map(function(t){return~t}).reverse());o[u.start=e.start]=a[u.end=r.start]=u}else o[e.start]=a[e.end]=e;else e=[t],o[e.start=c]=a[e.end=s]=e});var i=[];for(var c in a)i.push(a[c]);return i}function e(e,r,o){function a(t){0>t&&(t=~t),(l[t]||(l[t]=[])).push(f)}function i(t){t.forEach(a)}function c(t){t.forEach(i)}function s(t){"GeometryCollection"===t.type?t.geometries.forEach(s):t.type in d&&(f=t,d[t.type](t.arcs))}var u=[];if(arguments.length>1){var f,l=[],d={LineString:i,MultiLineString:c,Polygon:c,MultiPolygon:function(t){t.forEach(c)}};s(r),l.forEach(3>arguments.length?function(t,e){u.push([e])}:function(t,e){o(t[0],t[t.length-1])&&u.push([e])})}else for(var p=0,h=e.arcs.length;h>p;++p)u.push([p]);return n(e,{type:"MultiLineString",arcs:t(e,u)})}function n(t,e){function n(t,e){e.length&&e.pop();for(var n,o=h[0>t?~t:t],a=0,i=o.length,c=0,s=0;i>a;++a)e.push([(c+=(n=o[a])[0])*f+d,(s+=n[1])*l+p]);0>t&&r(e,i)}function o(t){return[t[0]*f+d,t[1]*l+p]}function a(t){for(var e=[],r=0,o=t.length;o>r;++r)n(t[r],e);return 2>e.length&&e.push(e[0]),e}function i(t){for(var e=a(t);4>e.length;)e.push(e[0]);return e}function c(t){return t.map(i)}function s(t){var e=t.type,n="GeometryCollection"===e?{type:e,geometries:t.geometries.map(s)}:e in v?{type:e,coordinates:v[e](t)}:{type:null};return"id"in t&&(n.id=t.id),"properties"in t&&(n.properties=t.properties),n}var u=t.transform,f=u.scale[0],l=u.scale[1],d=u.translate[0],p=u.translate[1],h=t.arcs,v={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return a(t.arcs)},MultiLineString:function(t){return t.arcs.map(a)},Polygon:function(t){return c(t.arcs)},MultiPolygon:function(t){return t.arcs.map(c)}};return s(e)}function r(t,e){for(var n,r=t.length,o=r-e;--r>o;)n=t[o],t[o++]=t[r],t[r]=n}function o(t,e){for(var n=0,r=t.length;r>n;){var o=n+r>>>1;e>t[o]?n=o+1:r=o}return n}function a(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var n=a[t]||(a[t]=[]);n[e]||(n.forEach(function(t){var n,r;r=o(n=i[e],t),n[r]!==t&&n.splice(r,0,t),r=o(n=i[t],e),n[r]!==e&&n.splice(r,0,e)}),n[e]=e)})}function n(t,n){t.forEach(function(t){e(t,n)})}function r(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){r(t,e)}):t.type in c&&c[t.type](t.arcs,e)}var a=[],i=t.map(function(){return[]}),c={LineString:e,MultiLineString:n,Polygon:n,MultiPolygon:function(t,e){t.forEach(function(t){n(t,e)})}};return t.forEach(r),i}return{version:"0.0.32",mesh:e,object:n,neighbors:a}}();
\ No newline at end of file
diff --git a/web/ons-demo/data/configuration.json b/web/ons-demo/data/configuration.json
new file mode 100644
index 0000000..91490e4
--- /dev/null
+++ b/web/ons-demo/data/configuration.json
@@ -0,0 +1,79 @@
+{
+ "core": [
+ "00:00:00:08:a2:08:f9:01",
+ "00:00:00:00:ba:5e:ba:11",
+ "00:00:20:4e:7f:51:8a:35",
+ "00:00:00:00:00:00:ba:12",
+ "00:00:00:00:ba:5e:ba:13",
+ "00:00:00:16:97:08:9a:46"
+ ],
+ "aggregation": [
+ "00:00:00:00:00:00:01:01",
+ "00:00:00:00:00:00:02:01",
+ "00:00:00:00:00:00:03:01",
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01",
+ "00:00:00:00:00:00:06:01",
+ "00:00:00:00:00:00:07:01",
+ "00:00:00:00:00:00:08:01"
+ ],
+ "association": {
+ "00:00:00:08:a2:08:f9:01": [
+ "00:00:00:00:00:00:03:01"
+ ],
+ "00:00:00:00:ba:5e:ba:11": [
+ "00:00:00:00:00:00:02:01"
+ ],
+ "00:00:20:4e:7f:51:8a:35": [
+ "00:00:00:00:00:00:07:01"
+ ],
+ "00:00:00:00:00:00:ba:12": [
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01"
+ ],
+ "00:00:00:00:ba:5e:ba:13": [
+ "00:00:00:00:00:00:06:01"
+ ],
+ "00:00:00:16:97:08:9a:46": [
+ "00:00:00:00:00:00:08:01"
+ ]
+ },
+ "geo": {
+ "00:00:00:08:a2:08:f9:01": {
+ "lat": 41.891033,
+ "lng": -87.628326,
+ "label": "CHI",
+ "fanOutAngle": 180
+ },
+ "00:00:00:00:ba:5e:ba:11": {
+ "lat": 47.611024,
+ "lng": -122.33242,
+ "label": "SEA",
+ "fanOutAngle": 270
+ },
+ "00:00:20:4e:7f:51:8a:35": {
+ "lat": 33.758599,
+ "lng": -84.387360,
+ "label": "ATL",
+ "fanOutAngle": 0
+ },
+ "00:00:00:00:00:00:ba:12": {
+ "lat": 41.225925,
+ "lng": -74.00528,
+ "label": "NYC",
+ "fanOutAngle": 150
+ },
+ "00:00:00:00:ba:5e:ba:13": {
+ "lat": 37.901187,
+ "lng": -76.037163,
+ "label": "DC",
+ "fanOutAngle": 45
+ },
+ "00:00:00:16:97:08:9a:46": {
+ "lat": 34.102708,
+ "lng": -118.238983,
+ "label": "LA",
+ "fanOutAngle": 315
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/ons-demo/data/configuration.json.dev b/web/ons-demo/data/configuration.json.dev
new file mode 100644
index 0000000..829fa11
--- /dev/null
+++ b/web/ons-demo/data/configuration.json.dev
@@ -0,0 +1,78 @@
+{
+ "core": [
+ "00:00:00:00:00:00:01:01",
+ "00:00:00:00:00:00:01:02",
+ "00:00:00:00:00:00:01:03",
+ "00:00:00:00:00:00:01:04",
+ "00:00:00:00:00:00:01:05",
+ "00:00:00:00:00:00:01:06"
+ ],
+ "aggregation": [
+ "00:00:00:00:00:00:02:01",
+ "00:00:00:00:00:00:03:01",
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01",
+ "00:00:00:00:00:00:06:01",
+ "00:00:00:00:00:00:07:01",
+ "00:00:00:00:00:00:08:01"
+ ],
+ "association": {
+ "00:00:00:00:00:00:01:01": [
+ "00:00:00:00:00:00:08:01"
+ ],
+ "00:00:00:00:00:00:01:02": [
+ "00:00:00:00:00:00:02:01"
+ ],
+ "00:00:00:00:00:00:01:03": [
+ "00:00:00:00:00:00:03:01"
+ ],
+ "00:00:00:00:00:00:01:04": [
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01"
+ ],
+ "00:00:00:00:00:00:01:05": [
+ "00:00:00:00:00:00:06:01"
+ ],
+ "00:00:00:00:00:00:01:06": [
+ "00:00:00:00:00:00:07:01"
+ ]
+ },
+ "geo": {
+ "00:00:00:00:00:00:01:03": {
+ "lat": 33.758599,
+ "lng": -84.387360,
+ "label": "ATL",
+ "fanOutAngle": 0
+ },
+ "00:00:00:00:00:00:01:02": {
+ "lat": 37.901187,
+ "lng": -76.037163,
+ "label": "DC",
+ "fanOutAngle": 45
+ },
+ "00:00:00:00:00:00:01:06": {
+ "lat": 41.891033,
+ "lng": -87.628326,
+ "label": "CHI",
+ "fanOutAngle": 180
+ },
+ "00:00:00:00:00:00:01:04": {
+ "lat": 34.102708,
+ "lng": -118.238983,
+ "label": "LA",
+ "fanOutAngle": 315
+ },
+ "00:00:00:00:00:00:01:05": {
+ "lat": 47.611024,
+ "lng": -122.33242,
+ "label": "SEA",
+ "fanOutAngle": 270
+ },
+ "00:00:00:00:00:00:01:01": {
+ "lat": 41.225925,
+ "lng": -74.00528,
+ "label": "NYC",
+ "fanOutAngle": 135
+ }
+ }
+}
diff --git a/web/ons-demo/data/configuration.json.devA b/web/ons-demo/data/configuration.json.devA
new file mode 100644
index 0000000..f8a6e63
--- /dev/null
+++ b/web/ons-demo/data/configuration.json.devA
@@ -0,0 +1,78 @@
+{
+ "core": [
+ "00:00:00:08:a2:08:f9:01",
+ "00:00:00:00:ba:5e:ba:11",
+ "00:00:20:4e:7f:51:8a:35",
+ "00:00:00:00:00:00:ba:12",
+ "00:00:00:00:ba:5e:ba:13",
+ "00:00:00:16:97:08:9a:46"
+ ],
+ "aggregation": [
+ "00:00:00:00:00:00:02:01",
+ "00:00:00:00:00:00:03:01",
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01",
+ "00:00:00:00:00:00:06:01",
+ "00:00:00:00:00:00:07:01",
+ "00:00:00:00:00:00:08:01"
+ ],
+ "association": {
+ "00:00:20:4e:7f:51:8a:35": [
+ "00:00:00:00:00:00:07:01"
+ ],
+ "00:00:00:00:ba:5e:ba:13": [
+ "00:00:00:00:00:00:06:01"
+ ],
+ "00:00:00:08:a2:08:f9:01": [
+ "00:00:00:00:00:00:03:01"
+ ],
+ "00:00:00:00:00:00:ba:12": [
+ "00:00:00:00:00:00:04:01",
+ "00:00:00:00:00:00:05:01"
+ ],
+ "00:00:00:00:ba:5e:ba:11": [
+ "00:00:00:00:00:00:02:01"
+ ],
+ "00:00:00:16:97:08:9a:46": [
+ "00:00:00:00:00:00:08:01"
+ ]
+ },
+ "geo": {
+ "00:00:20:4e:7f:51:8a:35": {
+ "lat": 41.891033,
+ "lng": -87.628326,
+ "label": "CHI",
+ "fanOutAngle": 180
+ },
+ "00:00:00:00:ba:5e:ba:13": {
+ "lat": 47.611024,
+ "lng": -122.33242,
+ "label": "SEA",
+ "fanOutAngle": 270
+ },
+ "00:00:00:08:a2:08:f9:01": {
+ "lat": 33.758599,
+ "lng": -84.387360,
+ "label": "ATL",
+ "fanOutAngle": 5
+ },
+ "00:00:00:16:97:08:9a:46": {
+ "lat": 41.225925,
+ "lng": -74.00528,
+ "label": "NYC",
+ "fanOutAngle": 150
+ },
+ "00:00:00:00:ba:5e:ba:11": {
+ "lat": 37.901187,
+ "lng": -76.037163,
+ "label": "DC",
+ "fanOutAngle": 45
+ },
+ "00:00:00:00:00:00:ba:12": {
+ "lat": 34.102708,
+ "lng": -118.238983,
+ "label": "LA",
+ "fanOutAngle": 315
+ }
+ }
+}
diff --git a/web/ons-demo/data/controllers.json b/web/ons-demo/data/controllers.json
new file mode 100644
index 0000000..db2f5ad
--- /dev/null
+++ b/web/ons-demo/data/controllers.json
@@ -0,0 +1,10 @@
+[
+ "onosgui1",
+ "onosgui2",
+ "onosgui3",
+ "onosgui4",
+ "onosgui5",
+ "onosgui6",
+ "onosgui7",
+ "onosgui8"
+]
\ No newline at end of file
diff --git a/web/ons-demo/data/controllers.json.dev b/web/ons-demo/data/controllers.json.dev
new file mode 100644
index 0000000..b936d96
--- /dev/null
+++ b/web/ons-demo/data/controllers.json.dev
@@ -0,0 +1,10 @@
+[
+ "onosdev1",
+ "onosdev2",
+ "onosdev3",
+ "onosdev4",
+ "onosdev5",
+ "onosdev6",
+ "onosdev7",
+ "onosdev8"
+]
diff --git a/web/ons-demo/data/wm_core_topology_links_json.json b/web/ons-demo/data/wm_core_topology_links_json.json
new file mode 100644
index 0000000..0a60d71
--- /dev/null
+++ b/web/ons-demo/data/wm_core_topology_links_json.json
@@ -0,0 +1 @@
+[{"src-switch":"00:00:00:00:00:00:02:04","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:06:01","src-port":12,"dst-switch":"00:00:00:00:00:00:06:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":22,"dst-switch":"00:00:00:00:00:00:06:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":20,"dst-switch":"00:00:00:00:00:00:06:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":6,"dst-switch":"00:00:00:00:00:00:06:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":13,"dst-switch":"00:00:00:00:00:00:06:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":19,"dst-switch":"00:00:00:00:00:00:06:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":5,"dst-switch":"00:00:00:00:00:00:06:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":18,"dst-switch":"00:00:00:00:00:00:06:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":25,"dst-switch":"00:00:00:00:00:00:06:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":7,"dst-switch":"00:00:00:00:00:00:06:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":26,"dst-switch":"00:00:00:00:ba:5e:ba:13","dst-port":4},{"src-switch":"00:00:00:00:00:00:06:01","src-port":8,"dst-switch":"00:00:00:00:00:00:06:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":17,"dst-switch":"00:00:00:00:00:00:06:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":2,"dst-switch":"00:00:00:00:00:00:06:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":9,"dst-switch":"00:00:00:00:00:00:06:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":10,"dst-switch":"00:00:00:00:00:00:06:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":23,"dst-switch":"00:00:00:00:00:00:06:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":16,"dst-switch":"00:00:00:00:00:00:06:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":15,"dst-switch":"00:00:00:00:00:00:06:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":24,"dst-switch":"00:00:00:00:00:00:06:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":14,"dst-switch":"00:00:00:00:00:00:06:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":21,"dst-switch":"00:00:00:00:00:00:06:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":3,"dst-switch":"00:00:00:00:00:00:06:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":11,"dst-switch":"00:00:00:00:00:00:06:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:01","src-port":4,"dst-switch":"00:00:00:00:00:00:06:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:04:18","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:03:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:06:09","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:04:04","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:02:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:02:1d","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":29},{"src-switch":"00:00:00:00:00:00:04:08","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:02:06","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:02:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:02:10","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:06:07","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:07:12","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:04:10","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:06:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:04:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:06:16","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:02:1f","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":31},{"src-switch":"00:00:00:00:00:00:02:2e","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":46},{"src-switch":"00:00:00:00:00:00:02:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:07:03","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:07:05","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:04:09","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:07:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:06:02","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:06:04","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:04:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:07:01","src-port":12,"dst-switch":"00:00:00:00:00:00:07:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":22,"dst-switch":"00:00:00:00:00:00:07:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":20,"dst-switch":"00:00:00:00:00:00:07:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":6,"dst-switch":"00:00:00:00:00:00:07:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":13,"dst-switch":"00:00:00:00:00:00:07:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":19,"dst-switch":"00:00:00:00:00:00:07:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":5,"dst-switch":"00:00:00:00:00:00:07:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":18,"dst-switch":"00:00:00:00:00:00:07:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":25,"dst-switch":"00:00:00:00:00:00:07:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":7,"dst-switch":"00:00:00:00:00:00:07:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":26,"dst-switch":"00:00:20:4e:7f:51:8a:35","dst-port":5},{"src-switch":"00:00:00:00:00:00:07:01","src-port":8,"dst-switch":"00:00:00:00:00:00:07:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":17,"dst-switch":"00:00:00:00:00:00:07:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":2,"dst-switch":"00:00:00:00:00:00:07:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":9,"dst-switch":"00:00:00:00:00:00:07:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":10,"dst-switch":"00:00:00:00:00:00:07:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":23,"dst-switch":"00:00:00:00:00:00:07:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":16,"dst-switch":"00:00:00:00:00:00:07:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":15,"dst-switch":"00:00:00:00:00:00:07:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":24,"dst-switch":"00:00:00:00:00:00:07:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":14,"dst-switch":"00:00:00:00:00:00:07:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":21,"dst-switch":"00:00:00:00:00:00:07:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":3,"dst-switch":"00:00:00:00:00:00:07:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":11,"dst-switch":"00:00:00:00:00:00:07:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:01","src-port":4,"dst-switch":"00:00:00:00:00:00:07:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:06:14","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:03:13","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:07:14","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:02:25","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":37},{"src-switch":"00:00:00:00:00:00:07:15","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:06:10","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:07:08","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:06:18","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:06:03","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:03:14","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:02:13","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:03:16","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:03:06","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:04:13","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:06:15","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:08:15","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:05:05","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:03:01","src-port":12,"dst-switch":"00:00:00:00:00:00:03:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":22,"dst-switch":"00:00:00:00:00:00:03:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":20,"dst-switch":"00:00:00:00:00:00:03:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":6,"dst-switch":"00:00:00:00:00:00:03:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":13,"dst-switch":"00:00:00:00:00:00:03:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":19,"dst-switch":"00:00:00:00:00:00:03:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":5,"dst-switch":"00:00:00:00:00:00:03:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":18,"dst-switch":"00:00:00:00:00:00:03:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":25,"dst-switch":"00:00:00:00:00:00:03:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":7,"dst-switch":"00:00:00:00:00:00:03:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":26,"dst-switch":"00:00:00:08:a2:08:f9:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:03:01","src-port":8,"dst-switch":"00:00:00:00:00:00:03:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":17,"dst-switch":"00:00:00:00:00:00:03:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":2,"dst-switch":"00:00:00:00:00:00:03:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":9,"dst-switch":"00:00:00:00:00:00:03:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":10,"dst-switch":"00:00:00:00:00:00:03:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":23,"dst-switch":"00:00:00:00:00:00:03:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":16,"dst-switch":"00:00:00:00:00:00:03:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":15,"dst-switch":"00:00:00:00:00:00:03:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":24,"dst-switch":"00:00:00:00:00:00:03:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":14,"dst-switch":"00:00:00:00:00:00:03:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":21,"dst-switch":"00:00:00:00:00:00:03:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":3,"dst-switch":"00:00:00:00:00:00:03:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":11,"dst-switch":"00:00:00:00:00:00:03:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:01","src-port":4,"dst-switch":"00:00:00:00:00:00:03:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:03:17","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:07:07","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:03:04","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:06:05","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:05:16","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:07:18","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:07:16","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:06:08","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:08:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:03:19","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:05:11","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:07:17","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:08:09","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:06:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:05:02","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:14","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:05:17","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:06:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:08:02","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:17","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:02:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:05:07","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:08:13","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:08:16","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:03:11","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:07:06","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:05:10","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:02:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:03:18","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:07:13","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:08:07","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:05:14","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:03:09","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:08:10","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:05:09","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:08:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:03:15","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:05:04","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:08:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:06:06","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:08:12","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:06:19","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:03:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:08:05","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:03:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:06:13","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:03:08","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:02:12","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:05:06","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:06:11","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:07:09","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":9},{"src-switch":"00:00:00:00:00:00:05:08","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:07:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:03:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:06:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:04:14","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":20},{"src-switch":"00:00:00:00:00:00:05:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:03:07","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:06:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:05:13","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":19},{"src-switch":"00:00:00:00:00:00:03:05","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:07:10","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:03:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:05:03","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:05:0f","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":15},{"src-switch":"00:00:00:00:00:00:03:02","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:02","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:03:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:04:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":12},{"src-switch":"00:00:00:00:00:00:08:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:04:05","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":5},{"src-switch":"00:00:00:00:00:00:05:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:03:03","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:05:15","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:03:10","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":16},{"src-switch":"00:00:00:00:00:00:04:06","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:05:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:04:12","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:04:17","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:06:17","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":23},{"src-switch":"00:00:00:00:00:00:04:07","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":7},{"src-switch":"00:00:00:00:00:00:08:06","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":6},{"src-switch":"00:00:00:00:00:00:07:11","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:08:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:04:15","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":21},{"src-switch":"00:00:00:00:00:00:05:12","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:05:01","src-port":12,"dst-switch":"00:00:00:00:00:00:05:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":22,"dst-switch":"00:00:00:00:00:00:05:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":20,"dst-switch":"00:00:00:00:00:00:05:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":6,"dst-switch":"00:00:00:00:00:00:05:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":13,"dst-switch":"00:00:00:00:00:00:05:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":19,"dst-switch":"00:00:00:00:00:00:05:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":5,"dst-switch":"00:00:00:00:00:00:05:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":18,"dst-switch":"00:00:00:00:00:00:05:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":25,"dst-switch":"00:00:00:00:00:00:05:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":7,"dst-switch":"00:00:00:00:00:00:05:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":26,"dst-switch":"00:00:00:00:00:00:ba:12","dst-port":5},{"src-switch":"00:00:00:00:00:00:05:01","src-port":8,"dst-switch":"00:00:00:00:00:00:05:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":17,"dst-switch":"00:00:00:00:00:00:05:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":2,"dst-switch":"00:00:00:00:00:00:05:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":9,"dst-switch":"00:00:00:00:00:00:05:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":10,"dst-switch":"00:00:00:00:00:00:05:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":23,"dst-switch":"00:00:00:00:00:00:05:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":16,"dst-switch":"00:00:00:00:00:00:05:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":15,"dst-switch":"00:00:00:00:00:00:05:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":24,"dst-switch":"00:00:00:00:00:00:05:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":14,"dst-switch":"00:00:00:00:00:00:05:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":21,"dst-switch":"00:00:00:00:00:00:05:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":3,"dst-switch":"00:00:00:00:00:00:05:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":11,"dst-switch":"00:00:00:00:00:00:05:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:05:01","src-port":4,"dst-switch":"00:00:00:00:00:00:05:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:04","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:07:0c","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":12},{"src-switch":"00:00:00:16:97:08:9a:46","src-port":3,"dst-switch":"00:00:20:4e:7f:51:8a:35","dst-port":2},{"src-switch":"00:00:00:16:97:08:9a:46","src-port":4,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":26},{"src-switch":"00:00:00:00:00:00:07:02","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:07:19","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:05:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:08:11","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:05:19","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:07:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:07:04","src-port":2,"dst-switch":"00:00:00:00:00:00:07:01","dst-port":4},{"src-switch":"00:00:00:00:00:00:05:18","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:04:03","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:08:03","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":3},{"src-switch":"00:00:00:00:00:00:08:08","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":8},{"src-switch":"00:00:00:00:00:00:05:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:05:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:04:0e","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":14},{"src-switch":"00:00:00:00:00:00:04:0a","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":10},{"src-switch":"00:00:00:00:00:00:04:11","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":17},{"src-switch":"00:00:00:00:00:00:02:02","src-port":2,"dst-switch":"00:00:00:00:00:00:02:01","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:16","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":22},{"src-switch":"00:00:00:00:00:00:04:01","src-port":12,"dst-switch":"00:00:00:00:00:00:04:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":22,"dst-switch":"00:00:00:00:00:00:04:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":20,"dst-switch":"00:00:00:00:00:00:04:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":6,"dst-switch":"00:00:00:00:00:00:04:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":13,"dst-switch":"00:00:00:00:00:00:04:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":19,"dst-switch":"00:00:00:00:00:00:04:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":5,"dst-switch":"00:00:00:00:00:00:04:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":18,"dst-switch":"00:00:00:00:00:00:04:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":25,"dst-switch":"00:00:00:00:00:00:04:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":7,"dst-switch":"00:00:00:00:00:00:04:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":26,"dst-switch":"00:00:00:00:00:00:ba:12","dst-port":4},{"src-switch":"00:00:00:00:00:00:04:01","src-port":8,"dst-switch":"00:00:00:00:00:00:04:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":17,"dst-switch":"00:00:00:00:00:00:04:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":2,"dst-switch":"00:00:00:00:00:00:04:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":9,"dst-switch":"00:00:00:00:00:00:04:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":10,"dst-switch":"00:00:00:00:00:00:04:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":23,"dst-switch":"00:00:00:00:00:00:04:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":16,"dst-switch":"00:00:00:00:00:00:04:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":15,"dst-switch":"00:00:00:00:00:00:04:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":24,"dst-switch":"00:00:00:00:00:00:04:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":14,"dst-switch":"00:00:00:00:00:00:04:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":21,"dst-switch":"00:00:00:00:00:00:04:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":3,"dst-switch":"00:00:00:00:00:00:04:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":11,"dst-switch":"00:00:00:00:00:00:04:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:01","src-port":4,"dst-switch":"00:00:00:00:00:00:04:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:19","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:04:19","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":25},{"src-switch":"00:00:00:00:00:00:08:0b","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":11},{"src-switch":"00:00:00:00:00:00:08:18","src-port":2,"dst-switch":"00:00:00:00:00:00:08:01","dst-port":24},{"src-switch":"00:00:00:00:00:00:06:12","src-port":2,"dst-switch":"00:00:00:00:00:00:06:01","dst-port":18},{"src-switch":"00:00:00:00:00:00:08:01","src-port":12,"dst-switch":"00:00:00:00:00:00:08:0c","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":22,"dst-switch":"00:00:00:00:00:00:08:16","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":20,"dst-switch":"00:00:00:00:00:00:08:14","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":6,"dst-switch":"00:00:00:00:00:00:08:06","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":13,"dst-switch":"00:00:00:00:00:00:08:0d","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":19,"dst-switch":"00:00:00:00:00:00:08:13","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":5,"dst-switch":"00:00:00:00:00:00:08:05","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":18,"dst-switch":"00:00:00:00:00:00:08:12","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":25,"dst-switch":"00:00:00:00:00:00:08:19","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":7,"dst-switch":"00:00:00:00:00:00:08:07","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":26,"dst-switch":"00:00:00:16:97:08:9a:46","dst-port":4},{"src-switch":"00:00:00:00:00:00:08:01","src-port":8,"dst-switch":"00:00:00:00:00:00:08:08","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":17,"dst-switch":"00:00:00:00:00:00:08:11","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":2,"dst-switch":"00:00:00:00:00:00:08:02","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":9,"dst-switch":"00:00:00:00:00:00:08:09","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":10,"dst-switch":"00:00:00:00:00:00:08:0a","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":23,"dst-switch":"00:00:00:00:00:00:08:17","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":16,"dst-switch":"00:00:00:00:00:00:08:10","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":15,"dst-switch":"00:00:00:00:00:00:08:0f","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":24,"dst-switch":"00:00:00:00:00:00:08:18","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":14,"dst-switch":"00:00:00:00:00:00:08:0e","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":21,"dst-switch":"00:00:00:00:00:00:08:15","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":3,"dst-switch":"00:00:00:00:00:00:08:03","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":11,"dst-switch":"00:00:00:00:00:00:08:0b","dst-port":2},{"src-switch":"00:00:00:00:00:00:08:01","src-port":4,"dst-switch":"00:00:00:00:00:00:08:04","dst-port":2},{"src-switch":"00:00:00:00:00:00:04:0d","src-port":2,"dst-switch":"00:00:00:00:00:00:04:01","dst-port":13},{"src-switch":"00:00:00:00:00:00:03:12","src-port":2,"dst-switch":"00:00:00:00:00:00:03:01","dst-port":18}]
\ No newline at end of file
diff --git a/web/ons-demo/data/wm_core_topology_switches_all_json.json b/web/ons-demo/data/wm_core_topology_switches_all_json.json
new file mode 100644
index 0000000..5b659a2
--- /dev/null
+++ b/web/ons-demo/data/wm_core_topology_switches_all_json.json
@@ -0,0 +1 @@
+[{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw06.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw06.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw06.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw06.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw06.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw06.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw06.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw06.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw06.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw06.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap06_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw06.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw06.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw06.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw06.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw06.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw06.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw06.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw06.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw06.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw06.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw06.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw06.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw06.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw06.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:06:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:18"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0b"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.38-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.38-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:26"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:09"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.29-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.29-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:06"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:10"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.39-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.39-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:27"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0e"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.31-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.31-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1f"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.32-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.32-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:20"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.46-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.46-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:03"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:15"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:09"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.33-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.33-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:21"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:02"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw07.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw07.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw07.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw07.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw07.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw07.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw07.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw07.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw07.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw07.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap07_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw07.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw07.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw07.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw07.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw07.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw07.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw07.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw07.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw07.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw07.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw07.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw07.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw07.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw07.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:07:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:14"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:13"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:17"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.50-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.50-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:32"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:14"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.27-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.27-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.37-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.37-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:25"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:15"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.28-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.28-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:18"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:18"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:03"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:14"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:06"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:15"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:15"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw03.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw03.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw03.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw03.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw03.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw03.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw03.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw03.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw03.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw03.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap03_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw03.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw03.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw03.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw03.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw03.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw03.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw03.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw03.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw03.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw03.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw03.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw03.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw03.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw03.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:03:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:17"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":40,"desc":"sw02.01-eth40","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw02.01-eth22","devices":[]},{"state":"ACTIVE","number":49,"desc":"sw02.01-eth49","devices":[]},{"state":"ACTIVE","number":12,"desc":"sw02.01-eth12","devices":[]},{"state":"ACTIVE","number":31,"desc":"sw02.01-eth31","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw02.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw02.01-eth6","devices":[]},{"state":"ACTIVE","number":27,"desc":"sw02.01-eth27","devices":[]},{"state":"ACTIVE","number":34,"desc":"sw02.01-eth34","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw02.01-eth19","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw02.01-eth13","devices":[]},{"state":"ACTIVE","number":41,"desc":"sw02.01-eth41","devices":[]},{"state":"ACTIVE","number":48,"desc":"sw02.01-eth48","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw02.01-eth5","devices":[]},{"state":"ACTIVE","number":28,"desc":"sw02.01-eth28","devices":[]},{"state":"ACTIVE","number":33,"desc":"sw02.01-eth33","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw02.01-eth18","devices":[]},{"state":"ACTIVE","number":42,"desc":"sw02.01-eth42","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw02.01-eth25","devices":[]},{"state":"ACTIVE","number":47,"desc":"sw02.01-eth47","devices":[]},{"state":"ACTIVE","number":46,"desc":"sw02.01-eth46","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw02.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"sw02.01-eth26","devices":[]},{"state":"ACTIVE","number":36,"desc":"sw02.01-eth36","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw02.01-eth8","devices":[]},{"state":"ACTIVE","number":45,"desc":"sw02.01-eth45","devices":[]},{"state":"ACTIVE","number":35,"desc":"sw02.01-eth35","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw02.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw02.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw02.01-eth9","devices":[]},{"state":"ACTIVE","number":51,"desc":"tap02_1","devices":[]},{"state":"ACTIVE","number":37,"desc":"sw02.01-eth37","devices":[]},{"state":"ACTIVE","number":44,"desc":"sw02.01-eth44","devices":[]},{"state":"ACTIVE","number":43,"desc":"sw02.01-eth43","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw02.01-eth16","devices":[]},{"state":"ACTIVE","number":30,"desc":"sw02.01-eth30","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw02.01-eth23","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw02.01-eth10","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw02.01-eth15","devices":[]},{"state":"ACTIVE","number":38,"desc":"sw02.01-eth38","devices":[]},{"state":"ACTIVE","number":29,"desc":"sw02.01-eth29","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw02.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw02.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw02.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw02.01-eth3","devices":[]},{"state":"ACTIVE","number":39,"desc":"sw02.01-eth39","devices":[]},{"state":"ACTIVE","number":32,"desc":"sw02.01-eth32","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw02.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw02.01-eth4","devices":[]},{"state":"ACTIVE","number":50,"desc":"sw02.01-eth50","devices":[]}],"dpid":"00:00:00:00:00:00:02:01"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.48-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.48-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:30"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:04"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:18"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:17"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:09"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:02"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:14"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:09"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:17"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:02"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:17"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:13"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:16"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:06"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:18"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:14"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.41-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.41-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:29"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:09"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:09"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:03"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:15"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.30-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.30-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:06"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:06"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.09-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.09-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:09"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0c"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:14"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.19-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.19-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0f"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:03"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.15-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.15-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0f"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.26-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.26-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:1a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:02"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:0e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:02"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:0e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0d"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.49-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.49-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:31"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.05-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.05-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:05"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:03"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:15"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.16-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.16-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:10"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:06"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw3-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw3-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw3-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw3-eth4","devices":[]},{"state":"ACTIVE","number":5,"desc":"tap01_3","devices":[]}],"dpid":"00:00:00:08:a2:08:f9:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:17"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.23-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.23-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:17"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.07-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.07-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:07"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.06-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.06-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:06"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.40-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.40-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:28"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.44-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.44-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.21-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.21-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:15"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw05.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw05.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw05.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw05.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw05.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw05.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw05.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw05.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw05.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw05.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap05_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw05.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw05.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw05.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw05.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw05.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw05.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw05.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw05.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw05.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw05.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw05.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw05.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw05.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw05.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:05:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.12-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.12-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0c"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":1,"desc":"sw1-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw1-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"tap01_8","devices":[]}],"dpid":"00:00:00:16:97:08:9a:46"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:02"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.36-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.36-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:24"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:19"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw5-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw5-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw5-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"tap01_6","devices":[]}],"dpid":"00:00:00:00:ba:5e:ba:13"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:11"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw6-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw6-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw6-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw6-eth4","devices":[]},{"state":"ACTIVE","number":5,"desc":"tap01_7","devices":[]}],"dpid":"00:00:20:4e:7f:51:8a:35"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:0e"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.20-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.20-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:14"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw07.04-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw07.04-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:07:04"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:18"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:03"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.03-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.03-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:03"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw05.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw05.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:05:0e"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.14-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.14-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0e"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.08-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.08-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:08"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.10-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.10-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.17-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.17-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.02-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.02-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:02"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.22-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.22-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:16"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":1,"desc":"sw2-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw2-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"tap01_2","devices":[]}],"dpid":"00:00:00:00:ba:5e:ba:11"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw04.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw04.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw04.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw04.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw04.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw04.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw04.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw04.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw04.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw04.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap04_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw04.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw04.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw04.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw04.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw04.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw04.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw04.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw04.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw04.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw04.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw04.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw04.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw04.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw04.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:04:01"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.25-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.25-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:19"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.11-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.11-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:0b"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.43-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.43-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2b"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw08.24-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.24-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:08:18"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.45-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.45-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2d"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw06.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw06.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:06:12"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":12,"desc":"sw08.01-eth12","devices":[]},{"state":"ACTIVE","number":22,"desc":"sw08.01-eth22","devices":[]},{"state":"ACTIVE","number":20,"desc":"sw08.01-eth20","devices":[]},{"state":"ACTIVE","number":6,"desc":"sw08.01-eth6","devices":[]},{"state":"ACTIVE","number":13,"desc":"sw08.01-eth13","devices":[]},{"state":"ACTIVE","number":19,"desc":"sw08.01-eth19","devices":[]},{"state":"ACTIVE","number":5,"desc":"sw08.01-eth5","devices":[]},{"state":"ACTIVE","number":18,"desc":"sw08.01-eth18","devices":[]},{"state":"ACTIVE","number":25,"desc":"sw08.01-eth25","devices":[]},{"state":"ACTIVE","number":7,"desc":"sw08.01-eth7","devices":[]},{"state":"ACTIVE","number":26,"desc":"tap08_1","devices":[]},{"state":"ACTIVE","number":8,"desc":"sw08.01-eth8","devices":[]},{"state":"ACTIVE","number":17,"desc":"sw08.01-eth17","devices":[]},{"state":"ACTIVE","number":2,"desc":"sw08.01-eth2","devices":[]},{"state":"ACTIVE","number":9,"desc":"sw08.01-eth9","devices":[]},{"state":"ACTIVE","number":10,"desc":"sw08.01-eth10","devices":[]},{"state":"ACTIVE","number":23,"desc":"sw08.01-eth23","devices":[]},{"state":"ACTIVE","number":16,"desc":"sw08.01-eth16","devices":[]},{"state":"ACTIVE","number":15,"desc":"sw08.01-eth15","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw08.01-eth1","devices":[]},{"state":"ACTIVE","number":24,"desc":"sw08.01-eth24","devices":[]},{"state":"ACTIVE","number":14,"desc":"sw08.01-eth14","devices":[]},{"state":"ACTIVE","number":21,"desc":"sw08.01-eth21","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw08.01-eth3","devices":[]},{"state":"ACTIVE","number":11,"desc":"sw08.01-eth11","devices":[]},{"state":"ACTIVE","number":4,"desc":"sw08.01-eth4","devices":[]}],"dpid":"00:00:00:00:00:00:08:01"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.35-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.35-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:23"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw04.13-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw04.13-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:04:0d"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.47-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.47-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2f"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.34-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.34-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:22"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw4-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw4-eth1","devices":[]},{"state":"ACTIVE","number":3,"desc":"sw4-eth3","devices":[]},{"state":"ACTIVE","number":4,"desc":"tap01_4","devices":[]},{"state":"ACTIVE","number":5,"desc":"tap01_5","devices":[]}],"dpid":"00:00:00:00:00:00:ba:12"},{"state":"INACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw02.42-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw02.42-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:02:2a"},{"state":"ACTIVE","ports":[{"state":"ACTIVE","number":2,"desc":"sw03.18-eth2","devices":[]},{"state":"ACTIVE","number":1,"desc":"sw03.18-eth1","devices":[]}],"dpid":"00:00:00:00:00:00:03:12"}]
\ No newline at end of file
diff --git a/web/ons-demo/data/wm_flow_getall_json.json b/web/ons-demo/data/wm_flow_getall_json.json
new file mode 100644
index 0000000..f56d017
--- /dev/null
+++ b/web/ons-demo/data/wm_flow_getall_json.json
@@ -0,0 +1,439 @@
+[
+ {
+ "dataPath": {
+ "srcPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:02"
+ },
+ "port": {
+ "value": 4
+ }
+ },
+ "flowEntries": [
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }, {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:ba:5e:ba:13"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:ba:5e:ba:11"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }
+ ],
+ "dstPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:02"
+ },
+ "port": {
+ "value": 4
+ }
+ }
+ },
+ "flowId": {
+ "value": "0x1"
+ },
+ "installerId": {
+ "value": "1"
+ }
+ },
+
+
+{
+ "dataPath": {
+ "srcPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:02"
+ },
+ "port": {
+ "value": 4
+ }
+ },
+ "flowEntries": [
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }, {
+ "dpid": {
+ "value": "00:00:00:00:00:00:06:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:ba:5e:ba:13"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:08:a2:08:f9:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:03:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:03:05"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }
+ ],
+ "dstPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:03:05"
+ },
+ "port": {
+ "value": 4
+ }
+ }
+ },
+ "flowId": {
+ "value": "0x2"
+ },
+ "installerId": {
+ "value": "1"
+ }
+ },
+
+{
+ "dataPath": {
+ "srcPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:07:02"
+ },
+ "port": {
+ "value": 4
+ }
+ },
+ "flowEntries": [
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:07:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }, {
+ "dpid": {
+ "value": "00:00:00:00:00:00:07:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:20:4e:7f:51:8a:35"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:16:97:08:9a:46"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:08:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:08:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }
+ ],
+ "dstPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:08:02"
+ },
+ "port": {
+ "value": 4
+ }
+ }
+ },
+ "flowId": {
+ "value": "0x3"
+ },
+ "installerId": {
+ "value": "1"
+ }
+ },
+{
+ "dataPath": {
+ "srcPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:05:02"
+ },
+ "port": {
+ "value": 4
+ }
+ },
+ "flowEntries": [
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:05:02"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }, {
+ "dpid": {
+ "value": "00:00:00:00:00:00:05:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x1",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:ba:12"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:08:a2:08:f9:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:ba:5e:ba:11"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x2",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:01"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ },
+ {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:15"
+ },
+ "flowEntryActions": null,
+ "flowEntryErrorState": null,
+ "flowEntryId": "0x3",
+ "flowEntryMatch": null,
+ "flowEntrySwitchState": "FE_SWITCH_UPDATED",
+ "flowEntryUserState": "FE_USER_ADD",
+ "inPort": null,
+ "outPort": null
+ }
+ ],
+ "dstPort": {
+ "dpid": {
+ "value": "00:00:00:00:00:00:02:15"
+ },
+ "port": {
+ "value": 4
+ }
+ }
+ },
+ "flowId": {
+ "value": "0x4"
+ },
+ "installerId": {
+ "value": "1"
+ }
+ }
+
+]
diff --git a/web/ons-demo/data/wm_registry_controllers_json.json b/web/ons-demo/data/wm_registry_controllers_json.json
new file mode 100644
index 0000000..38b0907
--- /dev/null
+++ b/web/ons-demo/data/wm_registry_controllers_json.json
@@ -0,0 +1 @@
+["onosgui1","onosgui2","onosgui3","onosgui4","onosgui5","onosgui6","onosgui7","onosgui8"]
\ No newline at end of file
diff --git a/web/ons-demo/data/wm_registry_switches_json.json b/web/ons-demo/data/wm_registry_switches_json.json
new file mode 100644
index 0000000..841cdb6
--- /dev/null
+++ b/web/ons-demo/data/wm_registry_switches_json.json
@@ -0,0 +1 @@
+{"00:00:00:00:00:00:02:08":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:09":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:16":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:15":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:18":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:17":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:07:0a":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:12":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:0b":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:11":[{"controllerId":"onosgui2"},{"controllerId":"onosgui7"}],"00:00:00:00:00:00:07:0c":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:14":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:07:0d":[{"controllerId":"onosgui7"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:13":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:0e":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:0f":[{"controllerId":"onosgui7"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:10":[{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:0f":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:0d":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:0e":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:0b":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:0c":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:0a":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:19":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:29":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:28":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:27":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:26":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:25":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:24":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:23":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:22":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:21":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:20":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:07:02":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:01":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:04":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:03":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:17":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:18":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:19":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:13":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:14":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:09":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:15":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:16":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:06":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:10":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:05":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:11":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:08":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:12":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:07":[{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:16:97:08:9a:46":[{"controllerId":"onosgui1"},{"controllerId":"onosgui7"},{"controllerId":"onosgui8"},{"controllerId":"onosgui5"},{"controllerId":"onosgui6"},{"controllerId":"onosgui4"},{"controllerId":"onosgui2"},{"controllerId":"onosgui3"}],"00:00:00:00:00:00:04:10":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:11":[{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:12":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:13":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:14":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:15":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:16":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:17":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:18":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:19":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:15":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:14":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:13":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:12":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:11":[{"controllerId":"onosgui7"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0a":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0f":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:10":[{"controllerId":"onosgui7"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0e":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0d":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0c":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0e":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0b":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0d":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:0a":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0c":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0b":[{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:19":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:18":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:17":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:07:16":[{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:0f":[{"controllerId":"onosgui4"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:03":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:02":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:01":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:07":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:06":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:05":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:04":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0f":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0e":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0d":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0c":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0b":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:08:a2:08:f9:01":[{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:0a":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:11":[{"controllerId":"onosgui5"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:10":[{"controllerId":"onosgui5"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:13":[{"controllerId":"onosgui5"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:12":[{"controllerId":"onosgui5"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:15":[{"controllerId":"onosgui5"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:14":[{"controllerId":"onosgui5"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:17":[{"controllerId":"onosgui5"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:16":[{"controllerId":"onosgui5"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:19":[{"controllerId":"onosgui5"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:18":[{"controllerId":"onosgui5"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:01":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:05":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:04":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:03":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:02":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:09":[{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:08":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:07":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0e":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:08:06":[{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0f":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0c":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0d":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0a":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:0b":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:02":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:01":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:06":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:05":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:04":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:03":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:09":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:08":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:05:07":[{"controllerId":"onosgui5"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:09":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:1b":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:1a":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:1d":[{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:1c":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:1f":[{"controllerId":"onosgui2"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:1e":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:30":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:31":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:03:11":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:32":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:03:10":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:13":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:12":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:15":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:14":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:17":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:16":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:19":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:18":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:2a":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:2e":[{"controllerId":"onosgui2"},{"controllerId":"onosgui5"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:02:2d":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:2c":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:2b":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:02:2f":[{"controllerId":"onosgui2"}],"00:00:00:00:00:00:03:04":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:03":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:02":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:01":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:08":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:07":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:06":[{"controllerId":"onosgui3"},{"controllerId":"onosgui8"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:03:05":[{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:ba:12":[{"controllerId":"onosgui1"}],"00:00:20:4e:7f:51:8a:35":[{"controllerId":"onosgui1"}],"00:00:00:00:ba:5e:ba:11":[{"controllerId":"onosgui1"}],"00:00:00:00:ba:5e:ba:13":[{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:03":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:02":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:05":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:04":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:07":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:06":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:09":[{"controllerId":"onosgui4"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:08":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:04:01":[{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui6"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:09":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:08":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:05":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:04":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:07":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:06":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:01":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:03":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:02":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0d":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0e":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0f":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0a":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0b":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:0c":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:18":[{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:17":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:16":[{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:15":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:19":[{"controllerId":"onosgui6"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:10":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:14":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:13":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:12":[{"controllerId":"onosgui6"},{"controllerId":"onosgui8"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui1"}],"00:00:00:00:00:00:06:11":[{"controllerId":"onosgui6"},{"controllerId":"onosgui3"},{"controllerId":"onosgui7"},{"controllerId":"onosgui5"},{"controllerId":"onosgui2"},{"controllerId":"onosgui4"},{"controllerId":"onosgui8"},{"controllerId":"onosgui1"}]}
\ No newline at end of file
diff --git a/web/ons-demo/data/world.json b/web/ons-demo/data/world.json
new file mode 100644
index 0000000..874582c
--- /dev/null
+++ b/web/ons-demo/data/world.json
@@ -0,0 +1,39034 @@
+{
+ "type": "Topology",
+ "transform": {
+ "scale": [
+ 0.011121861824577766,
+ 0.005244902253759074
+ ],
+ "translate": [
+ -178.19451843993755,
+ 18.96390918584938
+ ]
+ },
+ "objects": {
+ "world": {
+ "type": "GeometryCollection",
+ "geometries": [
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 0
+ ]
+ ],
+ [
+ [
+ 1
+ ]
+ ],
+ [
+ [
+ 2
+ ]
+ ],
+ [
+ [
+ 3
+ ]
+ ],
+ [
+ [
+ 4
+ ]
+ ],
+ [
+ [
+ 5
+ ]
+ ],
+ [
+ [
+ 6
+ ]
+ ],
+ [
+ [
+ 7
+ ]
+ ],
+ [
+ [
+ 8
+ ]
+ ],
+ [
+ [
+ 9
+ ]
+ ],
+ [
+ [
+ 10
+ ]
+ ],
+ [
+ [
+ 11
+ ]
+ ],
+ [
+ [
+ 12
+ ]
+ ],
+ [
+ [
+ 13
+ ]
+ ],
+ [
+ [
+ 14
+ ]
+ ],
+ [
+ [
+ 15
+ ]
+ ],
+ [
+ [
+ 16
+ ]
+ ],
+ [
+ [
+ 17
+ ]
+ ],
+ [
+ [
+ 18
+ ]
+ ],
+ [
+ [
+ 19
+ ]
+ ],
+ [
+ [
+ 20
+ ]
+ ],
+ [
+ [
+ 21
+ ]
+ ],
+ [
+ [
+ 22
+ ]
+ ],
+ [
+ [
+ 23
+ ]
+ ],
+ [
+ [
+ 24
+ ]
+ ],
+ [
+ [
+ 25
+ ]
+ ],
+ [
+ [
+ 26
+ ]
+ ],
+ [
+ [
+ 27
+ ]
+ ],
+ [
+ [
+ 28
+ ]
+ ],
+ [
+ [
+ 29
+ ]
+ ],
+ [
+ [
+ 30
+ ]
+ ],
+ [
+ [
+ 31
+ ]
+ ],
+ [
+ [
+ 32
+ ]
+ ],
+ [
+ [
+ 33
+ ]
+ ],
+ [
+ [
+ 34
+ ]
+ ],
+ [
+ [
+ 35
+ ]
+ ],
+ [
+ [
+ 36
+ ]
+ ],
+ [
+ [
+ 37
+ ]
+ ],
+ [
+ [
+ 38
+ ]
+ ],
+ [
+ [
+ 39
+ ]
+ ],
+ [
+ [
+ 40
+ ]
+ ],
+ [
+ [
+ 41
+ ]
+ ],
+ [
+ [
+ 42
+ ]
+ ],
+ [
+ [
+ 43
+ ]
+ ],
+ [
+ [
+ 44
+ ]
+ ],
+ [
+ [
+ 45
+ ]
+ ],
+ [
+ [
+ 46
+ ]
+ ],
+ [
+ [
+ 47
+ ]
+ ],
+ [
+ [
+ 48
+ ]
+ ],
+ [
+ [
+ 49
+ ]
+ ],
+ [
+ [
+ 50
+ ]
+ ],
+ [
+ [
+ 51
+ ]
+ ],
+ [
+ [
+ 52
+ ]
+ ],
+ [
+ [
+ 53
+ ]
+ ],
+ [
+ [
+ 54
+ ]
+ ],
+ [
+ [
+ 55
+ ]
+ ],
+ [
+ [
+ 56
+ ]
+ ],
+ [
+ [
+ 57
+ ]
+ ],
+ [
+ [
+ 58
+ ]
+ ],
+ [
+ [
+ 59
+ ]
+ ],
+ [
+ [
+ 60
+ ]
+ ],
+ [
+ [
+ 61
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 62
+ ]
+ ],
+ [
+ [
+ 63,
+ 64,
+ 65,
+ 66,
+ 67
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 68,
+ 69,
+ 70,
+ 71,
+ 72,
+ 73
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 74,
+ 75,
+ 76,
+ 77,
+ 78
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 79
+ ]
+ ],
+ [
+ [
+ 80
+ ]
+ ],
+ [
+ [
+ 81
+ ]
+ ],
+ [
+ [
+ 82
+ ]
+ ],
+ [
+ [
+ 83
+ ]
+ ],
+ [
+ [
+ 84
+ ]
+ ],
+ [
+ [
+ 85,
+ -77,
+ 86,
+ 87
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 88,
+ 89,
+ 90,
+ 91,
+ 92,
+ 93
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 94,
+ 95,
+ 96,
+ 97
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 98,
+ 99
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 100,
+ 101,
+ 102
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 103
+ ]
+ ],
+ [
+ [
+ 104
+ ]
+ ],
+ [
+ [
+ 105
+ ]
+ ],
+ [
+ [
+ 106
+ ]
+ ],
+ [
+ [
+ 107
+ ]
+ ],
+ [
+ [
+ 108
+ ]
+ ],
+ [
+ [
+ 109
+ ]
+ ],
+ [
+ [
+ 110
+ ]
+ ],
+ [
+ [
+ 111
+ ]
+ ],
+ [
+ [
+ 112
+ ]
+ ],
+ [
+ [
+ 113
+ ]
+ ],
+ [
+ [
+ 114,
+ -68,
+ 115
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 116
+ ]
+ ],
+ [
+ [
+ 117,
+ -116,
+ -67,
+ 118,
+ 119,
+ 120
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 121
+ ]
+ ],
+ [
+ [
+ 122
+ ]
+ ],
+ [
+ [
+ 123
+ ]
+ ],
+ [
+ [
+ 124
+ ]
+ ],
+ [
+ [
+ 125
+ ]
+ ],
+ [
+ [
+ 126
+ ]
+ ],
+ [
+ [
+ 127
+ ]
+ ],
+ [
+ [
+ 128
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 129,
+ 130,
+ 131,
+ 132,
+ 133,
+ 134
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 135,
+ 136,
+ 137,
+ 138,
+ 139,
+ 140,
+ 141
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 142,
+ 143,
+ 144,
+ 145,
+ -130,
+ 146
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 147,
+ 148,
+ -144,
+ 149,
+ 150
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 151,
+ -89,
+ 152,
+ 153
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 154,
+ 155
+ ]
+ ],
+ [
+ [
+ 156,
+ 157,
+ 158,
+ 159,
+ -145,
+ -149,
+ 160
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 161
+ ]
+ ],
+ [
+ [
+ 162
+ ]
+ ],
+ [
+ [
+ 163
+ ]
+ ],
+ [
+ [
+ 164
+ ]
+ ],
+ [
+ [
+ 165,
+ 166,
+ -71,
+ 167
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 168
+ ]
+ ],
+ [
+ [
+ 169
+ ]
+ ],
+ [
+ [
+ 170,
+ -98,
+ 171,
+ 172,
+ 173,
+ 174
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 175,
+ 176
+ ]
+ ],
+ [
+ [
+ -102,
+ 177,
+ 178,
+ 179,
+ -100,
+ 180,
+ 181,
+ 182
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 183
+ ]
+ ],
+ [
+ [
+ 184
+ ]
+ ],
+ [
+ [
+ 185,
+ 186
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 187
+ ]
+ ],
+ [
+ [
+ 188
+ ]
+ ],
+ [
+ [
+ 189,
+ -151,
+ 190
+ ]
+ ],
+ [
+ [
+ 191
+ ]
+ ],
+ [
+ [
+ 192
+ ]
+ ],
+ [
+ [
+ 193
+ ]
+ ],
+ [
+ [
+ 194
+ ]
+ ],
+ [
+ [
+ 195,
+ 196
+ ]
+ ],
+ [
+ [
+ 197
+ ]
+ ],
+ [
+ [
+ 198
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 199,
+ -134,
+ 200,
+ 201,
+ 202
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -146,
+ -160,
+ 203,
+ -155,
+ 204,
+ -74,
+ 205,
+ -154,
+ 206,
+ -131
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 207
+ ]
+ ],
+ [
+ [
+ 208,
+ -168,
+ -70,
+ 209,
+ -65
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 210,
+ 211,
+ -142,
+ 212,
+ 213
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 214
+ ]
+ ],
+ [
+ [
+ 215
+ ]
+ ],
+ [
+ [
+ 216
+ ]
+ ],
+ [
+ [
+ 217
+ ]
+ ],
+ [
+ [
+ 218
+ ]
+ ],
+ [
+ [
+ 219,
+ 220
+ ]
+ ],
+ [
+ [
+ 221,
+ -120,
+ 222,
+ 223,
+ 224
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 225,
+ -214,
+ 226,
+ -202
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -132,
+ -207,
+ -153,
+ -94,
+ 227,
+ 228
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 229,
+ -174,
+ 230,
+ 231,
+ -186
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 232
+ ]
+ ],
+ [
+ [
+ 233,
+ 234,
+ 235
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 236,
+ 237,
+ -75,
+ -91,
+ 238
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -78,
+ -86,
+ 239,
+ -138,
+ 240
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 241
+ ]
+ ],
+ [
+ [
+ 242
+ ]
+ ],
+ [
+ [
+ 243
+ ]
+ ],
+ [
+ [
+ 244
+ ]
+ ],
+ [
+ [
+ 245
+ ]
+ ],
+ [
+ [
+ -172,
+ -97,
+ 246,
+ -235,
+ 247,
+ 248,
+ 249
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 250,
+ -161,
+ -148,
+ -190,
+ 251,
+ 252
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -73,
+ 253,
+ -239,
+ -90,
+ -152,
+ -206
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -139,
+ -240,
+ -88,
+ 254,
+ 255
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -234,
+ 256,
+ -103,
+ -183,
+ 257,
+ -253,
+ 258,
+ -248
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 259
+ ]
+ ],
+ [
+ [
+ 260
+ ]
+ ],
+ [
+ [
+ 261,
+ -95,
+ -171
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 262,
+ -121,
+ -222
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -201,
+ -133,
+ -229,
+ 263,
+ -211,
+ -226
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 264,
+ -223,
+ -119,
+ -66,
+ -210,
+ -69,
+ -205,
+ -156,
+ -204,
+ -159
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 265
+ ]
+ ],
+ [
+ [
+ 266
+ ]
+ ],
+ [
+ [
+ 267
+ ]
+ ],
+ [
+ [
+ 268
+ ]
+ ],
+ [
+ [
+ 269
+ ]
+ ],
+ [
+ [
+ -72,
+ -167,
+ 270,
+ -237,
+ -254
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ 271,
+ -92,
+ -79,
+ -241,
+ -137
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ -179,
+ 272
+ ]
+ ],
+ [
+ [
+ -177,
+ 273
+ ]
+ ],
+ [
+ [
+ -181,
+ -99,
+ 274,
+ -220,
+ 275,
+ -224,
+ -265,
+ -158,
+ 276
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -173,
+ -250,
+ 277,
+ -231
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 278
+ ]
+ ],
+ [
+ [
+ 279
+ ]
+ ],
+ [
+ [
+ 280
+ ]
+ ],
+ [
+ [
+ 281
+ ]
+ ],
+ [
+ [
+ 282
+ ]
+ ],
+ [
+ [
+ 283
+ ]
+ ],
+ [
+ [
+ 284
+ ]
+ ],
+ [
+ [
+ 285
+ ]
+ ],
+ [
+ [
+ -256,
+ 286,
+ -140
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "MultiPolygon",
+ "arcs": [
+ [
+ [
+ 287
+ ]
+ ],
+ [
+ [
+ 288
+ ]
+ ],
+ [
+ [
+ 289
+ ]
+ ],
+ [
+ [
+ 290
+ ]
+ ],
+ [
+ [
+ -196,
+ 291,
+ -147,
+ -135,
+ -200,
+ 292
+ ]
+ ],
+ [
+ [
+ 293
+ ]
+ ],
+ [
+ [
+ 294
+ ]
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -182,
+ -277,
+ -157,
+ -251,
+ -258
+ ]
+ ]
+ },
+ {
+ "type": "Polygon",
+ "arcs": [
+ [
+ -228,
+ -93,
+ -272,
+ -136,
+ -212,
+ -264
+ ]
+ ]
+ }
+ ]
+ }
+ },
+ "arcs": [
+ [
+ [
+ 172,
+ 6259
+ ],
+ [
+ -6,
+ -11
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -2,
+ 15
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 9,
+ -11
+ ],
+ [
+ 0,
+ -2
+ ]
+ ],
+ [
+ [
+ 197,
+ 6263
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ -10,
+ 8
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 11,
+ -8
+ ],
+ [
+ 6,
+ -6
+ ]
+ ],
+ [
+ [
+ 28,
+ 6232
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -12,
+ 10
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -9,
+ 9
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 8,
+ -11
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 13,
+ -2
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -5,
+ -17
+ ],
+ [
+ -5,
+ -7
+ ]
+ ],
+ [
+ [
+ 94,
+ 6245
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -14,
+ 2
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -10,
+ -2
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 30,
+ 10
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 3,
+ 13
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -1,
+ -17
+ ]
+ ],
+ [
+ [
+ 144,
+ 6273
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 11,
+ 1
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 0,
+ -12
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -19,
+ -16
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -11,
+ -14
+ ],
+ [
+ 8,
+ 36
+ ],
+ [
+ 9,
+ 5
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 5,
+ 17
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -4,
+ -10
+ ]
+ ],
+ [
+ [
+ 195,
+ 6299
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -9,
+ 6
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -5,
+ -5
+ ]
+ ],
+ [
+ [
+ 417,
+ 6325
+ ],
+ [
+ 18,
+ -8
+ ],
+ [
+ 22,
+ 1
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -14,
+ -3
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -12,
+ -5
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -19,
+ 4
+ ],
+ [
+ -15,
+ -3
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 13,
+ -5
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 11,
+ 5
+ ],
+ [
+ 9,
+ -1
+ ]
+ ],
+ [
+ [
+ 515,
+ 6351
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 8,
+ -3
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ -14,
+ -11
+ ]
+ ],
+ [
+ [
+ 316,
+ 6305
+ ],
+ [
+ -48,
+ -7
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 9,
+ 2
+ ],
+ [
+ 18,
+ 9
+ ],
+ [
+ 22,
+ 7
+ ],
+ [
+ 18,
+ 10
+ ],
+ [
+ 15,
+ 6
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ -13,
+ 5
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 6,
+ 7
+ ],
+ [
+ 12,
+ 8
+ ],
+ [
+ 11,
+ -10
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -10,
+ -5
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 5,
+ -13
+ ],
+ [
+ -20,
+ -10
+ ],
+ [
+ -30,
+ -9
+ ]
+ ],
+ [
+ [
+ 671,
+ 6410
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 9,
+ 13
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -4,
+ -2
+ ]
+ ],
+ [
+ [
+ 764,
+ 6460
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -14,
+ 4
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 15,
+ 6
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 1,
+ -4
+ ]
+ ],
+ [
+ [
+ 920,
+ 6555
+ ],
+ [
+ -28,
+ -20
+ ],
+ [
+ -9,
+ -15
+ ],
+ [
+ -6,
+ -15
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -9,
+ -10
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -29,
+ -23
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ 6,
+ 13
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 12,
+ -2
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ 8,
+ 6
+ ],
+ [
+ 11,
+ 5
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 14,
+ -10
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -9,
+ -8
+ ]
+ ],
+ [
+ [
+ 1078,
+ 6627
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -2,
+ -7
+ ]
+ ],
+ [
+ [
+ 1041,
+ 6661
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 5,
+ 8
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ -8,
+ -11
+ ],
+ [
+ -15,
+ -17
+ ],
+ [
+ -6,
+ -11
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 15,
+ 4
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ -7,
+ -8
+ ],
+ [
+ -17,
+ -14
+ ],
+ [
+ -6,
+ -12
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -10,
+ -1
+ ],
+ [
+ -17,
+ -8
+ ],
+ [
+ -11,
+ -7
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -7,
+ -1
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -10,
+ 8
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 6,
+ 3
+ ],
+ [
+ 10,
+ 1
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 20,
+ 11
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 4,
+ 21
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 5,
+ -9
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -11,
+ 5
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 11,
+ 3
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 1,
+ -18
+ ]
+ ],
+ [
+ [
+ 1111,
+ 6693
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -4,
+ 12
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 12,
+ -10
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -9,
+ -2
+ ]
+ ],
+ [
+ [
+ 1136,
+ 6706
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -8,
+ -9
+ ]
+ ],
+ [
+ [
+ 1406,
+ 6757
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ -8,
+ 5
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 16,
+ -6
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 5,
+ -8
+ ]
+ ],
+ [
+ [
+ 1429,
+ 6842
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 13,
+ 9
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -3,
+ -13
+ ],
+ [
+ -3,
+ -3
+ ]
+ ],
+ [
+ [
+ 1323,
+ 6867
+ ],
+ [
+ 9,
+ -31
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -25,
+ 12
+ ],
+ [
+ -16,
+ -18
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -44,
+ -1
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -10,
+ -17
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -12,
+ -5
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -3,
+ 16
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 13,
+ 10
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 16,
+ 36
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 11,
+ 10
+ ],
+ [
+ 25,
+ 16
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ 3,
+ -6
+ ]
+ ],
+ [
+ [
+ 1693,
+ 6865
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 0,
+ -6
+ ]
+ ],
+ [
+ [
+ 1680,
+ 6900
+ ],
+ [
+ -1,
+ -16
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ -14
+ ]
+ ],
+ [
+ [
+ 4213,
+ 6886
+ ],
+ [
+ 9,
+ -25
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 3,
+ 13
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 3,
+ 9
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 6,
+ -25
+ ]
+ ],
+ [
+ [
+ 1647,
+ 6895
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -11,
+ -19
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ 5,
+ 17
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 5,
+ 11
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 5,
+ 14
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -2,
+ -3
+ ]
+ ],
+ [
+ [
+ 4076,
+ 6851
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -1,
+ -16
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ -11,
+ 18
+ ],
+ [
+ -6,
+ 13
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -8,
+ 22
+ ],
+ [
+ -4,
+ 17
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -8,
+ 5
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 12,
+ 4
+ ],
+ [
+ 18,
+ -22
+ ],
+ [
+ 3,
+ -9
+ ],
+ [
+ 6,
+ -10
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 8,
+ -20
+ ]
+ ],
+ [
+ [
+ 1606,
+ 6935
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -12,
+ 10
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 11,
+ 1
+ ],
+ [
+ 3,
+ -4
+ ]
+ ],
+ [
+ [
+ 1574,
+ 6931
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -11,
+ -5
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -2,
+ 26
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 5,
+ 9
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -2,
+ -8
+ ]
+ ],
+ [
+ [
+ 4036,
+ 6974
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -13,
+ -13
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ 1,
+ 27
+ ],
+ [
+ -9,
+ 16
+ ],
+ [
+ 10,
+ 9
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 10,
+ -1
+ ],
+ [
+ 10,
+ 7
+ ],
+ [
+ 3,
+ -3
+ ]
+ ],
+ [
+ [
+ 2035,
+ 7027
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 11,
+ 16
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 0,
+ -13
+ ]
+ ],
+ [
+ [
+ 4245,
+ 6964
+ ],
+ [
+ -3,
+ -21
+ ],
+ [
+ -6,
+ -21
+ ],
+ [
+ -9,
+ -12
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -10,
+ -8
+ ],
+ [
+ -8,
+ -16
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -5,
+ 11
+ ],
+ [
+ -2,
+ 26
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ 10,
+ 15
+ ],
+ [
+ 2,
+ 47
+ ],
+ [
+ 32,
+ 24
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 11,
+ -18
+ ],
+ [
+ 11,
+ -25
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ 1,
+ -19
+ ],
+ [
+ -2,
+ -15
+ ]
+ ],
+ [
+ [
+ 4013,
+ 7126
+ ],
+ [
+ 17,
+ -4
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 30,
+ -19
+ ],
+ [
+ 15,
+ -19
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 6,
+ -21
+ ],
+ [
+ 13,
+ -25
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -19,
+ 17
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 16,
+ 4
+ ],
+ [
+ 13,
+ -16
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 5,
+ -12
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ -3,
+ -33
+ ],
+ [
+ 3,
+ -12
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -6,
+ 13
+ ],
+ [
+ -7,
+ 20
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -9,
+ 3
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ -4,
+ 11
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -12,
+ 27
+ ],
+ [
+ -13,
+ 21
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 7,
+ 4
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ -11,
+ 21
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -14,
+ -3
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -12,
+ 1
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -8,
+ 11
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 8,
+ -6
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 8,
+ 9
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -15,
+ -7
+ ],
+ [
+ -13,
+ -11
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 14,
+ 18
+ ],
+ [
+ 6,
+ 10
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ 0,
+ 19
+ ],
+ [
+ 3,
+ 4
+ ]
+ ],
+ [
+ [
+ 4083,
+ 7108
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -13,
+ 15
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 18,
+ -1
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -10,
+ -8
+ ]
+ ],
+ [
+ [
+ 4143,
+ 7082
+ ],
+ [
+ -1,
+ -31
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -8,
+ 2
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -14,
+ 2
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 11,
+ 31
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 10,
+ -19
+ ],
+ [
+ 12,
+ -27
+ ],
+ [
+ -4,
+ -26
+ ]
+ ],
+ [
+ [
+ 2114,
+ 7144
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 9,
+ 11
+ ],
+ [
+ 10,
+ 8
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -15,
+ -17
+ ]
+ ],
+ [
+ [
+ 2157,
+ 7160
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 10,
+ 7
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -5,
+ -2
+ ]
+ ],
+ [
+ [
+ 759,
+ 7182
+ ],
+ [
+ 12,
+ -3
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -10,
+ -10
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -12,
+ 12
+ ],
+ [
+ 1,
+ 5
+ ]
+ ],
+ [
+ [
+ 4086,
+ 7162
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -11,
+ 0
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 3,
+ 11
+ ],
+ [
+ 3,
+ 19
+ ],
+ [
+ 17,
+ -21
+ ],
+ [
+ 5,
+ -9
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -3,
+ -3
+ ]
+ ],
+ [
+ [
+ 3975,
+ 7222
+ ],
+ [
+ 5,
+ -13
+ ],
+ [
+ 9,
+ 1
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -3,
+ -18
+ ],
+ [
+ 1,
+ -19
+ ],
+ [
+ -1,
+ -18
+ ],
+ [
+ -5,
+ -19
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -5,
+ 24
+ ],
+ [
+ 4,
+ 40
+ ],
+ [
+ 10,
+ 8
+ ],
+ [
+ -6,
+ 11
+ ],
+ [
+ -12,
+ 13
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ -10,
+ 20
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 1,
+ 17
+ ],
+ [
+ 9,
+ 15
+ ],
+ [
+ 12,
+ 3
+ ],
+ [
+ 8,
+ -6
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 1,
+ -5
+ ]
+ ],
+ [
+ [
+ 4031,
+ 7253
+ ],
+ [
+ 6,
+ -6
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 11,
+ -6
+ ],
+ [
+ 7,
+ -8
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -8,
+ 12
+ ],
+ [
+ -10,
+ 21
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 6,
+ -11
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 5,
+ -9
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -15,
+ 2
+ ],
+ [
+ -9,
+ -5
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -1,
+ 15
+ ],
+ [
+ -2,
+ 22
+ ],
+ [
+ 0,
+ 16
+ ],
+ [
+ -7,
+ 16
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 9,
+ 5
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 31,
+ -11
+ ]
+ ],
+ [
+ [
+ 2265,
+ 7276
+ ],
+ [
+ -12,
+ -6
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -7,
+ -13
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ 1,
+ 15
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 31,
+ -3
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -6,
+ -1
+ ]
+ ],
+ [
+ [
+ 722,
+ 7287
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 24,
+ 7
+ ],
+ [
+ -4,
+ -11
+ ]
+ ],
+ [
+ [
+ 3886,
+ 7319
+ ],
+ [
+ 8,
+ -21
+ ],
+ [
+ 6,
+ -16
+ ],
+ [
+ 5,
+ -20
+ ],
+ [
+ 8,
+ -40
+ ],
+ [
+ 4,
+ -15
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 1,
+ -22
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 2,
+ -17
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -9,
+ 25
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 2,
+ 14
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -11,
+ -4
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ 11,
+ 18
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ -3,
+ 20
+ ],
+ [
+ -7,
+ 12
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -10,
+ -33
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -13,
+ -4
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ -5,
+ 25
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ 10,
+ 2
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 7,
+ 17
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 19,
+ -20
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 8,
+ -12
+ ]
+ ],
+ [
+ [
+ 2244,
+ 7414
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -10,
+ 9
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 12,
+ -7
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 5,
+ -9
+ ]
+ ],
+ [
+ [
+ 2274,
+ 7409
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 14,
+ 11
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 8,
+ -5
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 6,
+ -11
+ ],
+ [
+ 16,
+ -6
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -11,
+ -18
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -20,
+ 3
+ ],
+ [
+ -18,
+ 6
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 16,
+ -2
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -10,
+ -7
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -20,
+ -2
+ ],
+ [
+ -16,
+ -11
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -13,
+ -5
+ ],
+ [
+ 8,
+ -4
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -10,
+ -20
+ ],
+ [
+ -19,
+ -16
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 25,
+ 32
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -11,
+ 9
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 5,
+ 9
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -10,
+ 0
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 10,
+ 1
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -14,
+ 22
+ ],
+ [
+ -7,
+ 32
+ ],
+ [
+ -12,
+ 25
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 12,
+ 22
+ ],
+ [
+ 14,
+ 6
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 9,
+ 2
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 8,
+ -4
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 6,
+ -17
+ ],
+ [
+ 7,
+ -16
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -3,
+ 15
+ ],
+ [
+ -2,
+ 29
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 10,
+ -1
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 8,
+ -19
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 10,
+ -2
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 19,
+ -7
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ -5,
+ -14
+ ]
+ ],
+ [
+ [
+ 3818,
+ 7489
+ ],
+ [
+ 13,
+ -18
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 14,
+ 18
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 16,
+ -5
+ ],
+ [
+ 15,
+ -9
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ -4,
+ -26
+ ],
+ [
+ -11,
+ -5
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -10,
+ -9
+ ],
+ [
+ 8,
+ -7
+ ],
+ [
+ 25,
+ -2
+ ],
+ [
+ 7,
+ -14
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ -5,
+ -20
+ ],
+ [
+ -14,
+ 5
+ ],
+ [
+ -12,
+ 12
+ ],
+ [
+ -25,
+ 17
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 0,
+ -22
+ ],
+ [
+ -6,
+ -12
+ ],
+ [
+ -20,
+ 5
+ ],
+ [
+ -8,
+ 17
+ ],
+ [
+ -7,
+ 27
+ ],
+ [
+ -27,
+ 31
+ ],
+ [
+ -8,
+ 6
+ ],
+ [
+ -9,
+ 19
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 8,
+ 7
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 7,
+ -11
+ ],
+ [
+ 9,
+ -12
+ ],
+ [
+ 0,
+ 11
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 5,
+ 8
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 5,
+ -5
+ ]
+ ],
+ [
+ [
+ 3946,
+ 7486
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 7
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 12,
+ 4
+ ],
+ [
+ 11,
+ -9
+ ],
+ [
+ 8,
+ -11
+ ]
+ ],
+ [
+ [
+ 3912,
+ 7473
+ ],
+ [
+ 23,
+ -4
+ ],
+ [
+ 17,
+ 1
+ ],
+ [
+ 15,
+ -28
+ ],
+ [
+ 10,
+ -23
+ ],
+ [
+ 5,
+ -17
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ 5,
+ -15
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -9,
+ 10
+ ],
+ [
+ -6,
+ 20
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -6,
+ 19
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ 16,
+ -33
+ ],
+ [
+ 11,
+ -19
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 2,
+ -17
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ 6,
+ -16
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -15,
+ -7
+ ],
+ [
+ -15,
+ -29
+ ],
+ [
+ -15,
+ -17
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 8,
+ 36
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ -10,
+ 16
+ ],
+ [
+ -6,
+ 14
+ ],
+ [
+ -3,
+ 18
+ ],
+ [
+ -5,
+ 50
+ ],
+ [
+ -3,
+ 16
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ -5,
+ 10
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 10,
+ -18
+ ],
+ [
+ 4,
+ -13
+ ]
+ ],
+ [
+ [
+ 2318,
+ 7511
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 3,
+ 11
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 4,
+ -12
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -8,
+ -12
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -29,
+ 13
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ 24,
+ 29
+ ],
+ [
+ 12,
+ 11
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -7,
+ 9
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 15,
+ 7
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 6,
+ -5
+ ],
+ [
+ 6,
+ -8
+ ]
+ ],
+ [
+ [
+ 2312,
+ 7535
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -7,
+ 6
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 13,
+ 10
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -8,
+ -11
+ ]
+ ],
+ [
+ [
+ 1553,
+ 7553
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -6,
+ 19
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 9,
+ 12
+ ],
+ [
+ 20,
+ 10
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ -19,
+ -41
+ ]
+ ],
+ [
+ [
+ 3024,
+ 7789
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ 7,
+ 13
+ ],
+ [
+ 9,
+ 14
+ ],
+ [
+ 8,
+ 8
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -14,
+ -12
+ ],
+ [
+ -14,
+ -20
+ ]
+ ],
+ [
+ [
+ 2713,
+ 7836
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -18,
+ 3
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ 14,
+ 7
+ ],
+ [
+ 15,
+ -11
+ ],
+ [
+ -10,
+ -6
+ ]
+ ],
+ [
+ [
+ 2739,
+ 7788
+ ],
+ [
+ -10,
+ -2
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ 6,
+ 14
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 11,
+ 16
+ ],
+ [
+ 13,
+ 11
+ ],
+ [
+ 12,
+ 17
+ ],
+ [
+ 11,
+ 24
+ ],
+ [
+ 3,
+ 9
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 9,
+ -6
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -30,
+ -34
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -6,
+ -4
+ ]
+ ],
+ [
+ [
+ 1084,
+ 7897
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 8,
+ -8
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -16,
+ -3
+ ],
+ [
+ -16,
+ -1
+ ],
+ [
+ -14,
+ -8
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -26,
+ 6
+ ],
+ [
+ -32,
+ 23
+ ],
+ [
+ -14,
+ 5
+ ],
+ [
+ -14,
+ 16
+ ],
+ [
+ -13,
+ 21
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 37,
+ -4
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 12,
+ 5
+ ],
+ [
+ 11,
+ 8
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 10,
+ 5
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 4,
+ -3
+ ]
+ ],
+ [
+ [
+ 2974,
+ 7888
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ 14,
+ 12
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ -1,
+ -10
+ ]
+ ],
+ [
+ [
+ 2859,
+ 7910
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 18,
+ 2
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -20,
+ -8
+ ],
+ [
+ -16,
+ -11
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 6,
+ 7
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 15,
+ -6
+ ]
+ ],
+ [
+ [
+ 2746,
+ 7910
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ -4,
+ -15
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 4,
+ 17
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 3,
+ -8
+ ]
+ ],
+ [
+ [
+ 2353,
+ 7893
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ 6,
+ 10
+ ],
+ [
+ 4,
+ 18
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -9,
+ -19
+ ],
+ [
+ -3,
+ -2
+ ]
+ ],
+ [
+ [
+ 490,
+ 7911
+ ],
+ [
+ 20,
+ -12
+ ],
+ [
+ 12,
+ 1
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ -15,
+ 6
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -29,
+ 25
+ ],
+ [
+ -11,
+ 6
+ ],
+ [
+ 3,
+ 14
+ ],
+ [
+ 11,
+ 8
+ ],
+ [
+ 6,
+ -20
+ ],
+ [
+ 10,
+ -9
+ ]
+ ],
+ [
+ [
+ 2721,
+ 7982
+ ],
+ [
+ -11,
+ -2
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 1,
+ -9
+ ]
+ ],
+ [
+ [
+ 605,
+ 8518
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 9,
+ 1
+ ],
+ [
+ 13,
+ -2
+ ],
+ [
+ 15,
+ -4
+ ],
+ [
+ 14,
+ 1
+ ],
+ [
+ 18,
+ 14
+ ],
+ [
+ 11,
+ 4
+ ],
+ [
+ 11,
+ 2
+ ],
+ [
+ 12,
+ -3
+ ],
+ [
+ 11,
+ -8
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 22,
+ -9
+ ],
+ [
+ 14,
+ -3
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 11,
+ -5
+ ],
+ [
+ 12,
+ 2
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 25,
+ -7
+ ],
+ [
+ -4,
+ -18
+ ],
+ [
+ -8,
+ -8
+ ],
+ [
+ -23,
+ 2
+ ],
+ [
+ -23,
+ -2
+ ],
+ [
+ -10,
+ -10
+ ],
+ [
+ -8,
+ -12
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -5,
+ 20
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -11,
+ 6
+ ],
+ [
+ -12,
+ 4
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -10,
+ 5
+ ],
+ [
+ -28,
+ 13
+ ],
+ [
+ -10,
+ 1
+ ],
+ [
+ -10,
+ -1
+ ],
+ [
+ -10,
+ -6
+ ],
+ [
+ -10,
+ -8
+ ],
+ [
+ -10,
+ -6
+ ],
+ [
+ -11,
+ -2
+ ],
+ [
+ -10,
+ 4
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 5,
+ 23
+ ],
+ [
+ 9,
+ 5
+ ],
+ [
+ 16,
+ -17
+ ]
+ ],
+ [
+ [
+ 1087,
+ 9011
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 11,
+ 8
+ ],
+ [
+ 18,
+ 10
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -10,
+ -7
+ ],
+ [
+ -15,
+ -10
+ ]
+ ],
+ [
+ [
+ 1998,
+ 9891
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 15,
+ 4
+ ],
+ [
+ 11,
+ 7
+ ],
+ [
+ 24,
+ 23
+ ],
+ [
+ 8,
+ 13
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 21,
+ -3
+ ],
+ [
+ 11,
+ -6
+ ],
+ [
+ 13,
+ -12
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ 17,
+ -9
+ ],
+ [
+ 18,
+ -2
+ ],
+ [
+ 18,
+ -7
+ ],
+ [
+ 25,
+ 15
+ ],
+ [
+ 19,
+ 3
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 23,
+ 7
+ ],
+ [
+ 41,
+ -10
+ ],
+ [
+ 10,
+ 2
+ ],
+ [
+ 16,
+ -1
+ ],
+ [
+ 17,
+ -7
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ -18,
+ -15
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ 6,
+ -6
+ ],
+ [
+ 12,
+ -1
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 36,
+ 0
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -11,
+ -11
+ ],
+ [
+ 65,
+ -7
+ ],
+ [
+ 9,
+ 7
+ ],
+ [
+ 13,
+ 2
+ ],
+ [
+ 28,
+ 9
+ ],
+ [
+ 11,
+ -4
+ ],
+ [
+ 13,
+ -9
+ ],
+ [
+ 11,
+ -2
+ ],
+ [
+ 11,
+ 2
+ ],
+ [
+ 26,
+ 13
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 12,
+ -4
+ ],
+ [
+ 13,
+ 2
+ ],
+ [
+ 38,
+ -14
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 19,
+ -19
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 11,
+ 8
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ 16,
+ -3
+ ],
+ [
+ 7,
+ -12
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 58,
+ -9
+ ],
+ [
+ 29,
+ 4
+ ],
+ [
+ 41,
+ -1
+ ],
+ [
+ 21,
+ -6
+ ],
+ [
+ 21,
+ 1
+ ],
+ [
+ 34,
+ -21
+ ],
+ [
+ 18,
+ -3
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ 52,
+ -5
+ ],
+ [
+ 18,
+ 11
+ ],
+ [
+ 32,
+ 3
+ ],
+ [
+ 28,
+ 9
+ ],
+ [
+ 17,
+ 0
+ ],
+ [
+ 18,
+ -2
+ ],
+ [
+ 8,
+ 1
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 46,
+ -16
+ ],
+ [
+ 25,
+ -18
+ ],
+ [
+ 12,
+ -13
+ ],
+ [
+ 53,
+ -19
+ ],
+ [
+ 16,
+ -11
+ ],
+ [
+ 11,
+ -11
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 19,
+ -1
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -55
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 0,
+ -56
+ ],
+ [
+ 22,
+ -8
+ ],
+ [
+ 21,
+ -7
+ ],
+ [
+ 6,
+ 15
+ ],
+ [
+ 23,
+ -12
+ ],
+ [
+ 21,
+ -10
+ ],
+ [
+ 12,
+ 13
+ ],
+ [
+ 14,
+ 15
+ ],
+ [
+ 19,
+ 1
+ ],
+ [
+ 21,
+ 1
+ ],
+ [
+ 14,
+ 1
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -5,
+ -20
+ ],
+ [
+ -5,
+ -17
+ ],
+ [
+ 12,
+ -16
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 16,
+ -9
+ ],
+ [
+ 15,
+ -9
+ ],
+ [
+ 6,
+ -23
+ ],
+ [
+ 16,
+ -18
+ ],
+ [
+ 12,
+ -14
+ ],
+ [
+ 12,
+ -13
+ ],
+ [
+ 17,
+ -19
+ ],
+ [
+ 12,
+ -13
+ ],
+ [
+ 15,
+ -18
+ ],
+ [
+ 10,
+ -11
+ ],
+ [
+ 4,
+ -20
+ ],
+ [
+ 5,
+ -24
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 15,
+ 16
+ ],
+ [
+ 14,
+ 10
+ ],
+ [
+ 16,
+ 13
+ ],
+ [
+ 12,
+ 8
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 10,
+ 25
+ ],
+ [
+ 0,
+ 34
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ -7,
+ 14
+ ],
+ [
+ 20,
+ 6
+ ],
+ [
+ 15,
+ 5
+ ],
+ [
+ 21,
+ 12
+ ],
+ [
+ 20,
+ 13
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 19,
+ -22
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -2,
+ -11
+ ],
+ [
+ 12,
+ -29
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 10,
+ -4
+ ],
+ [
+ 11,
+ -10
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ 16,
+ -13
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 13,
+ -11
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 13,
+ -10
+ ],
+ [
+ 13,
+ -20
+ ],
+ [
+ 11,
+ -18
+ ],
+ [
+ 14,
+ -18
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ 13,
+ -22
+ ],
+ [
+ 14,
+ -28
+ ],
+ [
+ 10,
+ -24
+ ],
+ [
+ 8,
+ -14
+ ],
+ [
+ 9,
+ -20
+ ],
+ [
+ 11,
+ -24
+ ],
+ [
+ 13,
+ -28
+ ],
+ [
+ 10,
+ -17
+ ],
+ [
+ 12,
+ -25
+ ],
+ [
+ 7,
+ -15
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -5,
+ -13
+ ],
+ [
+ 16,
+ -6
+ ],
+ [
+ 12,
+ -4
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ -4,
+ -18
+ ],
+ [
+ 13,
+ -8
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 4,
+ -11
+ ],
+ [
+ 1,
+ -18
+ ],
+ [
+ 16,
+ 1
+ ],
+ [
+ 7,
+ 1
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 12,
+ -10
+ ],
+ [
+ 12,
+ -10
+ ],
+ [
+ 11,
+ -8
+ ],
+ [
+ 14,
+ -5
+ ],
+ [
+ 17,
+ -8
+ ],
+ [
+ 8,
+ -14
+ ],
+ [
+ 15,
+ -7
+ ],
+ [
+ 6,
+ -20
+ ],
+ [
+ 18,
+ -8
+ ],
+ [
+ 11,
+ 5
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -2,
+ -11
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 6,
+ -22
+ ],
+ [
+ 2,
+ -13
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -12,
+ -30
+ ],
+ [
+ -4,
+ -15
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -16,
+ -21
+ ],
+ [
+ -7,
+ -12
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -21,
+ 3
+ ],
+ [
+ -8,
+ 27
+ ],
+ [
+ -4,
+ 21
+ ],
+ [
+ -6,
+ 19
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 6,
+ 12
+ ],
+ [
+ 21,
+ 10
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ -3,
+ 24
+ ],
+ [
+ -6,
+ 14
+ ],
+ [
+ -13,
+ 29
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ -22,
+ -14
+ ],
+ [
+ -32,
+ -16
+ ],
+ [
+ -13,
+ -10
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -3,
+ -17
+ ],
+ [
+ -7,
+ -18
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -12,
+ 6
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ -7,
+ 23
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ 15,
+ 44
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 17,
+ 9
+ ],
+ [
+ -27,
+ 4
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -5,
+ 11
+ ],
+ [
+ -10,
+ 4
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -6,
+ 13
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ -14,
+ 6
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -9,
+ 14
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 2,
+ 16
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -49,
+ 24
+ ],
+ [
+ 2,
+ 31
+ ],
+ [
+ -9,
+ 42
+ ],
+ [
+ -10,
+ 16
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 19,
+ -13
+ ],
+ [
+ 18,
+ -14
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ -29,
+ 31
+ ],
+ [
+ -7,
+ 9
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 27,
+ -3
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ -27,
+ 9
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -6,
+ -13
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -7,
+ 16
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ -12,
+ 15
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ 2,
+ 15
+ ],
+ [
+ 10,
+ 34
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -8,
+ -26
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -6,
+ 11
+ ],
+ [
+ -14,
+ 13
+ ],
+ [
+ -16,
+ 3
+ ],
+ [
+ -10,
+ 13
+ ],
+ [
+ -15,
+ 37
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -8,
+ 6
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ -8,
+ 45
+ ],
+ [
+ -10,
+ 31
+ ],
+ [
+ -2,
+ 16
+ ],
+ [
+ 0,
+ 17
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ 6,
+ -13
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ 10,
+ -22
+ ],
+ [
+ 5,
+ -34
+ ],
+ [
+ 7,
+ -25
+ ],
+ [
+ 4,
+ -20
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ 8,
+ -32
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -14,
+ 4
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -8,
+ 14
+ ],
+ [
+ -11,
+ 7
+ ],
+ [
+ -27,
+ -3
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 3,
+ 22
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -14,
+ 32
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 19,
+ 15
+ ],
+ [
+ -9,
+ 1
+ ],
+ [
+ -8,
+ -6
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -4,
+ 20
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -1,
+ -20
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -24,
+ 8
+ ],
+ [
+ -14,
+ 10
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 12,
+ -6
+ ],
+ [
+ 12,
+ -8
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 11,
+ -8
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -7,
+ -12
+ ],
+ [
+ 15,
+ 2
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 11,
+ -19
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -30,
+ -4
+ ],
+ [
+ -11,
+ -16
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -15,
+ 13
+ ],
+ [
+ -19,
+ 12
+ ],
+ [
+ -42,
+ 35
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -6,
+ 2
+ ],
+ [
+ -8,
+ 9
+ ],
+ [
+ -10,
+ 15
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -20,
+ 20
+ ],
+ [
+ -10,
+ 8
+ ],
+ [
+ -9,
+ 4
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ -17,
+ 4
+ ],
+ [
+ -17,
+ 10
+ ],
+ [
+ -41,
+ 26
+ ],
+ [
+ -21,
+ 17
+ ],
+ [
+ -12,
+ 7
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 9,
+ 16
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ -5,
+ 12
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 10,
+ -15
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ -1,
+ -21
+ ],
+ [
+ 3,
+ -24
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 1,
+ 15
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 12,
+ -2
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ -23,
+ 11
+ ],
+ [
+ -14,
+ 20
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -8,
+ -8
+ ],
+ [
+ -21,
+ -27
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -27,
+ -15
+ ],
+ [
+ -19,
+ -3
+ ],
+ [
+ -20,
+ 2
+ ],
+ [
+ -18,
+ 5
+ ],
+ [
+ -44,
+ 24
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 10,
+ 15
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -3,
+ 15
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -13,
+ -5
+ ],
+ [
+ -39,
+ 12
+ ],
+ [
+ -40,
+ 10
+ ],
+ [
+ -36,
+ 2
+ ],
+ [
+ -50,
+ -8
+ ],
+ [
+ -27,
+ -8
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -15,
+ 1
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -9,
+ 13
+ ],
+ [
+ -13,
+ 7
+ ],
+ [
+ -18,
+ 3
+ ],
+ [
+ -10,
+ 4
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -10,
+ 4
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ 4,
+ 24
+ ],
+ [
+ 3,
+ 14
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -12,
+ -11
+ ],
+ [
+ -11,
+ -13
+ ],
+ [
+ -10,
+ -16
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -12,
+ 2
+ ],
+ [
+ -16,
+ 10
+ ],
+ [
+ -14,
+ 5
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ 8,
+ 9
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 7,
+ 12
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ -43,
+ 2
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -14,
+ -7
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 9,
+ 11
+ ],
+ [
+ -12,
+ 5
+ ],
+ [
+ -7,
+ 6
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 3,
+ 12
+ ],
+ [
+ 28,
+ 11
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -18,
+ -2
+ ],
+ [
+ -12,
+ -10
+ ],
+ [
+ -14,
+ -13
+ ],
+ [
+ -9,
+ -6
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -8,
+ -1
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -14,
+ -4
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -9,
+ 11
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 3,
+ 9
+ ],
+ [
+ 20,
+ 38
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -13,
+ -15
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 10,
+ 6
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -7,
+ -17
+ ],
+ [
+ -5,
+ -16
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -8,
+ -1
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 14,
+ -13
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 7,
+ -5
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -3,
+ -13
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -11,
+ 0
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -8,
+ -8
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 9,
+ 3
+ ],
+ [
+ 13,
+ 0
+ ],
+ [
+ 10,
+ 3
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 2,
+ -19
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -9,
+ -25
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -10,
+ -2
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -14,
+ 5
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -13,
+ -6
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -9,
+ 17
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -8,
+ -14
+ ],
+ [
+ -5,
+ -24
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -5,
+ 21
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -7,
+ -12
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -15,
+ 8
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 5,
+ -12
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -21,
+ -24
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -14,
+ -9
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -16,
+ -16
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -10,
+ 6
+ ],
+ [
+ -10,
+ 5
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -10,
+ -3
+ ],
+ [
+ -13,
+ -8
+ ],
+ [
+ -10,
+ 0
+ ],
+ [
+ -15,
+ 14
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 3,
+ 11
+ ],
+ [
+ 5,
+ 8
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 14,
+ 10
+ ],
+ [
+ 16,
+ 4
+ ],
+ [
+ 10,
+ 7
+ ],
+ [
+ 13,
+ 13
+ ],
+ [
+ 6,
+ 10
+ ],
+ [
+ 13,
+ 25
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -28,
+ -24
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -23,
+ 9
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -4,
+ 11
+ ],
+ [
+ 7,
+ 27
+ ],
+ [
+ 4,
+ 13
+ ],
+ [
+ 11,
+ 20
+ ],
+ [
+ 15,
+ 21
+ ],
+ [
+ 5,
+ 13
+ ],
+ [
+ 7,
+ 37
+ ],
+ [
+ 0,
+ 17
+ ],
+ [
+ -4,
+ 20
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 33,
+ 18
+ ],
+ [
+ 16,
+ 14
+ ],
+ [
+ 30,
+ 21
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 8,
+ -4
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 13,
+ 5
+ ],
+ [
+ 20,
+ -1
+ ],
+ [
+ 41,
+ -14
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ -7,
+ 9
+ ],
+ [
+ -28,
+ 6
+ ],
+ [
+ -12,
+ 5
+ ],
+ [
+ -34,
+ 25
+ ],
+ [
+ -8,
+ 9
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 9,
+ 3
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 9,
+ 11
+ ],
+ [
+ 12,
+ 10
+ ],
+ [
+ 24,
+ 15
+ ],
+ [
+ -9,
+ 1
+ ],
+ [
+ -17,
+ -3
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -11,
+ -11
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -6,
+ -15
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -12,
+ -2
+ ],
+ [
+ -32,
+ -2
+ ],
+ [
+ -6,
+ 8
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -30,
+ -20
+ ],
+ [
+ -11,
+ -10
+ ],
+ [
+ -7,
+ -11
+ ],
+ [
+ -12,
+ -8
+ ],
+ [
+ -16,
+ -6
+ ],
+ [
+ -12,
+ -6
+ ],
+ [
+ -13,
+ -13
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -8,
+ -1
+ ],
+ [
+ -11,
+ -10
+ ],
+ [
+ -25,
+ -29
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -15,
+ -13
+ ],
+ [
+ -11,
+ -6
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -11,
+ 9
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 12,
+ -9
+ ],
+ [
+ 13,
+ -12
+ ],
+ [
+ 7,
+ -10
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -9,
+ -14
+ ],
+ [
+ -9,
+ -4
+ ],
+ [
+ -22,
+ -5
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 16,
+ -6
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -2,
+ -12
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -13,
+ -8
+ ],
+ [
+ -11,
+ -2
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -15,
+ -14
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -8,
+ -10
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -25,
+ -21
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ -6,
+ -18
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 20,
+ -8
+ ],
+ [
+ 10,
+ -2
+ ],
+ [
+ 12,
+ -5
+ ],
+ [
+ 22,
+ -15
+ ],
+ [
+ 7,
+ -10
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -7,
+ -12
+ ],
+ [
+ -16,
+ -19
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -12,
+ -4
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -14,
+ -18
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -19,
+ -11
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -11,
+ 0
+ ],
+ [
+ -15,
+ -6
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -38,
+ -7
+ ],
+ [
+ -8,
+ -20
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -15,
+ -14
+ ],
+ [
+ -9,
+ -6
+ ],
+ [
+ -10,
+ -3
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -16,
+ -3
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -18,
+ -17
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -7,
+ -19
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -9,
+ -5
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -7,
+ -10
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -9,
+ 4
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -15,
+ -10
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -15,
+ -5
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -11,
+ -19
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ -14,
+ -16
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -7,
+ -21
+ ],
+ [
+ -7,
+ -11
+ ],
+ [
+ -58,
+ -28
+ ],
+ [
+ -8,
+ -6
+ ],
+ [
+ -2,
+ -12
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 0,
+ 28
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -18,
+ -19
+ ],
+ [
+ -12,
+ -5
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -12,
+ 6
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -18,
+ -4
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 10,
+ -3
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -9,
+ 6
+ ],
+ [
+ -9,
+ 4
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -4,
+ -21
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -21,
+ -36
+ ],
+ [
+ -9,
+ -12
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 3,
+ -28
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -13,
+ -9
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -11,
+ 18
+ ],
+ [
+ -12,
+ 3
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ -8,
+ -10
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 15,
+ 14
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ 12,
+ 11
+ ],
+ [
+ 13,
+ 18
+ ],
+ [
+ 15,
+ 28
+ ],
+ [
+ 17,
+ 24
+ ],
+ [
+ 20,
+ 20
+ ],
+ [
+ 21,
+ 16
+ ],
+ [
+ 44,
+ 21
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 16,
+ 4
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -10,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 13,
+ -22
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 8,
+ -3
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -15,
+ 13
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 8,
+ 19
+ ],
+ [
+ 7,
+ 14
+ ],
+ [
+ 14,
+ 16
+ ],
+ [
+ 9,
+ 8
+ ],
+ [
+ 23,
+ 23
+ ],
+ [
+ 45,
+ 25
+ ],
+ [
+ 12,
+ 15
+ ],
+ [
+ 15,
+ 17
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 10,
+ -4
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 7,
+ 14
+ ],
+ [
+ 10,
+ 16
+ ],
+ [
+ 14,
+ 19
+ ],
+ [
+ 9,
+ 8
+ ],
+ [
+ 8,
+ 5
+ ],
+ [
+ 8,
+ 8
+ ],
+ [
+ 13,
+ 20
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 10,
+ -3
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ 6,
+ 29
+ ],
+ [
+ 1,
+ 29
+ ],
+ [
+ 5,
+ 17
+ ],
+ [
+ 10,
+ 7
+ ],
+ [
+ 22,
+ 4
+ ],
+ [
+ -13,
+ 7
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -3,
+ 19
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 21,
+ 26
+ ],
+ [
+ 23,
+ 18
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ 11,
+ 36
+ ],
+ [
+ 10,
+ 33
+ ],
+ [
+ -14,
+ -28
+ ],
+ [
+ -16,
+ -21
+ ],
+ [
+ -47,
+ -25
+ ],
+ [
+ -32,
+ -20
+ ],
+ [
+ -15,
+ -5
+ ],
+ [
+ -10,
+ 5
+ ],
+ [
+ -8,
+ 20
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -5,
+ 13
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ 4,
+ 11
+ ],
+ [
+ 10,
+ 2
+ ],
+ [
+ 12,
+ -5
+ ],
+ [
+ 10,
+ -1
+ ],
+ [
+ -13,
+ 11
+ ],
+ [
+ -18,
+ 10
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -6,
+ -16
+ ],
+ [
+ -8,
+ -11
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ 3,
+ -13
+ ],
+ [
+ -6,
+ -21
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ 8,
+ -38
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -15,
+ -7
+ ],
+ [
+ -12,
+ 12
+ ],
+ [
+ -24,
+ 48
+ ],
+ [
+ -9,
+ 14
+ ],
+ [
+ -19,
+ 22
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -8,
+ -11
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -21,
+ 16
+ ],
+ [
+ -10,
+ 13
+ ],
+ [
+ -9,
+ 15
+ ],
+ [
+ -14,
+ -8
+ ],
+ [
+ -12,
+ -10
+ ],
+ [
+ -15,
+ -16
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -26,
+ -14
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ -36,
+ -11
+ ],
+ [
+ -35,
+ 7
+ ],
+ [
+ 12,
+ 7
+ ],
+ [
+ 14,
+ 6
+ ],
+ [
+ 12,
+ 15
+ ],
+ [
+ -5,
+ 20
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 13,
+ 18
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -9,
+ -6
+ ],
+ [
+ -8,
+ 13
+ ],
+ [
+ -4,
+ 26
+ ],
+ [
+ 9,
+ 16
+ ],
+ [
+ 5,
+ 12
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 1,
+ 15
+ ],
+ [
+ -8,
+ 23
+ ],
+ [
+ -20,
+ 51
+ ],
+ [
+ -10,
+ 38
+ ],
+ [
+ -16,
+ 20
+ ],
+ [
+ 12,
+ 33
+ ],
+ [
+ 14,
+ 30
+ ],
+ [
+ 17,
+ 14
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -10,
+ -1
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -6,
+ -8
+ ],
+ [
+ -18,
+ -38
+ ],
+ [
+ -12,
+ -18
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ 12,
+ -7
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 2,
+ -14
+ ],
+ [
+ -3,
+ -17
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -15,
+ 1
+ ],
+ [
+ -13,
+ -14
+ ],
+ [
+ -31,
+ -14
+ ],
+ [
+ -41,
+ -9
+ ],
+ [
+ -20,
+ 1
+ ],
+ [
+ -22,
+ 17
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ -30,
+ 29
+ ],
+ [
+ -17,
+ 30
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ -10,
+ 7
+ ],
+ [
+ -13,
+ 13
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ -8,
+ 5
+ ],
+ [
+ -10,
+ 0
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ 30,
+ 38
+ ],
+ [
+ 10,
+ 25
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 11,
+ -4
+ ],
+ [
+ 15,
+ -10
+ ],
+ [
+ 13,
+ -4
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ -5,
+ -15
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 16,
+ 16
+ ],
+ [
+ 12,
+ 14
+ ],
+ [
+ 6,
+ -1
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 6,
+ -15
+ ],
+ [
+ 9,
+ -15
+ ],
+ [
+ 18,
+ 15
+ ],
+ [
+ 9,
+ 17
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -10,
+ 5
+ ],
+ [
+ -25,
+ 6
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 16,
+ -1
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -8,
+ 6
+ ],
+ [
+ -22,
+ -20
+ ],
+ [
+ -40,
+ 1
+ ],
+ [
+ -29,
+ 12
+ ],
+ [
+ -28,
+ -2
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ 15,
+ 15
+ ],
+ [
+ 12,
+ 8
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -13,
+ -4
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 0,
+ -12
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -5,
+ 12
+ ],
+ [
+ -6,
+ 26
+ ],
+ [
+ -15,
+ 7
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ 10,
+ 16
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -10,
+ 3
+ ],
+ [
+ -12,
+ -9
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 24,
+ 6
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ -19,
+ 10
+ ],
+ [
+ -6,
+ 11
+ ],
+ [
+ 8,
+ 6
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 20,
+ 6
+ ],
+ [
+ -8,
+ 11
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ 4,
+ 16
+ ],
+ [
+ 23,
+ 39
+ ],
+ [
+ 23,
+ 33
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ 10,
+ -3
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -5,
+ 13
+ ],
+ [
+ 14,
+ 5
+ ],
+ [
+ 9,
+ 15
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -9,
+ -10
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ -3,
+ 24
+ ],
+ [
+ 4,
+ 22
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 23,
+ 4
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ -14,
+ 14
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 28,
+ 9
+ ],
+ [
+ 14,
+ -3
+ ],
+ [
+ 19,
+ -10
+ ],
+ [
+ 11,
+ -13
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 8,
+ 8
+ ],
+ [
+ 13,
+ 9
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 21,
+ 6
+ ],
+ [
+ 10,
+ 7
+ ],
+ [
+ 12,
+ 17
+ ],
+ [
+ 17,
+ 12
+ ],
+ [
+ 24,
+ 35
+ ],
+ [
+ 7,
+ 15
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 5,
+ -12
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 43,
+ 3
+ ],
+ [
+ 21,
+ 6
+ ],
+ [
+ 15,
+ 11
+ ],
+ [
+ 16,
+ 20
+ ],
+ [
+ 9,
+ 13
+ ],
+ [
+ 4,
+ 17
+ ],
+ [
+ -6,
+ 22
+ ],
+ [
+ -5,
+ 19
+ ],
+ [
+ -8,
+ 42
+ ],
+ [
+ -21,
+ 27
+ ],
+ [
+ -15,
+ 9
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ 7,
+ 18
+ ],
+ [
+ 20,
+ -2
+ ],
+ [
+ 13,
+ 4
+ ],
+ [
+ 10,
+ 8
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 5,
+ 14
+ ],
+ [
+ -2,
+ 14
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -7,
+ 9
+ ],
+ [
+ -9,
+ 12
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -25,
+ -25
+ ],
+ [
+ -15,
+ 0
+ ],
+ [
+ -11,
+ 4
+ ],
+ [
+ -10,
+ -14
+ ],
+ [
+ -27,
+ -12
+ ],
+ [
+ -15,
+ -13
+ ],
+ [
+ -27,
+ -30
+ ],
+ [
+ -7,
+ -14
+ ],
+ [
+ -8,
+ -1
+ ],
+ [
+ -7,
+ 27
+ ],
+ [
+ -29,
+ 26
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 11,
+ -2
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -11,
+ 10
+ ],
+ [
+ -20,
+ 14
+ ],
+ [
+ -20,
+ 8
+ ],
+ [
+ -53,
+ -1
+ ],
+ [
+ -35,
+ -15
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -7,
+ -1
+ ],
+ [
+ -14,
+ 2
+ ],
+ [
+ -28,
+ 9
+ ],
+ [
+ -62,
+ 14
+ ],
+ [
+ -17,
+ 8
+ ],
+ [
+ -14,
+ 19
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ -1,
+ 19
+ ],
+ [
+ -12,
+ 5
+ ],
+ [
+ -25,
+ 28
+ ],
+ [
+ -9,
+ 11
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ 21,
+ 4
+ ],
+ [
+ 7,
+ 17
+ ],
+ [
+ 15,
+ 6
+ ],
+ [
+ 15,
+ -3
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -37,
+ 9
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -67,
+ 16
+ ],
+ [
+ -52,
+ 28
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -4,
+ 12
+ ],
+ [
+ 7,
+ 11
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 30,
+ 15
+ ],
+ [
+ 16,
+ 19
+ ],
+ [
+ 30,
+ 4
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 9,
+ 10
+ ],
+ [
+ 13,
+ 18
+ ],
+ [
+ 19,
+ 9
+ ],
+ [
+ 13,
+ 9
+ ],
+ [
+ 16,
+ 4
+ ],
+ [
+ 14,
+ -8
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 25,
+ -2
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ -25,
+ 15
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 29,
+ 17
+ ],
+ [
+ 23,
+ 6
+ ],
+ [
+ 12,
+ -1
+ ],
+ [
+ 35,
+ 23
+ ],
+ [
+ 19,
+ 6
+ ],
+ [
+ 36,
+ 4
+ ],
+ [
+ 30,
+ 1
+ ],
+ [
+ 8,
+ -7
+ ],
+ [
+ -16,
+ 1
+ ],
+ [
+ -7,
+ -1
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -10,
+ -22
+ ],
+ [
+ 1,
+ -17
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -6,
+ -8
+ ],
+ [
+ 31,
+ -25
+ ],
+ [
+ 47,
+ -2
+ ],
+ [
+ 25,
+ 5
+ ],
+ [
+ 15,
+ -8
+ ],
+ [
+ 12,
+ -1
+ ],
+ [
+ 34,
+ 4
+ ],
+ [
+ 25,
+ -6
+ ],
+ [
+ 11,
+ 2
+ ],
+ [
+ 23,
+ 38
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 13,
+ -5
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 7,
+ -10
+ ],
+ [
+ -3,
+ 20
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ -38,
+ 14
+ ],
+ [
+ -25,
+ -7
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ 2,
+ 16
+ ],
+ [
+ -27,
+ 38
+ ],
+ [
+ -11,
+ 8
+ ],
+ [
+ -14,
+ 0
+ ],
+ [
+ -7,
+ 13
+ ],
+ [
+ -6,
+ 17
+ ],
+ [
+ 12,
+ 7
+ ],
+ [
+ 11,
+ 4
+ ],
+ [
+ 9,
+ -6
+ ],
+ [
+ 11,
+ -22
+ ],
+ [
+ 11,
+ -4
+ ],
+ [
+ -3,
+ -22
+ ],
+ [
+ 12,
+ -20
+ ],
+ [
+ 29,
+ -19
+ ],
+ [
+ 23,
+ 7
+ ],
+ [
+ 16,
+ -1
+ ],
+ [
+ 10,
+ -4
+ ],
+ [
+ 23,
+ -17
+ ],
+ [
+ 12,
+ -2
+ ],
+ [
+ 38,
+ 9
+ ],
+ [
+ 0,
+ 17
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -25,
+ -2
+ ],
+ [
+ -20,
+ 13
+ ],
+ [
+ -17,
+ -4
+ ],
+ [
+ -31,
+ -19
+ ],
+ [
+ -15,
+ 8
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -16,
+ 10
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ 13,
+ 23
+ ],
+ [
+ 10,
+ 11
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -22,
+ 5
+ ],
+ [
+ -38,
+ -6
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ -15,
+ -16
+ ],
+ [
+ -16,
+ 4
+ ],
+ [
+ -22,
+ -2
+ ],
+ [
+ -48,
+ 14
+ ],
+ [
+ -17,
+ 18
+ ],
+ [
+ -7,
+ 14
+ ],
+ [
+ -13,
+ 40
+ ],
+ [
+ -16,
+ 24
+ ],
+ [
+ -113,
+ 84
+ ],
+ [
+ -52,
+ 21
+ ],
+ [
+ -25,
+ 23
+ ],
+ [
+ -15,
+ 6
+ ],
+ [
+ -15,
+ 2
+ ],
+ [
+ -19,
+ 8
+ ],
+ [
+ 13,
+ 9
+ ],
+ [
+ 8,
+ 3
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 11,
+ 6
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 9,
+ 29
+ ],
+ [
+ 9,
+ 42
+ ],
+ [
+ -2,
+ 17
+ ],
+ [
+ 63,
+ -3
+ ],
+ [
+ 41,
+ 3
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 53,
+ 7
+ ],
+ [
+ 14,
+ 5
+ ],
+ [
+ 25,
+ 14
+ ],
+ [
+ 30,
+ 25
+ ],
+ [
+ 26,
+ 34
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 2,
+ 13
+ ],
+ [
+ 4,
+ 29
+ ],
+ [
+ 12,
+ 28
+ ],
+ [
+ 55,
+ 65
+ ],
+ [
+ 25,
+ 25
+ ],
+ [
+ 8,
+ 11
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -8,
+ -8
+ ],
+ [
+ -12,
+ -6
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 7,
+ 1
+ ],
+ [
+ 21,
+ 6
+ ],
+ [
+ 12,
+ 7
+ ],
+ [
+ 57,
+ 14
+ ],
+ [
+ 32,
+ 22
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 46,
+ 27
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ -13,
+ -18
+ ],
+ [
+ 9,
+ -5
+ ],
+ [
+ -8,
+ -22
+ ],
+ [
+ 17,
+ 0
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ 11,
+ -3
+ ],
+ [
+ 27,
+ 9
+ ],
+ [
+ -32,
+ 1
+ ],
+ [
+ -20,
+ 19
+ ],
+ [
+ -10,
+ 1
+ ],
+ [
+ 36,
+ 29
+ ],
+ [
+ 33,
+ 17
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 16,
+ 5
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 34,
+ 0
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 44,
+ 1
+ ],
+ [
+ 8,
+ 3
+ ],
+ [
+ 27,
+ 15
+ ],
+ [
+ 25,
+ 19
+ ],
+ [
+ 12,
+ 10
+ ],
+ [
+ 20,
+ 26
+ ],
+ [
+ 17,
+ 17
+ ],
+ [
+ 28,
+ 17
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -6,
+ -8
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 60,
+ -20
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 6,
+ -12
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -15,
+ -13
+ ],
+ [
+ -31,
+ -12
+ ],
+ [
+ 10,
+ -5
+ ],
+ [
+ 6,
+ -12
+ ]
+ ],
+ [
+ [
+ 8103,
+ 2152
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ -11,
+ 1
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 3,
+ -4
+ ]
+ ],
+ [
+ [
+ 8156,
+ 2176
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -9,
+ -19
+ ],
+ [
+ -35,
+ -7
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 7,
+ 1
+ ],
+ [
+ 11,
+ 6
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ 1,
+ 21
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ -5,
+ 13
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -4,
+ -22
+ ],
+ [
+ -4,
+ -29
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -10,
+ -1
+ ],
+ [
+ -9,
+ 2
+ ],
+ [
+ -4,
+ 0
+ ]
+ ],
+ [
+ [
+ 8074,
+ 2175
+ ],
+ [
+ -1,
+ 39
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ -1,
+ 35
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ -1,
+ 36
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 3,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 36
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 3,
+ 35
+ ],
+ [
+ 2,
+ 36
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 3,
+ 36
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -8,
+ 12
+ ]
+ ],
+ [
+ [
+ 8094,
+ 3057
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ -1
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ -1
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ -1
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 14,
+ 0
+ ]
+ ],
+ [
+ [
+ 8323,
+ 3058
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -24
+ ],
+ [
+ 2,
+ -25
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 1,
+ -18
+ ],
+ [
+ 13,
+ -53
+ ],
+ [
+ 4,
+ -22
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -6,
+ -8
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -6,
+ -32
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 5,
+ -27
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -3,
+ -53
+ ],
+ [
+ 2,
+ -34
+ ],
+ [
+ 6,
+ -22
+ ]
+ ],
+ [
+ [
+ 8379,
+ 2295
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -30,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -29,
+ 0
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ 3,
+ -12
+ ],
+ [
+ 13,
+ -24
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -2,
+ -18
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ 0,
+ -7
+ ]
+ ],
+ [
+ [
+ 7956,
+ 3248
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -11,
+ -10
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ 1,
+ -17
+ ],
+ [
+ -3,
+ -17
+ ],
+ [
+ -9,
+ -17
+ ],
+ [
+ -4,
+ -19
+ ],
+ [
+ 1,
+ -21
+ ],
+ [
+ -4,
+ -17
+ ],
+ [
+ -10,
+ -13
+ ],
+ [
+ -4,
+ -8
+ ]
+ ],
+ [
+ [
+ 7903,
+ 3058
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ -13
+ ],
+ [
+ -2,
+ -30
+ ],
+ [
+ -4,
+ -17
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -8,
+ -12
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -9,
+ -5
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -2,
+ -15
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -4,
+ -34
+ ],
+ [
+ 0,
+ -5
+ ]
+ ],
+ [
+ [
+ 7826,
+ 2679
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -16,
+ -1
+ ],
+ [
+ -17,
+ 0
+ ]
+ ],
+ [
+ [
+ 7566,
+ 2678
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -8,
+ 2
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ 10
+ ]
+ ],
+ [
+ [
+ 7527,
+ 2800
+ ],
+ [
+ 0,
+ 20
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 1,
+ 21
+ ],
+ [
+ 0,
+ 20
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 1,
+ 21
+ ],
+ [
+ 0,
+ 20
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 1,
+ 20
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ 1,
+ 20
+ ],
+ [
+ -2,
+ 27
+ ],
+ [
+ -2,
+ 26
+ ],
+ [
+ -2,
+ 27
+ ],
+ [
+ -2,
+ 26
+ ],
+ [
+ -2,
+ 27
+ ],
+ [
+ -2,
+ 27
+ ],
+ [
+ -2,
+ 26
+ ],
+ [
+ -2,
+ 27
+ ]
+ ],
+ [
+ [
+ 7515,
+ 3344
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 4,
+ -15
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -7,
+ -16
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -7,
+ -20
+ ],
+ [
+ 14,
+ 0
+ ],
+ [
+ 15,
+ 1
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 16,
+ 0
+ ]
+ ],
+ [
+ [
+ 6217,
+ 3439
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -67
+ ],
+ [
+ 0,
+ -68
+ ],
+ [
+ 0,
+ -68
+ ]
+ ],
+ [
+ [
+ 6217,
+ 2357
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -32,
+ 0
+ ],
+ [
+ -32,
+ 0
+ ],
+ [
+ -32,
+ 0
+ ],
+ [
+ -31,
+ 0
+ ],
+ [
+ -32,
+ 0
+ ],
+ [
+ -43,
+ 28
+ ],
+ [
+ -42,
+ 28
+ ],
+ [
+ -43,
+ 28
+ ],
+ [
+ -43,
+ 29
+ ],
+ [
+ -42,
+ 28
+ ],
+ [
+ -43,
+ 28
+ ],
+ [
+ -43,
+ 28
+ ],
+ [
+ -42,
+ 28
+ ],
+ [
+ 4,
+ 11
+ ],
+ [
+ 6,
+ 29
+ ]
+ ],
+ [
+ [
+ 5707,
+ 2622
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 13,
+ 2
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 4,
+ 13
+ ],
+ [
+ 1,
+ 13
+ ],
+ [
+ -2,
+ 14
+ ],
+ [
+ -6,
+ 10
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ -5,
+ 19
+ ],
+ [
+ -2,
+ 30
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 5,
+ 8
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ 3,
+ 14
+ ],
+ [
+ 2,
+ 15
+ ],
+ [
+ 0,
+ 19
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ 8,
+ 29
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ 15,
+ 21
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -14,
+ 14
+ ],
+ [
+ -5,
+ 11
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ -14,
+ 39
+ ],
+ [
+ -5,
+ 22
+ ],
+ [
+ 0,
+ 16
+ ]
+ ],
+ [
+ [
+ 5717,
+ 3056
+ ],
+ [
+ 0,
+ 1
+ ],
+ [
+ 2,
+ 68
+ ],
+ [
+ -5,
+ 23
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ 0,
+ 19
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 3,
+ 13
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 5,
+ 19
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 0,
+ 82
+ ],
+ [
+ 0,
+ 75
+ ]
+ ],
+ [
+ [
+ 5768,
+ 3440
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ -1
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ]
+ ],
+ [
+ [
+ 5381,
+ 2643
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -5,
+ 19
+ ],
+ [
+ -6,
+ 14
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ 11,
+ -21
+ ],
+ [
+ 3,
+ -4
+ ]
+ ],
+ [
+ [
+ 5283,
+ 2718
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -6,
+ 2
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ 0,
+ -2
+ ]
+ ],
+ [
+ [
+ 5381,
+ 2750
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ 0,
+ 1
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 15,
+ -12
+ ],
+ [
+ 4,
+ -5
+ ]
+ ],
+ [
+ [
+ 5229,
+ 2851
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -7,
+ 18
+ ],
+ [
+ 16,
+ 3
+ ],
+ [
+ 7,
+ -8
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -5,
+ -11
+ ]
+ ],
+ [
+ [
+ 5205,
+ 2872
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 4,
+ -6
+ ]
+ ],
+ [
+ [
+ 5243,
+ 2882
+ ],
+ [
+ 18,
+ -10
+ ],
+ [
+ 10,
+ 5
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -22,
+ -7
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 3,
+ 2
+ ]
+ ],
+ [
+ [
+ 5232,
+ 4392
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 22,
+ -31
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 21,
+ -32
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 21,
+ -31
+ ],
+ [
+ 16,
+ -26
+ ],
+ [
+ 17,
+ -27
+ ],
+ [
+ 16,
+ -26
+ ],
+ [
+ 17,
+ -26
+ ],
+ [
+ 16,
+ -27
+ ],
+ [
+ 17,
+ -26
+ ],
+ [
+ 16,
+ -26
+ ],
+ [
+ 17,
+ -26
+ ],
+ [
+ 23,
+ -38
+ ],
+ [
+ 22,
+ -38
+ ],
+ [
+ 23,
+ -38
+ ],
+ [
+ 23,
+ -38
+ ],
+ [
+ 23,
+ -37
+ ],
+ [
+ 23,
+ -38
+ ],
+ [
+ 23,
+ -38
+ ],
+ [
+ 24,
+ -40
+ ]
+ ],
+ [
+ [
+ 5707,
+ 2622
+ ],
+ [
+ -11,
+ -2
+ ],
+ [
+ -25,
+ -4
+ ],
+ [
+ -26,
+ -4
+ ],
+ [
+ -26,
+ -4
+ ],
+ [
+ -25,
+ -4
+ ],
+ [
+ -26,
+ -5
+ ],
+ [
+ -26,
+ -4
+ ],
+ [
+ -26,
+ -4
+ ],
+ [
+ -25,
+ -4
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -2,
+ 27
+ ],
+ [
+ 1,
+ 13
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ -5,
+ 31
+ ],
+ [
+ -14,
+ 37
+ ],
+ [
+ -29,
+ 47
+ ],
+ [
+ -14,
+ 15
+ ],
+ [
+ -12,
+ 20
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ -10,
+ 2
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -11,
+ 6
+ ],
+ [
+ 2,
+ 22
+ ],
+ [
+ -10,
+ 30
+ ],
+ [
+ -9,
+ 3
+ ],
+ [
+ -21,
+ -2
+ ],
+ [
+ -28,
+ 17
+ ],
+ [
+ -8,
+ 10
+ ],
+ [
+ -3,
+ 18
+ ],
+ [
+ -13,
+ 15
+ ],
+ [
+ -17,
+ 15
+ ],
+ [
+ -10,
+ -3
+ ],
+ [
+ -12,
+ 2
+ ],
+ [
+ -18,
+ 11
+ ],
+ [
+ -11,
+ 2
+ ],
+ [
+ -20,
+ -4
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -7,
+ 13
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ -3,
+ 26
+ ],
+ [
+ 2,
+ 24
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -14,
+ 9
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -12,
+ 10
+ ],
+ [
+ -10,
+ 24
+ ],
+ [
+ -13,
+ 13
+ ],
+ [
+ -5,
+ 23
+ ],
+ [
+ -8,
+ 13
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -18,
+ 43
+ ],
+ [
+ -19,
+ 34
+ ],
+ [
+ -3,
+ 20
+ ],
+ [
+ -1,
+ 26
+ ],
+ [
+ 7,
+ 16
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -7,
+ 17
+ ],
+ [
+ -25,
+ 10
+ ],
+ [
+ -21,
+ 41
+ ],
+ [
+ -1,
+ 32
+ ],
+ [
+ -8,
+ 32
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -2,
+ 23
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 1,
+ -16
+ ],
+ [
+ 7,
+ -12
+ ],
+ [
+ 6,
+ -6
+ ],
+ [
+ 6,
+ -12
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -3,
+ 16
+ ],
+ [
+ -5,
+ 20
+ ],
+ [
+ -7,
+ 11
+ ],
+ [
+ -3,
+ 21
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 12,
+ 2
+ ],
+ [
+ 33,
+ -3
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -5,
+ -1
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -12,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -6,
+ 6
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -11,
+ -11
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -12,
+ 12
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -1,
+ -29
+ ],
+ [
+ 3,
+ -22
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -9,
+ 6
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -10,
+ 15
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -6,
+ -13
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 3,
+ 15
+ ],
+ [
+ -1,
+ 25
+ ],
+ [
+ 9,
+ -20
+ ],
+ [
+ -3,
+ 14
+ ],
+ [
+ -7,
+ 15
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -7,
+ 27
+ ],
+ [
+ -15,
+ 17
+ ],
+ [
+ -12,
+ 26
+ ],
+ [
+ -25,
+ 44
+ ],
+ [
+ -2,
+ 39
+ ],
+ [
+ -9,
+ 49
+ ],
+ [
+ 4,
+ 28
+ ],
+ [
+ -1,
+ 20
+ ],
+ [
+ -4,
+ 30
+ ],
+ [
+ -5,
+ 16
+ ],
+ [
+ -20,
+ 45
+ ],
+ [
+ -19,
+ 30
+ ],
+ [
+ -3,
+ 23
+ ],
+ [
+ -2,
+ 22
+ ],
+ [
+ 5,
+ 21
+ ],
+ [
+ 3,
+ 21
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 6,
+ 28
+ ],
+ [
+ -1,
+ 35
+ ],
+ [
+ 7,
+ 44
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ -4,
+ 31
+ ],
+ [
+ -4,
+ 19
+ ],
+ [
+ -7,
+ 13
+ ],
+ [
+ 3,
+ 19
+ ],
+ [
+ 0,
+ 18
+ ],
+ [
+ -2,
+ 3
+ ]
+ ],
+ [
+ [
+ 4852,
+ 4392
+ ],
+ [
+ 25,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ]
+ ],
+ [
+ [
+ 6849,
+ 4011
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 1,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -35
+ ],
+ [
+ 0,
+ -36
+ ]
+ ],
+ [
+ [
+ 6850,
+ 3439
+ ],
+ [
+ -22,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -22,
+ 0
+ ],
+ [
+ -22,
+ 0
+ ]
+ ],
+ [
+ [
+ 6761,
+ 3439
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ]
+ ],
+ [
+ [
+ 6217,
+ 3439
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ]
+ ],
+ [
+ [
+ 6217,
+ 4202
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ]
+ ],
+ [
+ [
+ 6669,
+ 4202
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -23
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ]
+ ],
+ [
+ [
+ 9566,
+ 4394
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 0,
+ -14
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 0,
+ -14
+ ],
+ [
+ 0,
+ -16
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ 0,
+ -12
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -2,
+ -11
+ ]
+ ],
+ [
+ [
+ 9562,
+ 4265
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -13,
+ -2
+ ],
+ [
+ -18,
+ -7
+ ],
+ [
+ -9,
+ 4
+ ],
+ [
+ -10,
+ -7
+ ],
+ [
+ -33,
+ -2
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -9,
+ -13
+ ],
+ [
+ -14,
+ -8
+ ],
+ [
+ -36,
+ -29
+ ],
+ [
+ -4,
+ -6
+ ]
+ ],
+ [
+ [
+ 9402,
+ 4200
+ ],
+ [
+ -5,
+ 12
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ 8,
+ 8
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 0,
+ 18
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 1,
+ 18
+ ],
+ [
+ 0,
+ 19
+ ],
+ [
+ 1,
+ 18
+ ]
+ ],
+ [
+ [
+ 9415,
+ 4403
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 0,
+ -2
+ ]
+ ],
+ [
+ [
+ 9096,
+ 3799
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -2,
+ 1
+ ]
+ ],
+ [
+ [
+ 9088,
+ 3809
+ ],
+ [
+ 7,
+ 13
+ ],
+ [
+ 5,
+ -11
+ ],
+ [
+ 5,
+ -12
+ ],
+ [
+ -8,
+ -16
+ ],
+ [
+ -1,
+ 16
+ ]
+ ],
+ [
+ [
+ 9241,
+ 3976
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ -7,
+ -15
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ 9,
+ -23
+ ],
+ [
+ 2,
+ -36
+ ],
+ [
+ 8,
+ -24
+ ],
+ [
+ 11,
+ -28
+ ],
+ [
+ 9,
+ -8
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -4,
+ -17
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ 0,
+ -9
+ ]
+ ],
+ [
+ [
+ 9275,
+ 3716
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ 30
+ ],
+ [
+ -1,
+ 31
+ ],
+ [
+ -1,
+ 30
+ ],
+ [
+ -1,
+ 30
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ -1,
+ 30
+ ],
+ [
+ -1,
+ 31
+ ],
+ [
+ -1,
+ 30
+ ]
+ ],
+ [
+ [
+ 9208,
+ 3958
+ ],
+ [
+ 7,
+ 15
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 12,
+ 1
+ ],
+ [
+ 8,
+ -5
+ ]
+ ],
+ [
+ [
+ 8669,
+ 1064
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -4,
+ -2
+ ]
+ ],
+ [
+ [
+ 8688,
+ 1075
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ 3,
+ -9
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -3,
+ -2
+ ]
+ ],
+ [
+ [
+ 8709,
+ 1084
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 9,
+ -12
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -1,
+ -3
+ ]
+ ],
+ [
+ [
+ 8735,
+ 1097
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 14,
+ 5
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -5,
+ -2
+ ]
+ ],
+ [
+ [
+ 8754,
+ 1113
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -4,
+ -4
+ ]
+ ],
+ [
+ [
+ 8772,
+ 1132
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ -2,
+ -7
+ ]
+ ],
+ [
+ [
+ 8795,
+ 1178
+ ],
+ [
+ -18,
+ -36
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 7,
+ 19
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 7,
+ 9
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ -11,
+ -39
+ ]
+ ],
+ [
+ [
+ 8646,
+ 1428
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 6,
+ -14
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 7,
+ -1
+ ]
+ ],
+ [
+ [
+ 8642,
+ 1447
+ ],
+ [
+ -1,
+ -11
+ ],
+ [
+ -4,
+ 18
+ ],
+ [
+ -3,
+ 21
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 4,
+ -21
+ ]
+ ],
+ [
+ [
+ 8812,
+ 1585
+ ],
+ [
+ 2,
+ -14
+ ],
+ [
+ -9,
+ 33
+ ],
+ [
+ -10,
+ 51
+ ],
+ [
+ -5,
+ 39
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 4,
+ -22
+ ],
+ [
+ 15,
+ -77
+ ]
+ ],
+ [
+ [
+ 8388,
+ 2036
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -10,
+ 5
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 11,
+ 10
+ ],
+ [
+ 6,
+ 7
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ -15,
+ -17
+ ]
+ ],
+ [
+ [
+ 8694,
+ 2244
+ ],
+ [
+ 4,
+ -18
+ ],
+ [
+ 6,
+ -70
+ ],
+ [
+ 5,
+ -25
+ ],
+ [
+ 8,
+ -66
+ ],
+ [
+ 13,
+ -64
+ ],
+ [
+ 18,
+ -78
+ ],
+ [
+ 30,
+ -94
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ -1,
+ -17
+ ],
+ [
+ 1,
+ -18
+ ],
+ [
+ 4,
+ -21
+ ],
+ [
+ 7,
+ -32
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -10,
+ 47
+ ],
+ [
+ -1,
+ 27
+ ],
+ [
+ 1,
+ 39
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -2,
+ -13
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -4,
+ 22
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -6,
+ 6
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ 1,
+ -23
+ ],
+ [
+ 3,
+ -14
+ ],
+ [
+ 4,
+ -35
+ ],
+ [
+ 5,
+ -20
+ ],
+ [
+ 4,
+ -18
+ ],
+ [
+ 38,
+ -185
+ ],
+ [
+ 9,
+ -24
+ ],
+ [
+ 3,
+ -17
+ ],
+ [
+ 3,
+ -35
+ ],
+ [
+ 1,
+ -46
+ ],
+ [
+ -6,
+ -83
+ ],
+ [
+ -1,
+ -57
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -6,
+ -26
+ ],
+ [
+ -7,
+ -23
+ ],
+ [
+ -3,
+ -37
+ ],
+ [
+ -3,
+ -18
+ ],
+ [
+ -11,
+ -19
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -16,
+ -14
+ ],
+ [
+ -12,
+ 3
+ ],
+ [
+ -13,
+ -8
+ ],
+ [
+ -9,
+ 1
+ ],
+ [
+ -5,
+ 17
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 12,
+ -18
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -10,
+ 41
+ ],
+ [
+ -11,
+ 28
+ ],
+ [
+ -2,
+ 19
+ ],
+ [
+ -18,
+ 12
+ ],
+ [
+ -13,
+ 17
+ ],
+ [
+ -9,
+ 31
+ ],
+ [
+ -5,
+ 55
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 6,
+ 20
+ ],
+ [
+ 6,
+ 18
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -4,
+ -15
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -4,
+ 29
+ ],
+ [
+ 1,
+ 35
+ ],
+ [
+ 5,
+ 14
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -8,
+ 24
+ ],
+ [
+ -16,
+ 65
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 10,
+ 29
+ ],
+ [
+ 8,
+ 18
+ ],
+ [
+ 3,
+ 12
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -5,
+ 15
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ 9,
+ 75
+ ],
+ [
+ 8,
+ 47
+ ],
+ [
+ 1,
+ 55
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ -11,
+ 31
+ ],
+ [
+ -47,
+ 77
+ ],
+ [
+ -36,
+ 90
+ ],
+ [
+ -32,
+ 34
+ ],
+ [
+ -24,
+ -7
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -23,
+ -24
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -14,
+ -3
+ ],
+ [
+ -12,
+ -5
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -4,
+ 14
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -4,
+ 14
+ ],
+ [
+ -14,
+ 20
+ ],
+ [
+ -15,
+ 27
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -6,
+ 8
+ ],
+ [
+ -28,
+ 23
+ ],
+ [
+ -25,
+ 12
+ ],
+ [
+ 19,
+ 6
+ ],
+ [
+ 10,
+ -4
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -10,
+ -2
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -7,
+ -8
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -26,
+ -6
+ ],
+ [
+ -21,
+ -6
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 13,
+ 6
+ ],
+ [
+ 2,
+ 14
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -1,
+ -16
+ ],
+ [
+ -6,
+ -11
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ -17,
+ -9
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ 5,
+ 11
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -3,
+ -3
+ ]
+ ],
+ [
+ [
+ 8379,
+ 2295
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ 8,
+ -31
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 15,
+ -2
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 15,
+ -2
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 15,
+ -2
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 15,
+ -1
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 15,
+ -2
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 15,
+ -2
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 2,
+ 14
+ ],
+ [
+ 1,
+ 16
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ 1,
+ 15
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 19,
+ -13
+ ],
+ [
+ 15,
+ -1
+ ]
+ ],
+ [
+ [
+ 8701,
+ 2289
+ ],
+ [
+ -4,
+ -46
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 2,
+ 4
+ ]
+ ],
+ [
+ [
+ 8751,
+ 2491
+ ],
+ [
+ -5,
+ -16
+ ],
+ [
+ -11,
+ -10
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ -7,
+ -17
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -3,
+ -19
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ 1,
+ -13
+ ]
+ ],
+ [
+ [
+ 8323,
+ 3058
+ ],
+ [
+ 30,
+ -1
+ ],
+ [
+ 29,
+ -1
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ -1
+ ]
+ ],
+ [
+ [
+ 8440,
+ 3055
+ ],
+ [
+ 27,
+ 1
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 27,
+ 1
+ ],
+ [
+ 27,
+ 1
+ ]
+ ],
+ [
+ [
+ 8549,
+ 3058
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -4,
+ -13
+ ],
+ [
+ -13,
+ -25
+ ],
+ [
+ -4,
+ -18
+ ],
+ [
+ 17,
+ -21
+ ],
+ [
+ 10,
+ -17
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 3,
+ -13
+ ],
+ [
+ 20,
+ -67
+ ],
+ [
+ 21,
+ -34
+ ],
+ [
+ 9,
+ -17
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 19,
+ -27
+ ],
+ [
+ 6,
+ -15
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 4,
+ -15
+ ],
+ [
+ 7,
+ -13
+ ],
+ [
+ 11,
+ -11
+ ],
+ [
+ 8,
+ -25
+ ],
+ [
+ 5,
+ -40
+ ],
+ [
+ 5,
+ -23
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 11,
+ -34
+ ],
+ [
+ 3,
+ -20
+ ],
+ [
+ 0,
+ -18
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ 19,
+ -15
+ ]
+ ],
+ [
+ [
+ 2033,
+ 9
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -18,
+ 19
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ 1,
+ 49
+ ],
+ [
+ -6,
+ 40
+ ],
+ [
+ -8,
+ 30
+ ],
+ [
+ 6,
+ 15
+ ],
+ [
+ 7,
+ 12
+ ],
+ [
+ 8,
+ 23
+ ],
+ [
+ -7,
+ 29
+ ],
+ [
+ 2,
+ 18
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 19,
+ -21
+ ],
+ [
+ 38,
+ -33
+ ],
+ [
+ 10,
+ -22
+ ],
+ [
+ 2,
+ -24
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 10,
+ -15
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ -18,
+ -25
+ ],
+ [
+ -23,
+ -12
+ ],
+ [
+ -21,
+ -28
+ ],
+ [
+ -4,
+ -19
+ ]
+ ],
+ [
+ [
+ 1919,
+ 345
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ -6,
+ 17
+ ],
+ [
+ 10,
+ 3
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ -4,
+ -11
+ ]
+ ],
+ [
+ [
+ 1952,
+ 375
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 10,
+ 5
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 11,
+ -13
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -8,
+ -14
+ ],
+ [
+ -12,
+ -3
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -9,
+ 1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -1,
+ 17
+ ],
+ [
+ -3,
+ 18
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -7,
+ 6
+ ],
+ [
+ -6,
+ 15
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ 4,
+ -12
+ ]
+ ],
+ [
+ [
+ 1886,
+ 429
+ ],
+ [
+ 19,
+ -5
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 16,
+ -3
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -10,
+ -9
+ ],
+ [
+ -14,
+ 8
+ ],
+ [
+ -24,
+ 3
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 3,
+ -3
+ ]
+ ],
+ [
+ [
+ 1834,
+ 475
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -10,
+ -3
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -3,
+ 11
+ ],
+ [
+ -9,
+ 22
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 9,
+ 17
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 10,
+ -28
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 3,
+ -3
+ ]
+ ],
+ [
+ [
+ 1620,
+ 549
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 5,
+ 9
+ ],
+ [
+ 6,
+ 14
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -2,
+ -7
+ ]
+ ],
+ [
+ [
+ 1692,
+ 566
+ ],
+ [
+ -8,
+ -11
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -9,
+ 2
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -9,
+ 7
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ 6,
+ 19
+ ],
+ [
+ 13,
+ 15
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -3,
+ -8
+ ]
+ ],
+ [
+ [
+ 74,
+ 1761
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -1,
+ -1
+ ]
+ ],
+ [
+ [
+ 7871,
+ 4490
+ ],
+ [
+ 6,
+ -13
+ ],
+ [
+ 9,
+ -12
+ ],
+ [
+ 6,
+ -11
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ 6,
+ -11
+ ],
+ [
+ 10,
+ -12
+ ],
+ [
+ 6,
+ -10
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -2,
+ -15
+ ],
+ [
+ -8,
+ -14
+ ],
+ [
+ -14,
+ -12
+ ],
+ [
+ -15,
+ -9
+ ],
+ [
+ -17,
+ -4
+ ],
+ [
+ -9,
+ -11
+ ],
+ [
+ -3,
+ -17
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ 6,
+ -12
+ ],
+ [
+ 3,
+ -12
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ -4,
+ -21
+ ],
+ [
+ -9,
+ -29
+ ],
+ [
+ -10,
+ -19
+ ],
+ [
+ -12,
+ -9
+ ],
+ [
+ -5,
+ -13
+ ],
+ [
+ 2,
+ -17
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -5,
+ -3
+ ]
+ ],
+ [
+ [
+ 7800,
+ 4083
+ ],
+ [
+ -8,
+ 10
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -5,
+ 14
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -22,
+ -1
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -22,
+ -1
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -22,
+ 0
+ ],
+ [
+ -23,
+ -1
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -22,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -23,
+ -1
+ ],
+ [
+ -22,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ],
+ [
+ -23,
+ 0
+ ]
+ ],
+ [
+ [
+ 7411,
+ 4126
+ ],
+ [
+ -5,
+ 14
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -1,
+ 37
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 1,
+ 23
+ ],
+ [
+ -1,
+ 17
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -4,
+ 14
+ ],
+ [
+ -8,
+ 18
+ ],
+ [
+ -6,
+ 25
+ ],
+ [
+ -2,
+ 30
+ ],
+ [
+ -6,
+ 17
+ ],
+ [
+ -3,
+ 1
+ ]
+ ],
+ [
+ [
+ 7347,
+ 4490
+ ],
+ [
+ -2,
+ 15
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -8,
+ 13
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 5,
+ 13
+ ],
+ [
+ 4,
+ 21
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ 4,
+ 11
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -4,
+ 12
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ 13,
+ 0
+ ]
+ ],
+ [
+ [
+ 7350,
+ 4678
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 30,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 30,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 30,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 30,
+ 1
+ ]
+ ],
+ [
+ [
+ 7818,
+ 4679
+ ],
+ [
+ 0,
+ -12
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ 2,
+ -22
+ ],
+ [
+ 2,
+ -20
+ ],
+ [
+ 5,
+ -18
+ ],
+ [
+ 10,
+ -13
+ ],
+ [
+ 15,
+ -8
+ ],
+ [
+ 9,
+ -13
+ ],
+ [
+ 3,
+ -17
+ ],
+ [
+ 0,
+ -1
+ ]
+ ],
+ [
+ [
+ 6037,
+ 4869
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ]
+ ],
+ [
+ [
+ 6037,
+ 4392
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ]
+ ],
+ [
+ [
+ 5768,
+ 4392
+ ],
+ [
+ -33,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -33,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -33,
+ 0
+ ],
+ [
+ -33,
+ 0
+ ],
+ [
+ -34,
+ 0
+ ],
+ [
+ -33,
+ 0
+ ]
+ ],
+ [
+ [
+ 5501,
+ 4392
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 42
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 42
+ ],
+ [
+ -1,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 42
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 1
+ ],
+ [
+ 6,
+ 29
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -6,
+ 6
+ ],
+ [
+ -10,
+ 3
+ ],
+ [
+ -6,
+ 10
+ ],
+ [
+ 0,
+ 18
+ ],
+ [
+ 7,
+ 27
+ ],
+ [
+ 16,
+ 36
+ ],
+ [
+ 8,
+ 26
+ ],
+ [
+ 2,
+ 15
+ ],
+ [
+ 9,
+ 35
+ ],
+ [
+ 17,
+ 55
+ ],
+ [
+ 6,
+ 35
+ ],
+ [
+ -4,
+ 16
+ ],
+ [
+ -8,
+ 14
+ ],
+ [
+ -14,
+ 15
+ ],
+ [
+ -9,
+ 16
+ ],
+ [
+ -3,
+ 8
+ ]
+ ],
+ [
+ [
+ 5511,
+ 5155
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ -6,
+ 19
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ -1,
+ 31
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ],
+ [
+ 0,
+ 31
+ ],
+ [
+ 0,
+ 30
+ ]
+ ],
+ [
+ [
+ 5499,
+ 5725
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ]
+ ],
+ [
+ [
+ 5588,
+ 5725
+ ],
+ [
+ 0,
+ -47
+ ],
+ [
+ 0,
+ -47
+ ],
+ [
+ 0,
+ -47
+ ],
+ [
+ 0,
+ -47
+ ],
+ [
+ 9,
+ -19
+ ],
+ [
+ 7,
+ -12
+ ],
+ [
+ 5,
+ -13
+ ],
+ [
+ 7,
+ -13
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 3,
+ -14
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 4,
+ -11
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 9,
+ -14
+ ],
+ [
+ 13,
+ -10
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 17,
+ -27
+ ],
+ [
+ 8,
+ -18
+ ],
+ [
+ 9,
+ -13
+ ],
+ [
+ 4,
+ -15
+ ],
+ [
+ 9,
+ -13
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 6,
+ 3
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 13,
+ 4
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ -3,
+ -21
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 1,
+ -17
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 3,
+ -18
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 8,
+ -5
+ ],
+ [
+ 8,
+ -10
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 8,
+ 7
+ ],
+ [
+ 10,
+ 16
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 6,
+ -9
+ ],
+ [
+ 6,
+ -5
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ 3,
+ -12
+ ],
+ [
+ 2,
+ -14
+ ],
+ [
+ 8,
+ -18
+ ],
+ [
+ 5,
+ -13
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -2,
+ -12
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 8,
+ -13
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 23,
+ -5
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 14,
+ -2
+ ],
+ [
+ 16,
+ 1
+ ],
+ [
+ 9,
+ -3
+ ],
+ [
+ 12,
+ 4
+ ],
+ [
+ 15,
+ -3
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 6,
+ -19
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ 6,
+ -5
+ ]
+ ],
+ [
+ [
+ 8127,
+ 4487
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 1,
+ -25
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 4,
+ -27
+ ],
+ [
+ 5,
+ -18
+ ],
+ [
+ 3,
+ -7
+ ]
+ ],
+ [
+ [
+ 8153,
+ 4340
+ ],
+ [
+ 0,
+ -51
+ ],
+ [
+ -1,
+ -57
+ ],
+ [
+ 0,
+ -57
+ ],
+ [
+ 0,
+ -57
+ ],
+ [
+ 0,
+ -57
+ ],
+ [
+ 0,
+ -57
+ ],
+ [
+ 0,
+ -58
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ 5,
+ -19
+ ],
+ [
+ 4,
+ -18
+ ],
+ [
+ 1,
+ -19
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ -5,
+ -26
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ 0,
+ -15
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 5,
+ -17
+ ]
+ ],
+ [
+ [
+ 8106,
+ 3589
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -5,
+ -14
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ 3,
+ -16
+ ],
+ [
+ -7,
+ -14
+ ],
+ [
+ -18,
+ -10
+ ],
+ [
+ -10,
+ -9
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -13,
+ 4
+ ],
+ [
+ -23,
+ 14
+ ],
+ [
+ -15,
+ 0
+ ],
+ [
+ -8,
+ -16
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ 1,
+ -10
+ ]
+ ],
+ [
+ [
+ 8006,
+ 3437
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -5,
+ 12
+ ],
+ [
+ -7,
+ 21
+ ],
+ [
+ -1,
+ 17
+ ],
+ [
+ 3,
+ 13
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -3,
+ 13
+ ],
+ [
+ -2,
+ 14
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -9,
+ 19
+ ],
+ [
+ -18,
+ 26
+ ],
+ [
+ -13,
+ 16
+ ],
+ [
+ -9,
+ 7
+ ],
+ [
+ -10,
+ 13
+ ],
+ [
+ -11,
+ 20
+ ],
+ [
+ -6,
+ 15
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 5,
+ 28
+ ],
+ [
+ 15,
+ 61
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -6,
+ 8
+ ],
+ [
+ -12,
+ 6
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -8,
+ 15
+ ],
+ [
+ -6,
+ 37
+ ],
+ [
+ -17,
+ 39
+ ],
+ [
+ -26,
+ 41
+ ],
+ [
+ -15,
+ 28
+ ],
+ [
+ -4,
+ 15
+ ],
+ [
+ -4,
+ 22
+ ],
+ [
+ -3,
+ 29
+ ],
+ [
+ 0,
+ 25
+ ],
+ [
+ 5,
+ 29
+ ]
+ ],
+ [
+ [
+ 7871,
+ 4490
+ ],
+ [
+ 42,
+ -1
+ ],
+ [
+ 40,
+ 0
+ ],
+ [
+ 41,
+ -1
+ ],
+ [
+ 40,
+ 0
+ ],
+ [
+ 41,
+ -1
+ ],
+ [
+ 40,
+ 0
+ ],
+ [
+ 12,
+ 0
+ ]
+ ],
+ [
+ [
+ 8398,
+ 4335
+ ],
+ [
+ -1,
+ -62
+ ],
+ [
+ 0,
+ -62
+ ],
+ [
+ 0,
+ -62
+ ],
+ [
+ -1,
+ -62
+ ],
+ [
+ 0,
+ -62
+ ],
+ [
+ 0,
+ -62
+ ],
+ [
+ 0,
+ -62
+ ],
+ [
+ -1,
+ -63
+ ]
+ ],
+ [
+ [
+ 8395,
+ 3838
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -9,
+ -10
+ ],
+ [
+ -17,
+ -11
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -9,
+ -1
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ 2,
+ -17
+ ],
+ [
+ -3,
+ -12
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -6,
+ -14
+ ],
+ [
+ -5,
+ -23
+ ],
+ [
+ -5,
+ -15
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -8,
+ 2
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -9,
+ 14
+ ],
+ [
+ -9,
+ 3
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -5,
+ -13
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -6,
+ 10
+ ],
+ [
+ -15,
+ 13
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -2,
+ -2
+ ]
+ ],
+ [
+ [
+ 8153,
+ 4340
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 4,
+ -5
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 19,
+ 17
+ ]
+ ],
+ [
+ [
+ 8212,
+ 4346
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 27,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 27,
+ 0
+ ],
+ [
+ 27,
+ 0
+ ],
+ [
+ 27,
+ 0
+ ],
+ [
+ 28,
+ 0
+ ],
+ [
+ 0,
+ -11
+ ]
+ ],
+ [
+ [
+ 7515,
+ 3439
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ]
+ ],
+ [
+ [
+ 6849,
+ 4011
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 19,
+ 0
+ ],
+ [
+ 16,
+ 0
+ ]
+ ],
+ [
+ [
+ 7449,
+ 4011
+ ],
+ [
+ 21,
+ -25
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 7,
+ 4
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 3,
+ -15
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -7,
+ -18
+ ],
+ [
+ 2,
+ -17
+ ],
+ [
+ 10,
+ -16
+ ],
+ [
+ 6,
+ -15
+ ],
+ [
+ 3,
+ -16
+ ],
+ [
+ 6,
+ -13
+ ],
+ [
+ 14,
+ -13
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 1,
+ -25
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -25
+ ],
+ [
+ 0,
+ -25
+ ]
+ ],
+ [
+ [
+ 7970,
+ 3344
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ]
+ ],
+ [
+ [
+ 7976,
+ 3344
+ ],
+ [
+ -6,
+ 0
+ ]
+ ],
+ [
+ [
+ 8594,
+ 3715
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 1,
+ -29
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 10,
+ -22
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 3,
+ -9
+ ],
+ [
+ 4,
+ -12
+ ],
+ [
+ 10,
+ -27
+ ],
+ [
+ 16,
+ -22
+ ],
+ [
+ 12,
+ -6
+ ]
+ ],
+ [
+ [
+ 8652,
+ 3542
+ ],
+ [
+ -34,
+ -47
+ ],
+ [
+ -15,
+ -16
+ ],
+ [
+ -15,
+ -14
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -4,
+ -15
+ ],
+ [
+ -9,
+ -13
+ ],
+ [
+ -5,
+ -14
+ ],
+ [
+ -14,
+ -12
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -24,
+ -15
+ ],
+ [
+ -14,
+ -5
+ ],
+ [
+ -9,
+ -10
+ ]
+ ],
+ [
+ [
+ 8499,
+ 3363
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -32,
+ 2
+ ],
+ [
+ -31,
+ 2
+ ],
+ [
+ -31,
+ 2
+ ],
+ [
+ -31,
+ 1
+ ],
+ [
+ -32,
+ 2
+ ],
+ [
+ -31,
+ 2
+ ],
+ [
+ -31,
+ 2
+ ],
+ [
+ -31,
+ 2
+ ],
+ [
+ -30,
+ -1
+ ],
+ [
+ -30,
+ -1
+ ],
+ [
+ -30,
+ -1
+ ],
+ [
+ -30,
+ -1
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ -7,
+ 1
+ ],
+ [
+ -13,
+ 2
+ ],
+ [
+ 4,
+ -19
+ ],
+ [
+ 0,
+ -17
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -14,
+ 0
+ ],
+ [
+ -15,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -15,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -15,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -18,
+ 0
+ ]
+ ],
+ [
+ [
+ 7979,
+ 3343
+ ],
+ [
+ 5,
+ 17
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 5,
+ 18
+ ],
+ [
+ 2,
+ 18
+ ],
+ [
+ 1,
+ 19
+ ],
+ [
+ -3,
+ 15
+ ]
+ ],
+ [
+ [
+ 8395,
+ 3838
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 6,
+ -15
+ ],
+ [
+ 6,
+ -21
+ ],
+ [
+ 10,
+ -12
+ ],
+ [
+ 15,
+ -5
+ ],
+ [
+ 11,
+ -8
+ ],
+ [
+ 7,
+ -12
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 7,
+ 3
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 9,
+ -10
+ ],
+ [
+ 14,
+ 2
+ ],
+ [
+ 18,
+ 15
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 3,
+ -16
+ ],
+ [
+ 8,
+ -16
+ ],
+ [
+ 12,
+ -18
+ ],
+ [
+ 1,
+ 0
+ ]
+ ],
+ [
+ [
+ 7769,
+ 2009
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -15,
+ 17
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ 8,
+ 6
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -2,
+ -7
+ ]
+ ],
+ [
+ [
+ 8030,
+ 2049
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ -1,
+ -8
+ ]
+ ],
+ [
+ [
+ 8035,
+ 2067
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 2,
+ 29
+ ],
+ [
+ -3,
+ 25
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 2,
+ -13
+ ],
+ [
+ -2,
+ -24
+ ]
+ ],
+ [
+ [
+ 8000,
+ 2120
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 8,
+ 11
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -1,
+ -8
+ ]
+ ],
+ [
+ [
+ 7973,
+ 2141
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -33,
+ 19
+ ],
+ [
+ -8,
+ 16
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -9,
+ 1
+ ],
+ [
+ -10,
+ -19
+ ],
+ [
+ -7,
+ -26
+ ],
+ [
+ 11,
+ -14
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 16,
+ 5
+ ],
+ [
+ 9,
+ 13
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 7,
+ -5
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ 7,
+ -15
+ ],
+ [
+ 10,
+ -5
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ 6,
+ 10
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 4,
+ -11
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 9,
+ -10
+ ],
+ [
+ 6,
+ -12
+ ],
+ [
+ 24,
+ -17
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 6,
+ -17
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -5,
+ 17
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -5,
+ 8
+ ],
+ [
+ -25,
+ 15
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 0,
+ -18
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -1,
+ -11
+ ],
+ [
+ -1,
+ -11
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -5,
+ 24
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -11,
+ 1
+ ],
+ [
+ -8,
+ -6
+ ],
+ [
+ -8,
+ -23
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -22,
+ 12
+ ],
+ [
+ -26,
+ 19
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -8,
+ 21
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -16,
+ 8
+ ],
+ [
+ -5,
+ 10
+ ],
+ [
+ -10,
+ 27
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ -6,
+ 16
+ ],
+ [
+ -12,
+ -7
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -15,
+ -7
+ ],
+ [
+ -37,
+ 7
+ ],
+ [
+ -11,
+ 7
+ ],
+ [
+ -15,
+ 16
+ ],
+ [
+ -20,
+ 12
+ ],
+ [
+ -9,
+ 2
+ ],
+ [
+ -10,
+ -2
+ ],
+ [
+ -27,
+ -2
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -2,
+ 5
+ ]
+ ],
+ [
+ [
+ 7589,
+ 2100
+ ],
+ [
+ 6,
+ 19
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ -1,
+ 32
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 3,
+ 17
+ ],
+ [
+ -1,
+ 17
+ ],
+ [
+ 5,
+ 19
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 4,
+ 21
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -6,
+ 21
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ -6,
+ 20
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -6,
+ 10
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ 28
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -5,
+ 16
+ ],
+ [
+ -13,
+ 23
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 25
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ]
+ ],
+ [
+ [
+ 7826,
+ 2679
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -6,
+ -14
+ ],
+ [
+ -12,
+ -17
+ ],
+ [
+ -8,
+ -21
+ ],
+ [
+ -3,
+ -25
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ 0,
+ -19
+ ],
+ [
+ -2,
+ -11
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ 3,
+ -20
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ -3,
+ -22
+ ],
+ [
+ -6,
+ -30
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 4,
+ -21
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ 4,
+ -14
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 2,
+ -1
+ ]
+ ],
+ [
+ [
+ 9730,
+ 4252
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -16,
+ 7
+ ],
+ [
+ 13,
+ 6
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 5,
+ -19
+ ],
+ [
+ 1,
+ -6
+ ]
+ ],
+ [
+ [
+ 9682,
+ 4273
+ ],
+ [
+ -25,
+ -9
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ 6,
+ 3
+ ],
+ [
+ 8,
+ 14
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 8,
+ -8
+ ],
+ [
+ 1,
+ -8
+ ]
+ ],
+ [
+ [
+ 9617,
+ 4336
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -7,
+ -1
+ ]
+ ],
+ [
+ [
+ 9415,
+ 4403
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 2,
+ 16
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 17
+ ]
+ ],
+ [
+ [
+ 9436,
+ 4536
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 9,
+ -1
+ ]
+ ],
+ [
+ [
+ 9506,
+ 4531
+ ],
+ [
+ 13,
+ 0
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 12,
+ 0
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 13,
+ 0
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 7,
+ 5
+ ],
+ [
+ 10,
+ 15
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 10,
+ 9
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 11,
+ -1
+ ]
+ ],
+ [
+ [
+ 9656,
+ 4559
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -6,
+ -13
+ ],
+ [
+ -10,
+ -19
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 17,
+ -6
+ ],
+ [
+ 7,
+ -7
+ ],
+ [
+ 11,
+ -36
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 10,
+ -10
+ ],
+ [
+ 3,
+ -25
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 12,
+ -6
+ ],
+ [
+ 14,
+ 8
+ ],
+ [
+ 12,
+ 11
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ -8,
+ 20
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 12,
+ -22
+ ],
+ [
+ 3,
+ -30
+ ],
+ [
+ 1,
+ -18
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -31,
+ -10
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -16,
+ -9
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ -1,
+ 20
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -25,
+ -32
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -1,
+ 24
+ ],
+ [
+ 5,
+ 20
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -5,
+ -7
+ ]
+ ],
+ [
+ [
+ 9256,
+ 3637
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 8,
+ 32
+ ],
+ [
+ 4,
+ 11
+ ],
+ [
+ -4,
+ -22
+ ],
+ [
+ -6,
+ -21
+ ],
+ [
+ -2,
+ -6
+ ]
+ ],
+ [
+ [
+ 9258,
+ 3637
+ ],
+ [
+ -2,
+ 0
+ ]
+ ],
+ [
+ [
+ 9275,
+ 3716
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ 0,
+ -17
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -6,
+ -22
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ -2,
+ -8
+ ]
+ ],
+ [
+ [
+ 9245,
+ 3634
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -13,
+ -3
+ ],
+ [
+ -4,
+ -8
+ ]
+ ],
+ [
+ [
+ 9219,
+ 3621
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -10,
+ 0
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ -5,
+ 10
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -8,
+ 8
+ ],
+ [
+ -5,
+ 15
+ ],
+ [
+ -3,
+ 11
+ ],
+ [
+ 3,
+ 20
+ ],
+ [
+ 6,
+ 3
+ ],
+ [
+ 7,
+ -3
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -10,
+ 16
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ 4,
+ 20
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -8,
+ -6
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 4,
+ 18
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -8,
+ -12
+ ],
+ [
+ -2,
+ 25
+ ],
+ [
+ 8,
+ 23
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 9,
+ 2
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -6,
+ 2
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ 1,
+ 16
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -7,
+ -4
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ 0,
+ -17
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -5,
+ 15
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -14,
+ 8
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 8,
+ -19
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ 4,
+ -40
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -6,
+ 8
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -7,
+ 19
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ 21,
+ -35
+ ],
+ [
+ 4,
+ -14
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -13,
+ 10
+ ],
+ [
+ -16,
+ 7
+ ],
+ [
+ -8,
+ 24
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -6,
+ 11
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -1,
+ 17
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 8,
+ 20
+ ],
+ [
+ 7,
+ 11
+ ],
+ [
+ 3,
+ 14
+ ],
+ [
+ -1,
+ 21
+ ]
+ ],
+ [
+ [
+ 9088,
+ 3809
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -10,
+ 16
+ ],
+ [
+ -17,
+ 12
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -12,
+ 8
+ ],
+ [
+ -6,
+ 7
+ ]
+ ],
+ [
+ [
+ 9033,
+ 3886
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -13,
+ -9
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -8,
+ 3
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -15,
+ -22
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -20,
+ -31
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -12,
+ -15
+ ],
+ [
+ 0,
+ 25
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 1,
+ 25
+ ],
+ [
+ 0,
+ 24
+ ]
+ ],
+ [
+ [
+ 8876,
+ 3958
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 20,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ]
+ ],
+ [
+ [
+ 9852,
+ 4811
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 3,
+ -9
+ ]
+ ],
+ [
+ [
+ 9891,
+ 4837
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -6,
+ 2
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ 6,
+ 12
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 4,
+ -14
+ ],
+ [
+ 0,
+ -6
+ ]
+ ],
+ [
+ [
+ 9662,
+ 4596
+ ],
+ [
+ -7,
+ 18
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ -9,
+ 17
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ 0,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ 0,
+ 19
+ ]
+ ],
+ [
+ [
+ 9631,
+ 5020
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 0,
+ 11
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 9,
+ 18
+ ],
+ [
+ 12,
+ 12
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ 7,
+ 13
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 0,
+ 15
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ 3,
+ 20
+ ],
+ [
+ 6,
+ 17
+ ],
+ [
+ 10,
+ 19
+ ],
+ [
+ 3,
+ 25
+ ],
+ [
+ 2,
+ 26
+ ],
+ [
+ 13,
+ 25
+ ],
+ [
+ 13,
+ 29
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ 15,
+ 30
+ ],
+ [
+ 10,
+ 21
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ 5,
+ 12
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 8,
+ -3
+ ],
+ [
+ -1,
+ -17
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 6,
+ -4
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 15,
+ 10
+ ],
+ [
+ 17,
+ 6
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 12,
+ -13
+ ],
+ [
+ 15,
+ -21
+ ],
+ [
+ 11,
+ -16
+ ],
+ [
+ 1,
+ -28
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -31
+ ],
+ [
+ 0,
+ -22
+ ],
+ [
+ 1,
+ -31
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -32
+ ],
+ [
+ 0,
+ -17
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ 8,
+ -13
+ ],
+ [
+ 14,
+ -13
+ ],
+ [
+ 10,
+ -3
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 3,
+ -2
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 2,
+ -19
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 9,
+ -3
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -18,
+ -29
+ ],
+ [
+ -16,
+ 4
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -4,
+ -13
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -6,
+ -23
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -2,
+ -12
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -10,
+ 6
+ ],
+ [
+ -8,
+ -1
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 7,
+ 12
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 3,
+ 11
+ ],
+ [
+ 0,
+ 11
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ -11,
+ -10
+ ],
+ [
+ 1,
+ -16
+ ],
+ [
+ -10,
+ -34
+ ],
+ [
+ 0,
+ -14
+ ],
+ [
+ -6,
+ -11
+ ],
+ [
+ -8,
+ -10
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -3,
+ -18
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -3,
+ -20
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ -9,
+ -4
+ ],
+ [
+ -10,
+ -13
+ ],
+ [
+ -8,
+ -18
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ -14,
+ -28
+ ],
+ [
+ -15,
+ -25
+ ],
+ [
+ -11,
+ -41
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -4,
+ -8
+ ]
+ ],
+ [
+ [
+ 8292,
+ 4984
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 1,
+ -5
+ ]
+ ],
+ [
+ [
+ 8330,
+ 5079
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ 1,
+ -17
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -4,
+ -4
+ ]
+ ],
+ [
+ [
+ 8518,
+ 4344
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -29,
+ -1
+ ],
+ [
+ -30,
+ -2
+ ],
+ [
+ -30,
+ -2
+ ],
+ [
+ -30,
+ -2
+ ]
+ ],
+ [
+ [
+ 8212,
+ 4346
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 9,
+ 12
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 5,
+ 15
+ ],
+ [
+ 5,
+ 18
+ ],
+ [
+ 10,
+ 27
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 5,
+ 21
+ ],
+ [
+ 3,
+ 21
+ ],
+ [
+ 3,
+ 23
+ ],
+ [
+ 1,
+ 23
+ ],
+ [
+ 0,
+ 25
+ ],
+ [
+ -3,
+ 24
+ ],
+ [
+ -5,
+ 25
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -9,
+ 31
+ ],
+ [
+ -9,
+ 44
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 9,
+ 26
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -1,
+ 21
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -4,
+ 14
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 9,
+ 19
+ ],
+ [
+ 6,
+ 14
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 3,
+ 20
+ ],
+ [
+ 2,
+ 23
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 10,
+ 5
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 0,
+ 15
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 7,
+ 9
+ ],
+ [
+ 8,
+ 22
+ ],
+ [
+ 7,
+ 13
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 11
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -5,
+ -21
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 6,
+ 13
+ ],
+ [
+ 5,
+ 20
+ ],
+ [
+ 3,
+ 16
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 8,
+ 8
+ ],
+ [
+ 9,
+ 4
+ ],
+ [
+ 8,
+ 1
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -6,
+ 2
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 6,
+ 10
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 12,
+ -12
+ ],
+ [
+ 11,
+ -7
+ ],
+ [
+ 10,
+ -2
+ ],
+ [
+ 8,
+ -4
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 25,
+ -15
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -8,
+ 5
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 10,
+ -18
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ 1,
+ -19
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ -1,
+ -16
+ ],
+ [
+ -1,
+ -26
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -8,
+ -12
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ -3,
+ -19
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -4,
+ -16
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 6,
+ -1
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 5,
+ 12
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 8,
+ 23
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 13,
+ 6
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 7,
+ -12
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ 6,
+ -42
+ ],
+ [
+ 8,
+ -68
+ ],
+ [
+ 5,
+ -38
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -7,
+ -53
+ ],
+ [
+ -5,
+ -22
+ ],
+ [
+ -9,
+ -13
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -8,
+ -6
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -7,
+ -21
+ ],
+ [
+ -2,
+ -4
+ ]
+ ],
+ [
+ [
+ 8419,
+ 5121
+ ],
+ [
+ 12,
+ -3
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ 0,
+ 4
+ ]
+ ],
+ [
+ [
+ 8514,
+ 5157
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -9,
+ 2
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 5,
+ -11
+ ],
+ [
+ 2,
+ -2
+ ]
+ ],
+ [
+ [
+ 8458,
+ 5202
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -1,
+ -2
+ ]
+ ],
+ [
+ [
+ 8457,
+ 5224
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -3,
+ 9
+ ],
+ [
+ 5,
+ 9
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 2,
+ -9
+ ]
+ ],
+ [
+ [
+ 8145,
+ 4985
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 5,
+ 20
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -18,
+ 11
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -18,
+ 9
+ ],
+ [
+ -13,
+ 4
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -9,
+ 4
+ ],
+ [
+ -10,
+ 1
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -7,
+ 6
+ ],
+ [
+ -6,
+ 5
+ ],
+ [
+ -11,
+ 5
+ ],
+ [
+ -11,
+ 4
+ ],
+ [
+ -12,
+ 5
+ ],
+ [
+ -11,
+ 5
+ ],
+ [
+ -11,
+ 4
+ ],
+ [
+ -11,
+ 5
+ ],
+ [
+ -12,
+ 4
+ ],
+ [
+ -11,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -5,
+ 3
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ 2
+ ]
+ ],
+ [
+ [
+ 7893,
+ 5268
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 17,
+ 10
+ ],
+ [
+ 14,
+ 12
+ ],
+ [
+ 12,
+ 14
+ ],
+ [
+ 15,
+ 9
+ ],
+ [
+ 18,
+ 3
+ ],
+ [
+ 13,
+ 5
+ ],
+ [
+ 8,
+ 7
+ ],
+ [
+ 10,
+ 13
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 7,
+ 1
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ 10,
+ 12
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 2,
+ -5
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 15,
+ 15
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 23,
+ -5
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 9,
+ -8
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 12,
+ -27
+ ],
+ [
+ 5,
+ -11
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 17,
+ -2
+ ],
+ [
+ 8,
+ 1
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 5,
+ -9
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 10,
+ 14
+ ],
+ [
+ 11,
+ 12
+ ],
+ [
+ 16,
+ 13
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 14,
+ 5
+ ],
+ [
+ 13,
+ 0
+ ],
+ [
+ 17,
+ -3
+ ],
+ [
+ 16,
+ 3
+ ],
+ [
+ 14,
+ 9
+ ],
+ [
+ 13,
+ 5
+ ],
+ [
+ 11,
+ 1
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 0,
+ -15
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 11,
+ -2
+ ],
+ [
+ 6,
+ -5
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 6,
+ -1
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 4,
+ -12
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -32,
+ 8
+ ],
+ [
+ -10,
+ 1
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -5,
+ -14
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -15,
+ 22
+ ],
+ [
+ -12,
+ 11
+ ],
+ [
+ -14,
+ 8
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -12,
+ -1
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -7,
+ 5
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -6,
+ -14
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -12,
+ -9
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -4,
+ -13
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -4,
+ -22
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -6,
+ -13
+ ],
+ [
+ -8,
+ -24
+ ],
+ [
+ -8,
+ -22
+ ],
+ [
+ -10,
+ -22
+ ],
+ [
+ -6,
+ -12
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 0,
+ -9
+ ]
+ ],
+ [
+ [
+ 8090,
+ 5386
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -11,
+ -17
+ ],
+ [
+ -4,
+ -10
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -13,
+ 4
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 15,
+ 23
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 19,
+ 9
+ ],
+ [
+ 10,
+ 3
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -20,
+ -4
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -18,
+ -21
+ ]
+ ],
+ [
+ [
+ 8024,
+ 5522
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -10,
+ -5
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 35,
+ 29
+ ],
+ [
+ 15,
+ 10
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -9,
+ -11
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -25,
+ -20
+ ],
+ [
+ -4,
+ -2
+ ]
+ ],
+ [
+ [
+ 7740,
+ 5300
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ 0,
+ -28
+ ],
+ [
+ 0,
+ -27
+ ],
+ [
+ 0,
+ -28
+ ],
+ [
+ 0,
+ -27
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -24,
+ -23
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -5,
+ -15
+ ],
+ [
+ -8,
+ -17
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ 1,
+ -13
+ ],
+ [
+ 12,
+ -9
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -6,
+ -20
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ 1,
+ -24
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ 2,
+ -20
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -2,
+ -22
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 11,
+ -16
+ ],
+ [
+ 10,
+ -8
+ ],
+ [
+ 8,
+ -3
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 5,
+ -11
+ ],
+ [
+ 6,
+ -6
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 8,
+ -8
+ ],
+ [
+ 13,
+ -22
+ ],
+ [
+ 6,
+ -18
+ ],
+ [
+ 12,
+ -12
+ ],
+ [
+ 18,
+ -14
+ ],
+ [
+ 12,
+ -12
+ ],
+ [
+ 5,
+ -11
+ ],
+ [
+ 4,
+ -26
+ ],
+ [
+ 3,
+ -56
+ ]
+ ],
+ [
+ [
+ 7350,
+ 4678
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 42
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ 0,
+ 43
+ ],
+ [
+ -7,
+ 14
+ ],
+ [
+ -15,
+ 11
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ -7,
+ 17
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 14,
+ 18
+ ],
+ [
+ 4,
+ 9
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 3,
+ 19
+ ]
+ ],
+ [
+ [
+ 7340,
+ 5144
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ 1,
+ 23
+ ],
+ [
+ -3,
+ 17
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ -10,
+ 28
+ ],
+ [
+ -3,
+ 22
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -1,
+ 29
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 2,
+ 15
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -2,
+ 68
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 0,
+ 32
+ ],
+ [
+ -8,
+ 33
+ ],
+ [
+ -3,
+ 11
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -7,
+ 22
+ ],
+ [
+ -4,
+ 25
+ ],
+ [
+ 1,
+ 22
+ ],
+ [
+ -2,
+ 16
+ ],
+ [
+ 1,
+ 12
+ ],
+ [
+ -2,
+ 19
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 0,
+ 17
+ ],
+ [
+ -9,
+ 59
+ ]
+ ],
+ [
+ [
+ 7280,
+ 5725
+ ],
+ [
+ 11,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 0,
+ 40
+ ],
+ [
+ 0,
+ 32
+ ],
+ [
+ 20,
+ -4
+ ],
+ [
+ 6,
+ -5
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ 1,
+ -27
+ ],
+ [
+ 4,
+ -22
+ ],
+ [
+ 8,
+ -26
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 5,
+ -6
+ ],
+ [
+ 19,
+ -8
+ ],
+ [
+ 32,
+ -8
+ ],
+ [
+ 19,
+ -10
+ ],
+ [
+ 4,
+ -11
+ ],
+ [
+ 8,
+ -5
+ ],
+ [
+ 13,
+ 2
+ ],
+ [
+ 9,
+ 5
+ ],
+ [
+ 8,
+ 11
+ ],
+ [
+ 11,
+ 2
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 15,
+ -9
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ 14,
+ -12
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 4,
+ -17
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 12,
+ 2
+ ],
+ [
+ 15,
+ -7
+ ],
+ [
+ 13,
+ -20
+ ],
+ [
+ 19,
+ -18
+ ],
+ [
+ 11,
+ -9
+ ],
+ [
+ 12,
+ 0
+ ],
+ [
+ 15,
+ 9
+ ],
+ [
+ 16,
+ 17
+ ],
+ [
+ 11,
+ 3
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 4,
+ -13
+ ],
+ [
+ 5,
+ -5
+ ],
+ [
+ 12,
+ 2
+ ],
+ [
+ 26,
+ -3
+ ],
+ [
+ 21,
+ 4
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 4,
+ -12
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 11,
+ 4
+ ],
+ [
+ 18,
+ -3
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -10,
+ -9
+ ],
+ [
+ -15,
+ -11
+ ],
+ [
+ -18,
+ -11
+ ],
+ [
+ -36,
+ -18
+ ],
+ [
+ -22,
+ -20
+ ],
+ [
+ -10,
+ -12
+ ],
+ [
+ -39,
+ -59
+ ],
+ [
+ -23,
+ -31
+ ],
+ [
+ -38,
+ -44
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -1,
+ -5
+ ]
+ ],
+ [
+ [
+ 7979,
+ 3343
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 0,
+ 1
+ ]
+ ],
+ [
+ [
+ 7970,
+ 3344
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ -1,
+ -12
+ ],
+ [
+ -5,
+ -14
+ ],
+ [
+ -1,
+ -6
+ ]
+ ],
+ [
+ [
+ 7515,
+ 3344
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ],
+ [
+ 0,
+ 24
+ ]
+ ],
+ [
+ [
+ 7449,
+ 4011
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -7,
+ 16
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -7,
+ 6
+ ],
+ [
+ -5,
+ 13
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ -5,
+ 20
+ ],
+ [
+ -3,
+ 6
+ ]
+ ],
+ [
+ [
+ 8059,
+ 2145
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 13,
+ -7
+ ],
+ [
+ 1,
+ -3
+ ]
+ ],
+ [
+ [
+ 8074,
+ 2175
+ ],
+ [
+ -27,
+ -3
+ ],
+ [
+ -11,
+ 10
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -13,
+ -9
+ ],
+ [
+ -15,
+ -6
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -11,
+ -23
+ ],
+ [
+ -7,
+ -6
+ ]
+ ],
+ [
+ [
+ 7903,
+ 3058
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ -1
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ]
+ ],
+ [
+ [
+ 6670,
+ 5144
+ ],
+ [
+ 0,
+ -44
+ ],
+ [
+ 0,
+ -45
+ ],
+ [
+ 0,
+ -44
+ ],
+ [
+ 1,
+ -44
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ]
+ ],
+ [
+ [
+ 6668,
+ 4964
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -23
+ ]
+ ],
+ [
+ [
+ 5588,
+ 5725
+ ],
+ [
+ 16,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 30,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 29,
+ 0
+ ]
+ ],
+ [
+ [
+ 6668,
+ 5725
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 1,
+ -37
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -37
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -37
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 1,
+ -37
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -36
+ ],
+ [
+ 0,
+ -37
+ ],
+ [
+ 0,
+ -36
+ ]
+ ],
+ [
+ [
+ 9140,
+ 2992
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 7,
+ -7
+ ]
+ ],
+ [
+ [
+ 9143,
+ 2989
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ 8,
+ 24
+ ],
+ [
+ 17,
+ 30
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ -14,
+ -26
+ ],
+ [
+ -13,
+ -31
+ ]
+ ],
+ [
+ [
+ 9208,
+ 3094
+ ],
+ [
+ -16,
+ -14
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ 11,
+ 10
+ ],
+ [
+ 7,
+ 3
+ ]
+ ],
+ [
+ [
+ 9230,
+ 3103
+ ],
+ [
+ -12,
+ -5
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 14,
+ 11
+ ],
+ [
+ 5,
+ 38
+ ],
+ [
+ 0,
+ 18
+ ],
+ [
+ -2,
+ 31
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 1,
+ -29
+ ],
+ [
+ 0,
+ -22
+ ],
+ [
+ -4,
+ -32
+ ],
+ [
+ -3,
+ -8
+ ]
+ ],
+ [
+ [
+ 9221,
+ 3221
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -6,
+ 21
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 0,
+ -4
+ ]
+ ],
+ [
+ [
+ 9199,
+ 3353
+ ],
+ [
+ 2,
+ 0
+ ]
+ ],
+ [
+ [
+ 9201,
+ 3353
+ ],
+ [
+ 9,
+ -61
+ ],
+ [
+ 18,
+ -67
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -13,
+ 44
+ ],
+ [
+ -7,
+ 32
+ ],
+ [
+ -7,
+ 53
+ ]
+ ],
+ [
+ [
+ 8958,
+ 2843
+ ],
+ [
+ -13,
+ 23
+ ],
+ [
+ -12,
+ 22
+ ],
+ [
+ -12,
+ 22
+ ],
+ [
+ -12,
+ 22
+ ],
+ [
+ -12,
+ 21
+ ],
+ [
+ -13,
+ 22
+ ],
+ [
+ -12,
+ 22
+ ],
+ [
+ -12,
+ 22
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 1
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ -12,
+ 1
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ -13,
+ 1
+ ],
+ [
+ 0,
+ 15
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ -8,
+ 19
+ ],
+ [
+ -5,
+ 10
+ ],
+ [
+ -10,
+ -9
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -15,
+ 1
+ ],
+ [
+ -14,
+ 2
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -15,
+ 1
+ ],
+ [
+ -14,
+ 1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -16,
+ -9
+ ],
+ [
+ -9,
+ -9
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -14,
+ -8
+ ],
+ [
+ -14,
+ -8
+ ],
+ [
+ -2,
+ 0
+ ]
+ ],
+ [
+ [
+ 8440,
+ 3055
+ ],
+ [
+ 4,
+ 41
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 5,
+ 24
+ ],
+ [
+ 12,
+ 20
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 8,
+ 4
+ ],
+ [
+ 19,
+ 5
+ ],
+ [
+ 21,
+ 19
+ ],
+ [
+ 14,
+ 17
+ ],
+ [
+ 12,
+ 5
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 10,
+ 17
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 10,
+ 3
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 12,
+ 35
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 7,
+ 1
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 2,
+ 14
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 4,
+ 15
+ ]
+ ],
+ [
+ [
+ 8680,
+ 3365
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ -1
+ ],
+ [
+ 33,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 33,
+ -1
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 23,
+ -1
+ ]
+ ],
+ [
+ [
+ 9192,
+ 3353
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 4,
+ -9
+ ],
+ [
+ 6,
+ -22
+ ],
+ [
+ 4,
+ -29
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -6,
+ 6
+ ],
+ [
+ -9,
+ 5
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ 4,
+ -14
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -6,
+ 0
+ ],
+ [
+ -4,
+ -13
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -8,
+ -2
+ ],
+ [
+ -10,
+ 11
+ ],
+ [
+ -4,
+ 14
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ -1,
+ -18
+ ],
+ [
+ 2,
+ -19
+ ],
+ [
+ -1,
+ -15
+ ],
+ [
+ 11,
+ -3
+ ],
+ [
+ 9,
+ 3
+ ],
+ [
+ 13,
+ -1
+ ],
+ [
+ 9,
+ 3
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 12,
+ -4
+ ],
+ [
+ 1,
+ -17
+ ],
+ [
+ -1,
+ -17
+ ],
+ [
+ -1,
+ -19
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 2,
+ 33
+ ],
+ [
+ 11,
+ 13
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ 2,
+ -15
+ ],
+ [
+ -3,
+ -22
+ ],
+ [
+ -17,
+ -27
+ ],
+ [
+ -13,
+ -24
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -9,
+ 3
+ ],
+ [
+ -10,
+ 6
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ -10,
+ -4
+ ],
+ [
+ -13,
+ 6
+ ],
+ [
+ -14,
+ 12
+ ],
+ [
+ 6,
+ -13
+ ],
+ [
+ 34,
+ -25
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -13,
+ -15
+ ],
+ [
+ -8,
+ 2
+ ],
+ [
+ -19,
+ 29
+ ],
+ [
+ 9,
+ -25
+ ],
+ [
+ 7,
+ -10
+ ],
+ [
+ 14,
+ -6
+ ],
+ [
+ 26,
+ 9
+ ],
+ [
+ 8,
+ -10
+ ],
+ [
+ -7,
+ -17
+ ],
+ [
+ -7,
+ -13
+ ],
+ [
+ -9,
+ -1
+ ],
+ [
+ -8,
+ -4
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ -14,
+ -1
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ -11,
+ -18
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -2,
+ 14
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ 0,
+ -26
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ -13,
+ -14
+ ],
+ [
+ -12,
+ -18
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -10,
+ -26
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -4,
+ -21
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 0,
+ 16
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ -2,
+ -33
+ ],
+ [
+ -3,
+ -16
+ ],
+ [
+ -36,
+ 1
+ ],
+ [
+ -14,
+ -8
+ ]
+ ],
+ [
+ [
+ 7340,
+ 5144
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ]
+ ],
+ [
+ [
+ 6668,
+ 5725
+ ],
+ [
+ 10,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 27,
+ 0
+ ]
+ ],
+ [
+ [
+ 6669,
+ 4202
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ -1,
+ 48
+ ]
+ ],
+ [
+ [
+ 6668,
+ 4583
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 32,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 36,
+ 0
+ ],
+ [
+ 27,
+ -28
+ ],
+ [
+ 16,
+ -9
+ ],
+ [
+ 7,
+ 8
+ ],
+ [
+ 17,
+ 5
+ ],
+ [
+ 25,
+ 1
+ ],
+ [
+ 16,
+ -4
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 13,
+ -10
+ ],
+ [
+ 19,
+ -11
+ ],
+ [
+ 12,
+ -12
+ ],
+ [
+ 3,
+ -13
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 7,
+ -2
+ ]
+ ],
+ [
+ [
+ 9662,
+ 4596
+ ],
+ [
+ -4,
+ -25
+ ],
+ [
+ -2,
+ -12
+ ]
+ ],
+ [
+ [
+ 9506,
+ 4531
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -5,
+ 12
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 3,
+ 15
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 2,
+ 9
+ ],
+ [
+ 3,
+ 36
+ ],
+ [
+ 3,
+ 20
+ ],
+ [
+ 2,
+ 38
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 4,
+ 18
+ ],
+ [
+ 6,
+ 15
+ ],
+ [
+ 5,
+ 17
+ ],
+ [
+ 5,
+ 16
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 4,
+ 20
+ ],
+ [
+ 2,
+ 35
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 12,
+ 5
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 13,
+ 14
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -4,
+ 23
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ 10,
+ 26
+ ],
+ [
+ -2,
+ 15
+ ],
+ [
+ 2,
+ 4
+ ]
+ ],
+ [
+ [
+ 9592,
+ 4966
+ ],
+ [
+ 9,
+ 36
+ ],
+ [
+ 8,
+ 17
+ ],
+ [
+ 11,
+ -5
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 5,
+ 6
+ ]
+ ],
+ [
+ [
+ 9356,
+ 3950
+ ],
+ [
+ -10,
+ -29
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 13,
+ 35
+ ],
+ [
+ -3,
+ -12
+ ]
+ ],
+ [
+ [
+ 9272,
+ 4008
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 11,
+ 12
+ ],
+ [
+ 15,
+ 14
+ ],
+ [
+ -21,
+ 48
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -5,
+ 23
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -1,
+ 18
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -5,
+ 17
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 9,
+ 10
+ ],
+ [
+ 10,
+ 20
+ ],
+ [
+ 7,
+ 22
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 7,
+ 7
+ ]
+ ],
+ [
+ [
+ 9306,
+ 4270
+ ],
+ [
+ 8,
+ -9
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 9,
+ -8
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 9,
+ -8
+ ],
+ [
+ 9,
+ -9
+ ]
+ ],
+ [
+ [
+ 9377,
+ 4200
+ ],
+ [
+ -2,
+ -15
+ ],
+ [
+ -9,
+ -30
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ 2,
+ -14
+ ],
+ [
+ 17,
+ -5
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ -3,
+ -16
+ ],
+ [
+ -2,
+ -18
+ ],
+ [
+ -2,
+ -29
+ ],
+ [
+ -3,
+ -26
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 2,
+ 31
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ -5,
+ -40
+ ],
+ [
+ -8,
+ -22
+ ],
+ [
+ -6,
+ -15
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ -1,
+ -6
+ ],
+ [
+ -2,
+ -13
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -6,
+ -6
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -13,
+ -40
+ ],
+ [
+ -12,
+ -11
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 3,
+ 18
+ ],
+ [
+ 2,
+ 19
+ ],
+ [
+ -7,
+ 8
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -8,
+ 0
+ ],
+ [
+ -8,
+ 14
+ ],
+ [
+ -11,
+ 11
+ ],
+ [
+ -16,
+ 29
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -1,
+ 13
+ ],
+ [
+ 5,
+ 21
+ ],
+ [
+ 5,
+ 15
+ ],
+ [
+ 6,
+ 7
+ ],
+ [
+ 18,
+ 8
+ ],
+ [
+ 4,
+ 12
+ ],
+ [
+ 3,
+ 10
+ ]
+ ],
+ [
+ [
+ 6761,
+ 3344
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -53
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -53
+ ],
+ [
+ -1,
+ -54
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -53
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -53
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ -1,
+ -53
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ 0,
+ -53
+ ],
+ [
+ 0,
+ -54
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -21,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ 9,
+ -35
+ ],
+ [
+ 11,
+ -10
+ ]
+ ],
+ [
+ [
+ 6451,
+ 2441
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 1
+ ],
+ [
+ -19,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ -20,
+ 0
+ ],
+ [
+ 0,
+ -21
+ ],
+ [
+ 0,
+ -21
+ ],
+ [
+ 0,
+ -22
+ ],
+ [
+ 0,
+ -21
+ ],
+ [
+ -32,
+ 0
+ ],
+ [
+ -31,
+ -1
+ ],
+ [
+ -12,
+ 0
+ ]
+ ],
+ [
+ [
+ 6761,
+ 3439
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -23
+ ],
+ [
+ 0,
+ -24
+ ]
+ ],
+ [
+ [
+ 5232,
+ 4392
+ ],
+ [
+ 34,
+ 0
+ ],
+ [
+ 33,
+ 0
+ ],
+ [
+ 34,
+ 0
+ ],
+ [
+ 34,
+ 0
+ ],
+ [
+ 33,
+ 0
+ ],
+ [
+ 34,
+ 0
+ ],
+ [
+ 33,
+ 0
+ ],
+ [
+ 34,
+ 0
+ ]
+ ],
+ [
+ [
+ 5768,
+ 4392
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -30
+ ],
+ [
+ 0,
+ -29
+ ]
+ ],
+ [
+ [
+ 9352,
+ 4110
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ 5,
+ 18
+ ],
+ [
+ 7,
+ 8
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -5,
+ -9
+ ],
+ [
+ -4,
+ -4
+ ]
+ ],
+ [
+ [
+ 9502,
+ 4199
+ ],
+ [
+ -6,
+ -13
+ ],
+ [
+ 6,
+ -1
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 11,
+ 10
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 4,
+ -7
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 9,
+ 3
+ ],
+ [
+ -39,
+ -32
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -12,
+ -10
+ ],
+ [
+ -11,
+ -6
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -39,
+ -23
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -31,
+ -12
+ ],
+ [
+ -14,
+ -1
+ ],
+ [
+ -12,
+ -4
+ ],
+ [
+ 9,
+ 9
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 7,
+ 13
+ ],
+ [
+ 11,
+ 8
+ ],
+ [
+ 6,
+ 7
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 8,
+ -4
+ ],
+ [
+ 9,
+ 1
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 19,
+ 1
+ ],
+ [
+ 18,
+ 4
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 16,
+ 18
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ -14,
+ -22
+ ],
+ [
+ -8,
+ -10
+ ]
+ ],
+ [
+ [
+ 8925,
+ 4587
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -2,
+ -4
+ ]
+ ],
+ [
+ [
+ 9165,
+ 4772
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ -3,
+ -5
+ ]
+ ],
+ [
+ [
+ 9179,
+ 4826
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -2,
+ -4
+ ]
+ ],
+ [
+ [
+ 9402,
+ 4200
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -10,
+ -17
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ 3,
+ 17
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 3,
+ 27
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ 5,
+ -22
+ ],
+ [
+ 1,
+ -26
+ ],
+ [
+ 0,
+ -1
+ ]
+ ],
+ [
+ [
+ 9306,
+ 4270
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -16,
+ 10
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -2,
+ 10
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ 0,
+ 8
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ -4,
+ 7
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -11,
+ 8
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -13,
+ 0
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ 0,
+ 26
+ ],
+ [
+ 0,
+ 1
+ ]
+ ],
+ [
+ [
+ 8850,
+ 4445
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 17,
+ 18
+ ],
+ [
+ 8,
+ 12
+ ],
+ [
+ 10,
+ 11
+ ],
+ [
+ 9,
+ 8
+ ],
+ [
+ 8,
+ 11
+ ],
+ [
+ 5,
+ 13
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 7,
+ 7
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 2,
+ 7
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -14,
+ 7
+ ],
+ [
+ 1,
+ 33
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 33,
+ 15
+ ],
+ [
+ 21,
+ 5
+ ],
+ [
+ 25,
+ 1
+ ],
+ [
+ 30,
+ -7
+ ],
+ [
+ 12,
+ -7
+ ],
+ [
+ 8,
+ -8
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 10,
+ 4
+ ],
+ [
+ 13,
+ 1
+ ],
+ [
+ 18,
+ -1
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 13,
+ 6
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 6,
+ 9
+ ],
+ [
+ 10,
+ 10
+ ],
+ [
+ 9,
+ 6
+ ],
+ [
+ 8,
+ 0
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 0,
+ 1
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -1,
+ 16
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -6,
+ -2
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ 10,
+ 14
+ ],
+ [
+ 37,
+ 41
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ 0,
+ 1
+ ],
+ [
+ 35,
+ 53
+ ],
+ [
+ 20,
+ 24
+ ],
+ [
+ 17,
+ 13
+ ],
+ [
+ 12,
+ 7
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 5,
+ 1
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 37,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ]
+ ],
+ [
+ [
+ 9427,
+ 4965
+ ],
+ [
+ 0,
+ -13
+ ],
+ [
+ -2,
+ -15
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ -2,
+ -34
+ ],
+ [
+ 6,
+ -26
+ ],
+ [
+ -2,
+ -17
+ ],
+ [
+ 1,
+ -19
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -2,
+ -11
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 4,
+ -31
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -4,
+ -26
+ ],
+ [
+ 0,
+ -7
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 4,
+ 8
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 2,
+ -2
+ ],
+ [
+ 5,
+ -12
+ ],
+ [
+ 0,
+ -21
+ ],
+ [
+ 0,
+ -16
+ ],
+ [
+ -1,
+ -18
+ ],
+ [
+ 0,
+ -26
+ ],
+ [
+ 0,
+ -19
+ ],
+ [
+ 0,
+ -18
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 3,
+ -11
+ ]
+ ],
+ [
+ [
+ 8782,
+ 4134
+ ],
+ [
+ -10,
+ -8
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ 0,
+ -16
+ ],
+ [
+ -6,
+ -34
+ ],
+ [
+ -12,
+ -53
+ ],
+ [
+ -6,
+ -33
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -8,
+ -18
+ ],
+ [
+ -15,
+ -22
+ ],
+ [
+ -12,
+ -13
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -4,
+ 5
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -6,
+ -12
+ ],
+ [
+ -4,
+ -7
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -3,
+ -16
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ 2,
+ -14
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ -2,
+ 7
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ -9,
+ -22
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ 1,
+ -10
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -10,
+ -3
+ ],
+ [
+ -10,
+ 6
+ ]
+ ],
+ [
+ [
+ 8518,
+ 4344
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ 9,
+ -2
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 16,
+ -12
+ ],
+ [
+ 5,
+ -7
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 9,
+ -5
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ -24,
+ -9
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 6,
+ 4
+ ],
+ [
+ 7,
+ 0
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 11,
+ -11
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 10,
+ 6
+ ],
+ [
+ 14,
+ 6
+ ],
+ [
+ 14,
+ 3
+ ],
+ [
+ 14,
+ -1
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 8,
+ 7
+ ],
+ [
+ 17,
+ 23
+ ],
+ [
+ 19,
+ 19
+ ],
+ [
+ 33,
+ 24
+ ],
+ [
+ 31,
+ 18
+ ]
+ ],
+ [
+ [
+ 8782,
+ 4390
+ ],
+ [
+ 0,
+ -16
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ],
+ [
+ 0,
+ -20
+ ]
+ ],
+ [
+ [
+ 7527,
+ 2800
+ ],
+ [
+ -21,
+ 9
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -9,
+ 7
+ ],
+ [
+ -8,
+ 14
+ ],
+ [
+ -17,
+ 18
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -9,
+ 2
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -12,
+ -8
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -7,
+ 0
+ ],
+ [
+ -7,
+ 3
+ ],
+ [
+ -18,
+ -11
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -7,
+ 11
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -10,
+ 11
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -4,
+ -8
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -9,
+ 6
+ ],
+ [
+ -4,
+ 9
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -2,
+ -11
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -3,
+ -15
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -5,
+ -6
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -8,
+ 6
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -9,
+ -13
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -9,
+ 8
+ ],
+ [
+ -2,
+ 9
+ ],
+ [
+ 0,
+ 11
+ ],
+ [
+ -11,
+ -1
+ ],
+ [
+ -12,
+ 1
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ -10,
+ 14
+ ],
+ [
+ -11,
+ -3
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -16,
+ 11
+ ],
+ [
+ -12,
+ 1
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -1,
+ 15
+ ],
+ [
+ -5,
+ 14
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -8,
+ 10
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -10,
+ 3
+ ],
+ [
+ -8,
+ -3
+ ],
+ [
+ -5,
+ 5
+ ],
+ [
+ -16,
+ 24
+ ],
+ [
+ -7,
+ 7
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ 0,
+ 23
+ ],
+ [
+ -1,
+ 23
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -16,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -17,
+ 0
+ ]
+ ],
+ [
+ [
+ 4852,
+ 4392
+ ],
+ [
+ -11,
+ 24
+ ],
+ [
+ -5,
+ 34
+ ],
+ [
+ -1,
+ 15
+ ],
+ [
+ 1,
+ 38
+ ],
+ [
+ -3,
+ 17
+ ],
+ [
+ -9,
+ 27
+ ],
+ [
+ 4,
+ 24
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 10,
+ 63
+ ],
+ [
+ 2,
+ 5
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 7,
+ 10
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ 4,
+ 25
+ ],
+ [
+ 5,
+ 21
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ 2,
+ 69
+ ],
+ [
+ 3,
+ 53
+ ],
+ [
+ 5,
+ 18
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ 2,
+ 24
+ ],
+ [
+ -2,
+ 25
+ ],
+ [
+ 10,
+ 119
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ 3,
+ 19
+ ],
+ [
+ -3,
+ 51
+ ],
+ [
+ 2,
+ 57
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 5,
+ -9
+ ],
+ [
+ 21,
+ 1
+ ],
+ [
+ 14,
+ 7
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 6,
+ -11
+ ],
+ [
+ 7,
+ -2
+ ],
+ [
+ 9,
+ 2
+ ]
+ ],
+ [
+ [
+ 4943,
+ 5184
+ ],
+ [
+ 9,
+ 5
+ ],
+ [
+ 7,
+ -4
+ ],
+ [
+ 9,
+ -8
+ ],
+ [
+ 9,
+ -26
+ ],
+ [
+ 9,
+ -44
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 32,
+ -6
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 18,
+ 17
+ ],
+ [
+ 20,
+ 5
+ ],
+ [
+ 23,
+ -1
+ ],
+ [
+ 15,
+ -5
+ ],
+ [
+ 5,
+ -8
+ ],
+ [
+ 12,
+ -1
+ ],
+ [
+ 30,
+ 10
+ ],
+ [
+ 33,
+ 6
+ ],
+ [
+ 17,
+ 7
+ ],
+ [
+ 20,
+ 15
+ ],
+ [
+ 46,
+ 18
+ ],
+ [
+ 22,
+ 2
+ ],
+ [
+ 12,
+ 7
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 24,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ]
+ ],
+ [
+ [
+ 9272,
+ 4008
+ ],
+ [
+ -9,
+ -17
+ ],
+ [
+ -13,
+ -6
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -2,
+ -3
+ ]
+ ],
+ [
+ [
+ 8876,
+ 3958
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -11,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -11,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ -12,
+ 0
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ 0,
+ 22
+ ]
+ ],
+ [
+ [
+ 8782,
+ 4390
+ ],
+ [
+ 17,
+ 10
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 8,
+ 7
+ ],
+ [
+ 4,
+ 4
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 28,
+ 25
+ ]
+ ],
+ [
+ [
+ 9605,
+ 4294
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -1,
+ -11
+ ]
+ ],
+ [
+ [
+ 9616,
+ 4295
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 2,
+ 12
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 3,
+ 3
+ ],
+ [
+ -1,
+ -31
+ ]
+ ],
+ [
+ [
+ 9617,
+ 4336
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 2,
+ -18
+ ],
+ [
+ -5,
+ -13
+ ],
+ [
+ -2,
+ -34
+ ],
+ [
+ -7,
+ -14
+ ],
+ [
+ -22,
+ -9
+ ],
+ [
+ -7,
+ 0
+ ]
+ ],
+ [
+ [
+ 8958,
+ 2843
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -24,
+ -29
+ ],
+ [
+ -7,
+ -12
+ ],
+ [
+ -20,
+ -48
+ ],
+ [
+ -5,
+ -31
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ 1,
+ 9
+ ],
+ [
+ 1,
+ 8
+ ],
+ [
+ -5,
+ -17
+ ],
+ [
+ 4,
+ -25
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -13,
+ -18
+ ],
+ [
+ -7,
+ -3
+ ],
+ [
+ -8,
+ -5
+ ],
+ [
+ -2,
+ -17
+ ],
+ [
+ -11,
+ -16
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -11,
+ 4
+ ],
+ [
+ 4,
+ -16
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -7,
+ -9
+ ],
+ [
+ -9,
+ -6
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -9,
+ -7
+ ],
+ [
+ -8,
+ 4
+ ],
+ [
+ -10,
+ 2
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ 5,
+ -10
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -1,
+ 7
+ ],
+ [
+ -2,
+ 13
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -8,
+ 21
+ ],
+ [
+ 0,
+ -16
+ ],
+ [
+ 3,
+ -13
+ ],
+ [
+ 3,
+ -6
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -6,
+ -14
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ 1,
+ -8
+ ]
+ ],
+ [
+ [
+ 6668,
+ 4583
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 48
+ ],
+ [
+ 0,
+ 47
+ ]
+ ],
+ [
+ [
+ 8499,
+ 3363
+ ],
+ [
+ 21,
+ 0
+ ],
+ [
+ 43,
+ 0
+ ],
+ [
+ 31,
+ 0
+ ],
+ [
+ 26,
+ -1
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 18,
+ 0
+ ],
+ [
+ 5,
+ 4
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 13,
+ 0
+ ]
+ ],
+ [
+ [
+ 7285,
+ 1372
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -8,
+ 41
+ ],
+ [
+ -12,
+ 94
+ ],
+ [
+ 0,
+ 53
+ ],
+ [
+ 2,
+ 19
+ ],
+ [
+ 3,
+ -76
+ ],
+ [
+ 13,
+ -95
+ ],
+ [
+ 3,
+ -27
+ ]
+ ],
+ [
+ [
+ 7269,
+ 1589
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ 1,
+ 17
+ ],
+ [
+ 7,
+ 37
+ ],
+ [
+ 15,
+ 49
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ -17,
+ -54
+ ],
+ [
+ -9,
+ -46
+ ]
+ ],
+ [
+ [
+ 7299,
+ 1704
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 5,
+ 15
+ ],
+ [
+ 0,
+ 6
+ ],
+ [
+ 7,
+ 20
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ -7,
+ -14
+ ],
+ [
+ -9,
+ -22
+ ]
+ ],
+ [
+ [
+ 7322,
+ 1752
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 7,
+ 6
+ ],
+ [
+ 15,
+ 19
+ ],
+ [
+ 6,
+ 2
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 1,
+ 1
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -12,
+ -12
+ ],
+ [
+ -19,
+ -23
+ ]
+ ],
+ [
+ [
+ 7477,
+ 1941
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ 20,
+ 30
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -15,
+ -21
+ ]
+ ],
+ [
+ [
+ 7589,
+ 2100
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -9,
+ -31
+ ],
+ [
+ 5,
+ -18
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -19,
+ -4
+ ],
+ [
+ -42,
+ -35
+ ],
+ [
+ -17,
+ -19
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 20,
+ 25
+ ],
+ [
+ -7,
+ 4
+ ],
+ [
+ -12,
+ -6
+ ],
+ [
+ -4,
+ 2
+ ],
+ [
+ 5,
+ 20
+ ],
+ [
+ -2,
+ 18
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -5,
+ -14
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -5,
+ 6
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ 3,
+ -32
+ ],
+ [
+ 5,
+ -14
+ ],
+ [
+ 4,
+ -17
+ ],
+ [
+ -11,
+ -21
+ ],
+ [
+ -11,
+ -18
+ ],
+ [
+ -1,
+ -16
+ ],
+ [
+ -11,
+ -22
+ ],
+ [
+ -11,
+ -13
+ ],
+ [
+ -24,
+ -29
+ ],
+ [
+ -7,
+ -6
+ ],
+ [
+ -10,
+ -14
+ ],
+ [
+ -15,
+ -10
+ ],
+ [
+ -15,
+ -16
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ 9,
+ 14
+ ],
+ [
+ 11,
+ 13
+ ],
+ [
+ -9,
+ -2
+ ],
+ [
+ -14,
+ 7
+ ],
+ [
+ -9,
+ 0
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -7,
+ -7
+ ],
+ [
+ -7,
+ 10
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -1,
+ 6
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ 10,
+ -42
+ ],
+ [
+ 5,
+ -2
+ ],
+ [
+ 4,
+ -4
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -6,
+ -7
+ ],
+ [
+ -10,
+ -5
+ ],
+ [
+ -9,
+ 15
+ ],
+ [
+ -2,
+ -19
+ ],
+ [
+ -1,
+ -19
+ ],
+ [
+ -3,
+ -5
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -2,
+ 8
+ ],
+ [
+ -3,
+ -7
+ ],
+ [
+ -4,
+ -5
+ ],
+ [
+ -7,
+ -1
+ ],
+ [
+ -6,
+ -3
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ 2,
+ -8
+ ],
+ [
+ 9,
+ 7
+ ],
+ [
+ -3,
+ -21
+ ],
+ [
+ -9,
+ -20
+ ],
+ [
+ -7,
+ -5
+ ],
+ [
+ -11,
+ 3
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -2,
+ -4
+ ],
+ [
+ 12,
+ -32
+ ],
+ [
+ -8,
+ -48
+ ],
+ [
+ -5,
+ -17
+ ],
+ [
+ -4,
+ -2
+ ],
+ [
+ -4,
+ -1
+ ],
+ [
+ -14,
+ 15
+ ],
+ [
+ -8,
+ 12
+ ],
+ [
+ 7,
+ -32
+ ],
+ [
+ 19,
+ -10
+ ],
+ [
+ 1,
+ -12
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -4,
+ -13
+ ],
+ [
+ -3,
+ -16
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ 3,
+ -29
+ ],
+ [
+ 3,
+ -13
+ ],
+ [
+ 2,
+ -39
+ ],
+ [
+ 3,
+ -17
+ ],
+ [
+ 17,
+ -63
+ ],
+ [
+ 6,
+ 0
+ ],
+ [
+ 1,
+ -7
+ ],
+ [
+ -1,
+ -13
+ ],
+ [
+ -12,
+ -4
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -6,
+ 4
+ ],
+ [
+ -13,
+ 17
+ ],
+ [
+ -20,
+ 12
+ ],
+ [
+ -25,
+ 4
+ ],
+ [
+ -17,
+ 9
+ ],
+ [
+ -9,
+ 13
+ ],
+ [
+ -10,
+ 8
+ ],
+ [
+ -10,
+ 3
+ ],
+ [
+ -9,
+ 7
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -10,
+ 8
+ ],
+ [
+ -13,
+ 4
+ ],
+ [
+ -8,
+ 9
+ ],
+ [
+ -6,
+ 22
+ ],
+ [
+ -5,
+ 38
+ ],
+ [
+ -7,
+ 23
+ ],
+ [
+ -12,
+ 29
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 2,
+ 17
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ -4,
+ 10
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 0,
+ 13
+ ],
+ [
+ -2,
+ 16
+ ],
+ [
+ -8,
+ 16
+ ],
+ [
+ -14,
+ 18
+ ],
+ [
+ -12,
+ 27
+ ],
+ [
+ -10,
+ 34
+ ],
+ [
+ -10,
+ 24
+ ],
+ [
+ -10,
+ 13
+ ],
+ [
+ -7,
+ 16
+ ],
+ [
+ -4,
+ 19
+ ],
+ [
+ -1,
+ 12
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ -6,
+ 21
+ ],
+ [
+ -14,
+ 39
+ ],
+ [
+ -8,
+ 29
+ ],
+ [
+ -2,
+ 19
+ ],
+ [
+ -8,
+ 21
+ ],
+ [
+ -15,
+ 25
+ ],
+ [
+ -9,
+ 17
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -24,
+ 33
+ ],
+ [
+ -6,
+ 21
+ ],
+ [
+ -6,
+ 7
+ ],
+ [
+ -6,
+ -1
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -13,
+ -1
+ ],
+ [
+ -21,
+ 2
+ ],
+ [
+ -16,
+ 6
+ ],
+ [
+ -9,
+ 9
+ ],
+ [
+ -7,
+ -2
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -8,
+ -7
+ ],
+ [
+ -12,
+ -3
+ ],
+ [
+ -11,
+ -21
+ ],
+ [
+ -9,
+ -38
+ ],
+ [
+ -4,
+ -24
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -6,
+ -11
+ ],
+ [
+ -6,
+ -18
+ ],
+ [
+ -7,
+ -8
+ ],
+ [
+ -8,
+ 1
+ ],
+ [
+ -15,
+ 13
+ ],
+ [
+ -22,
+ 26
+ ],
+ [
+ -17,
+ 16
+ ],
+ [
+ -12,
+ 6
+ ],
+ [
+ -11,
+ 12
+ ],
+ [
+ -9,
+ 18
+ ],
+ [
+ -9,
+ 12
+ ],
+ [
+ -8,
+ 6
+ ],
+ [
+ -9,
+ 20
+ ],
+ [
+ -11,
+ 33
+ ],
+ [
+ -5,
+ 26
+ ],
+ [
+ 0,
+ 28
+ ],
+ [
+ -14,
+ 60
+ ],
+ [
+ -7,
+ 25
+ ],
+ [
+ -6,
+ 12
+ ],
+ [
+ -11,
+ 15
+ ],
+ [
+ -16,
+ 16
+ ],
+ [
+ -21,
+ 33
+ ],
+ [
+ -27,
+ 50
+ ],
+ [
+ -19,
+ 30
+ ],
+ [
+ -11,
+ 10
+ ],
+ [
+ -10,
+ 18
+ ],
+ [
+ -8,
+ 25
+ ],
+ [
+ -8,
+ 17
+ ],
+ [
+ -1,
+ 0
+ ]
+ ],
+ [
+ [
+ 6037,
+ 4392
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -23
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -24
+ ],
+ [
+ 0,
+ -23
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 23,
+ 0
+ ],
+ [
+ 22,
+ 0
+ ]
+ ],
+ [
+ [
+ 9245,
+ 3634
+ ],
+ [
+ -20,
+ -75
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ -4,
+ -4
+ ],
+ [
+ -6,
+ -4
+ ],
+ [
+ -6,
+ -8
+ ],
+ [
+ -4,
+ -9
+ ],
+ [
+ -4,
+ -25
+ ],
+ [
+ -7,
+ -27
+ ],
+ [
+ -5,
+ 11
+ ],
+ [
+ -1,
+ 10
+ ],
+ [
+ 2,
+ 26
+ ],
+ [
+ 8,
+ 42
+ ],
+ [
+ 8,
+ 26
+ ],
+ [
+ 7,
+ 12
+ ],
+ [
+ 5,
+ 26
+ ]
+ ],
+ [
+ [
+ 9258,
+ 3637
+ ],
+ [
+ -9,
+ -29
+ ],
+ [
+ -5,
+ -3
+ ],
+ [
+ 12,
+ 32
+ ]
+ ],
+ [
+ [
+ 9096,
+ 3799
+ ],
+ [
+ -1,
+ -22
+ ],
+ [
+ -5,
+ -10
+ ],
+ [
+ -6,
+ -9
+ ],
+ [
+ -9,
+ -14
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ -3,
+ -25
+ ],
+ [
+ 4,
+ -8
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 11,
+ 6
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 13,
+ -30
+ ],
+ [
+ 24,
+ -12
+ ],
+ [
+ 8,
+ -8
+ ],
+ [
+ 7,
+ -15
+ ],
+ [
+ 11,
+ -10
+ ],
+ [
+ 8,
+ -13
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -3,
+ -10
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ -3,
+ -8
+ ],
+ [
+ -9,
+ -1
+ ],
+ [
+ -5,
+ 2
+ ],
+ [
+ -27,
+ 49
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -10,
+ 26
+ ],
+ [
+ -12,
+ 13
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ 16,
+ -25
+ ],
+ [
+ 7,
+ -18
+ ],
+ [
+ 12,
+ -25
+ ],
+ [
+ 9,
+ -10
+ ],
+ [
+ 6,
+ -17
+ ],
+ [
+ 6,
+ -7
+ ],
+ [
+ 16,
+ -11
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ 8,
+ -7
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ -1,
+ -14
+ ],
+ [
+ -12,
+ 5
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -5,
+ -5
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ -20,
+ 37
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 12,
+ -24
+ ],
+ [
+ 10,
+ -14
+ ],
+ [
+ 9,
+ -7
+ ],
+ [
+ 6,
+ -12
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ -5,
+ -8
+ ],
+ [
+ -5,
+ -4
+ ],
+ [
+ -6,
+ 8
+ ],
+ [
+ -4,
+ 8
+ ],
+ [
+ -9,
+ 13
+ ],
+ [
+ -2,
+ 15
+ ],
+ [
+ -7,
+ -1
+ ],
+ [
+ -27,
+ 19
+ ],
+ [
+ -22,
+ 3
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 18,
+ -5
+ ],
+ [
+ 6,
+ -8
+ ],
+ [
+ 15,
+ -8
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 4,
+ -24
+ ],
+ [
+ 11,
+ -17
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ 8,
+ -1
+ ],
+ [
+ 14,
+ 12
+ ],
+ [
+ 9,
+ -4
+ ],
+ [
+ 13,
+ -4
+ ],
+ [
+ 3,
+ -10
+ ],
+ [
+ 2,
+ -18
+ ],
+ [
+ 4,
+ -21
+ ],
+ [
+ 3,
+ -20
+ ]
+ ],
+ [
+ [
+ 9199,
+ 3353
+ ],
+ [
+ -7,
+ 0
+ ]
+ ],
+ [
+ [
+ 8652,
+ 3542
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 4,
+ -6
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 9,
+ -9
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 7,
+ 9
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 7,
+ 9
+ ],
+ [
+ 11,
+ -13
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 11,
+ 6
+ ],
+ [
+ 10,
+ 1
+ ],
+ [
+ 3,
+ 2
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 1,
+ 11
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 5,
+ -4
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 19,
+ 13
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 2,
+ -6
+ ],
+ [
+ 9,
+ 8
+ ],
+ [
+ 5,
+ 7
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 5,
+ 14
+ ],
+ [
+ 20,
+ 42
+ ],
+ [
+ 6,
+ 26
+ ],
+ [
+ 8,
+ 16
+ ],
+ [
+ 2,
+ 14
+ ],
+ [
+ 7,
+ 12
+ ],
+ [
+ 4,
+ 27
+ ],
+ [
+ 2,
+ 6
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 10,
+ -7
+ ],
+ [
+ 9,
+ -1
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 4,
+ 10
+ ],
+ [
+ 4,
+ 17
+ ],
+ [
+ 5,
+ 11
+ ],
+ [
+ 2,
+ 13
+ ],
+ [
+ 3,
+ 9
+ ],
+ [
+ 5,
+ 6
+ ],
+ [
+ 11,
+ -1
+ ],
+ [
+ 5,
+ 8
+ ],
+ [
+ 5,
+ 10
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 10,
+ 15
+ ],
+ [
+ 13,
+ 31
+ ],
+ [
+ 2,
+ 19
+ ],
+ [
+ 4,
+ 14
+ ],
+ [
+ 1,
+ 14
+ ],
+ [
+ 3,
+ 8
+ ],
+ [
+ 11,
+ -15
+ ],
+ [
+ 7,
+ -9
+ ],
+ [
+ 15,
+ -21
+ ],
+ [
+ 11,
+ -13
+ ],
+ [
+ 4,
+ 15
+ ],
+ [
+ 5,
+ 23
+ ]
+ ],
+ [
+ [
+ 9427,
+ 4965
+ ],
+ [
+ 15,
+ 0
+ ],
+ [
+ 37,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 37,
+ 0
+ ],
+ [
+ 38,
+ 1
+ ]
+ ],
+ [
+ [
+ 4976,
+ 5384
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -1,
+ 0
+ ],
+ [
+ -3,
+ 8
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 3,
+ -11
+ ],
+ [
+ 0,
+ -3
+ ]
+ ],
+ [
+ [
+ 5017,
+ 5421
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -4,
+ -3
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -3,
+ -6
+ ],
+ [
+ 0,
+ 12
+ ],
+ [
+ 2,
+ 13
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 3,
+ -9
+ ],
+ [
+ 4,
+ -9
+ ]
+ ],
+ [
+ [
+ 5008,
+ 5459
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -5,
+ 4
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 0,
+ 9
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 1,
+ -17
+ ]
+ ],
+ [
+ [
+ 5001,
+ 5566
+ ],
+ [
+ 5,
+ -25
+ ],
+ [
+ 1,
+ 10
+ ],
+ [
+ 13,
+ -18
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -2,
+ -1
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -6,
+ 3
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 0,
+ 14
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -5,
+ 10
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 5,
+ 13
+ ],
+ [
+ 4,
+ 6
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -14,
+ -10
+ ],
+ [
+ 0,
+ -2
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 3,
+ -3
+ ],
+ [
+ 2,
+ -8
+ ]
+ ],
+ [
+ [
+ 4979,
+ 5618
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ -3,
+ 4
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 1,
+ 0
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 4,
+ -10
+ ],
+ [
+ 0,
+ -4
+ ]
+ ],
+ [
+ [
+ 4962,
+ 5632
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ -10,
+ 4
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -1,
+ 3
+ ],
+ [
+ -2,
+ 12
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 9,
+ -14
+ ],
+ [
+ 1,
+ -7
+ ]
+ ],
+ [
+ [
+ 4982,
+ 5664
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -3,
+ -4
+ ],
+ [
+ -3,
+ 0
+ ],
+ [
+ -4,
+ 6
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -8,
+ 7
+ ],
+ [
+ -2,
+ 4
+ ],
+ [
+ 3,
+ 6
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 10,
+ -7
+ ]
+ ],
+ [
+ [
+ 4958,
+ 5725
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -1,
+ 1
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 3,
+ 0
+ ]
+ ],
+ [
+ [
+ 4943,
+ 5184
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ -10,
+ 10
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -17,
+ 0
+ ],
+ [
+ -3,
+ 6
+ ],
+ [
+ -19,
+ -6
+ ],
+ [
+ -6,
+ 6
+ ],
+ [
+ -10,
+ -4
+ ],
+ [
+ 3,
+ 18
+ ],
+ [
+ -1,
+ 22
+ ],
+ [
+ 1,
+ 22
+ ],
+ [
+ 2,
+ -16
+ ],
+ [
+ 7,
+ -17
+ ],
+ [
+ 3,
+ 19
+ ],
+ [
+ 2,
+ 25
+ ],
+ [
+ -6,
+ 9
+ ],
+ [
+ -11,
+ 7
+ ],
+ [
+ -3,
+ 22
+ ],
+ [
+ 24,
+ 19
+ ],
+ [
+ -13,
+ 4
+ ],
+ [
+ -5,
+ 9
+ ],
+ [
+ -6,
+ 1
+ ],
+ [
+ -1,
+ -7
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -2,
+ 11
+ ],
+ [
+ -1,
+ 14
+ ],
+ [
+ -2,
+ 23
+ ],
+ [
+ -10,
+ 38
+ ],
+ [
+ -6,
+ 48
+ ],
+ [
+ -8,
+ 24
+ ],
+ [
+ -14,
+ 23
+ ],
+ [
+ -4,
+ 13
+ ],
+ [
+ -3,
+ 34
+ ],
+ [
+ 2,
+ 26
+ ],
+ [
+ -3,
+ 18
+ ],
+ [
+ 7,
+ -1
+ ],
+ [
+ 18,
+ -15
+ ],
+ [
+ 23,
+ -11
+ ],
+ [
+ 7,
+ -8
+ ],
+ [
+ 11,
+ -6
+ ],
+ [
+ 61,
+ -9
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 8,
+ 6
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 9,
+ -13
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 6,
+ 1
+ ],
+ [
+ 4,
+ 2
+ ],
+ [
+ 8,
+ 9
+ ],
+ [
+ 1,
+ -3
+ ],
+ [
+ -1,
+ -8
+ ],
+ [
+ 3,
+ -12
+ ],
+ [
+ 6,
+ -16
+ ],
+ [
+ 2,
+ -10
+ ],
+ [
+ -11,
+ -27
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -1,
+ 9
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ -21,
+ -46
+ ],
+ [
+ -7,
+ -22
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ 3,
+ -1
+ ],
+ [
+ 7,
+ 2
+ ],
+ [
+ 10,
+ 9
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -9,
+ -3
+ ],
+ [
+ -4,
+ 0
+ ],
+ [
+ 0,
+ 10
+ ],
+ [
+ 1,
+ 5
+ ],
+ [
+ 6,
+ 15
+ ],
+ [
+ 7,
+ 9
+ ],
+ [
+ 8,
+ 10
+ ],
+ [
+ 6,
+ 8
+ ],
+ [
+ 3,
+ 12
+ ],
+ [
+ 10,
+ 14
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ -1,
+ 11
+ ],
+ [
+ 1,
+ 2
+ ],
+ [
+ 5,
+ -1
+ ],
+ [
+ 2,
+ -20
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -9,
+ -11
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ 1,
+ -14
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ 8,
+ -16
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ 1,
+ -11
+ ],
+ [
+ -2,
+ -22
+ ],
+ [
+ -3,
+ -3
+ ],
+ [
+ -4,
+ 1
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -4,
+ -17
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -2,
+ 20
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -8,
+ -9
+ ],
+ [
+ -3,
+ -9
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ -4,
+ -6
+ ],
+ [
+ 10,
+ -2
+ ],
+ [
+ 10,
+ 3
+ ],
+ [
+ 7,
+ -6
+ ],
+ [
+ 3,
+ 0
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 6,
+ 21
+ ],
+ [
+ 3,
+ 4
+ ],
+ [
+ 4,
+ 0
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -2,
+ 25
+ ],
+ [
+ 0,
+ 15
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ 0,
+ 4
+ ],
+ [
+ 2,
+ 8
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ 1,
+ 7
+ ],
+ [
+ 6,
+ 15
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 7,
+ 15
+ ],
+ [
+ -2,
+ 6
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -3,
+ 7
+ ],
+ [
+ -3,
+ 10
+ ],
+ [
+ -3,
+ 3
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ 4,
+ -17
+ ],
+ [
+ -1,
+ -1
+ ],
+ [
+ -9,
+ 9
+ ],
+ [
+ -2,
+ 5
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 5,
+ 5
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 0,
+ 5
+ ],
+ [
+ -7,
+ 15
+ ],
+ [
+ -5,
+ 7
+ ],
+ [
+ -4,
+ 4
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 2,
+ 2
+ ],
+ [
+ 8,
+ -2
+ ],
+ [
+ 4,
+ 3
+ ],
+ [
+ 0,
+ 7
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ 1,
+ 22
+ ],
+ [
+ -3,
+ 17
+ ],
+ [
+ -2,
+ 3
+ ],
+ [
+ -2,
+ 1
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ -5,
+ 0
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -3,
+ 12
+ ],
+ [
+ -6,
+ 26
+ ],
+ [
+ 9,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 39,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 38,
+ 0
+ ],
+ [
+ 10,
+ 0
+ ]
+ ],
+ [
+ [
+ 8200,
+ 5010
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -3,
+ 1
+ ],
+ [
+ -1,
+ -3
+ ],
+ [
+ 0,
+ -9
+ ],
+ [
+ -1,
+ -4
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 0,
+ -1
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ -2,
+ -2
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ -2,
+ -5
+ ],
+ [
+ -3,
+ -11
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -9,
+ -16
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -3,
+ 2
+ ],
+ [
+ -3,
+ 5
+ ],
+ [
+ -1,
+ 8
+ ],
+ [
+ -1,
+ 5
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 7,
+ 15
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 2,
+ 10
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 5,
+ 3
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 3,
+ 10
+ ],
+ [
+ 3,
+ 5
+ ],
+ [
+ 4,
+ -2
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ -1,
+ -7
+ ]
+ ],
+ [
+ [
+ 8212,
+ 5031
+ ],
+ [
+ -3,
+ -2
+ ],
+ [
+ -5,
+ 1
+ ],
+ [
+ -1,
+ 4
+ ],
+ [
+ 2,
+ 11
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ 5,
+ 0
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ 0,
+ -8
+ ]
+ ],
+ [
+ [
+ 7866,
+ 5304
+ ],
+ [
+ -5,
+ -2
+ ],
+ [
+ -2,
+ 0
+ ],
+ [
+ 1,
+ 4
+ ],
+ [
+ 2,
+ 4
+ ],
+ [
+ 12,
+ 11
+ ],
+ [
+ 2,
+ -1
+ ],
+ [
+ 1,
+ -2
+ ],
+ [
+ -6,
+ -5
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ 0,
+ -3
+ ],
+ [
+ -3,
+ -3
+ ]
+ ],
+ [
+ [
+ 7881,
+ 5330
+ ],
+ [
+ -3,
+ -1
+ ],
+ [
+ -7,
+ 2
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ 7,
+ 4
+ ],
+ [
+ 3,
+ 1
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ -1,
+ -7
+ ]
+ ],
+ [
+ [
+ 8145,
+ 4985
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -5,
+ -7
+ ],
+ [
+ -13,
+ -10
+ ],
+ [
+ -2,
+ -6
+ ],
+ [
+ 0,
+ -6
+ ],
+ [
+ -9,
+ -22
+ ],
+ [
+ -4,
+ -14
+ ],
+ [
+ -3,
+ -14
+ ],
+ [
+ 1,
+ -9
+ ],
+ [
+ 4,
+ -3
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 3,
+ 7
+ ],
+ [
+ 4,
+ 5
+ ],
+ [
+ 6,
+ 6
+ ],
+ [
+ 4,
+ 7
+ ],
+ [
+ 6,
+ 19
+ ],
+ [
+ 6,
+ 11
+ ],
+ [
+ 4,
+ 1
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 6,
+ 5
+ ],
+ [
+ 6,
+ -2
+ ],
+ [
+ 3,
+ -7
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 1,
+ -5
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ -4,
+ -11
+ ],
+ [
+ -4,
+ -12
+ ],
+ [
+ -4,
+ -18
+ ],
+ [
+ -4,
+ -23
+ ],
+ [
+ -1,
+ -18
+ ],
+ [
+ 2,
+ -12
+ ],
+ [
+ -2,
+ -10
+ ],
+ [
+ -6,
+ -10
+ ],
+ [
+ -5,
+ -12
+ ],
+ [
+ -3,
+ -16
+ ],
+ [
+ -3,
+ -13
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 1,
+ -8
+ ],
+ [
+ 2,
+ -11
+ ],
+ [
+ 0,
+ -5
+ ],
+ [
+ -7,
+ -24
+ ],
+ [
+ -2,
+ -12
+ ],
+ [
+ -1,
+ -9
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ -5,
+ -18
+ ],
+ [
+ -1,
+ -10
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ 1,
+ -15
+ ],
+ [
+ -1,
+ -5
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -2,
+ -7
+ ],
+ [
+ 1,
+ -6
+ ],
+ [
+ 2,
+ -4
+ ],
+ [
+ 2,
+ -7
+ ],
+ [
+ 0,
+ -11
+ ],
+ [
+ 2,
+ -9
+ ],
+ [
+ 3,
+ -8
+ ],
+ [
+ 0,
+ -10
+ ],
+ [
+ -2,
+ -14
+ ],
+ [
+ 0,
+ -26
+ ],
+ [
+ 0,
+ -9
+ ]
+ ],
+ [
+ [
+ 7740,
+ 5300
+ ],
+ [
+ 3,
+ -5
+ ],
+ [
+ 8,
+ -7
+ ],
+ [
+ 6,
+ -1
+ ],
+ [
+ 8,
+ 2
+ ],
+ [
+ 30,
+ 12
+ ],
+ [
+ 13,
+ 8
+ ],
+ [
+ 12,
+ 15
+ ],
+ [
+ 2,
+ 0
+ ],
+ [
+ 5,
+ -3
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 17,
+ 17
+ ],
+ [
+ 5,
+ 2
+ ],
+ [
+ 4,
+ -1
+ ],
+ [
+ 6,
+ -6
+ ],
+ [
+ 1,
+ -4
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ -2,
+ -9
+ ],
+ [
+ 0,
+ -8
+ ],
+ [
+ -2,
+ -8
+ ],
+ [
+ -5,
+ -11
+ ],
+ [
+ 2,
+ -3
+ ],
+ [
+ 14,
+ 8
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 0,
+ 2
+ ],
+ [
+ -1,
+ 2
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 10,
+ -11
+ ],
+ [
+ 8,
+ -6
+ ],
+ [
+ 6,
+ -3
+ ],
+ [
+ 5,
+ 2
+ ]
+ ],
+ [
+ [
+ 7866,
+ 5332
+ ],
+ [
+ -1,
+ -2
+ ],
+ [
+ -4,
+ 3
+ ],
+ [
+ 0,
+ 3
+ ],
+ [
+ 1,
+ 3
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 3,
+ -4
+ ],
+ [
+ 0,
+ -2
+ ]
+ ],
+ [
+ [
+ 7891,
+ 5350
+ ],
+ [
+ -2,
+ -3
+ ],
+ [
+ -2,
+ 2
+ ],
+ [
+ 1,
+ 6
+ ],
+ [
+ 2,
+ 3
+ ],
+ [
+ 2,
+ 1
+ ],
+ [
+ 1,
+ -1
+ ],
+ [
+ 0,
+ -4
+ ],
+ [
+ -2,
+ -4
+ ]
+ ]
+ ]
+}
diff --git a/web/ons-demo/data/world.txt b/web/ons-demo/data/world.txt
new file mode 100644
index 0000000..04bfb53
--- /dev/null
+++ b/web/ons-demo/data/world.txt
@@ -0,0 +1,10 @@
+see: http://bost.ocks.org/mike/map/
+
+brew install gdal
+npm install -g topojson
+
+download: http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_1_states_provinces_lakes_shp.zip
+
+$ ogr2ogr -f GeoJSON -where "sr_adm0_a3 IN ('USA')" states.json ~/Desktop/ne_50m_admin_1_states_provinces_lakes_shp/ne_50m_admin_1_states_provinces_lakes_shp.shp
+$ topojson -o states.json world.json
+
diff --git a/web/ons-demo/index.html b/web/ons-demo/index.html
new file mode 100644
index 0000000..ab13250
--- /dev/null
+++ b/web/ons-demo/index.html
@@ -0,0 +1,86 @@
+<html>
+<head>
+ <link rel="stylesheet" href="css/layout.default.css" type="text/css"/>
+ <link rel="stylesheet" href="css/skin.default.css" type="text/css"/>
+</head>
+<body>
+<div id='background'>
+ <img id='background-image' src='assets/logo.svg'/>
+</div>
+
+<div id='contents'>
+
+ <div class='header'>
+ <img id='logo' src='assets/logo.svg'></img>
+ <div id='status'>
+ <div class='status'><span class='dynamic' id='activeFlows'>????</span><span class='static'>Flows</span></div>
+ <div class='status'><span class='dynamic' id='activeSwitches'>???</span><span class='static'>Active Switches</span></div>
+ <div class='status'><span class='dynamic' id='activeLinks'>???</span><span class='static'>Links</span></div>
+ </div>
+ <div id='lastUpdated' class='status'><span class='static'>Last updated:</span><span id='lastUpdate' class='dynamic'>Mon Mar 18 11:11:12 PDT 2013</span></div>
+ </div>
+
+ <div id='onos'>
+ <div id='cluster-label'>ONOS Instances</div>
+ <div id='controllers'></div>
+ <div id='actions'>
+ <!--<div id='action-local' class='action'>1</div>-->
+ <div id='action-reset' class='action'>Reset</div>
+ <div id='action-scale' class='action'>Scale</div>
+ <div id='action-all' class='action'>Backup</div>
+ <div id='action-kill' class='action'>Kill</div>
+ </div>
+ </div>
+
+ <div id='topologyArea'>
+ <div id='svg-container'></div>
+ </div>
+
+ <div id='selectedFlowsHeader'>
+ <div id='showFlowChooser' class='flowId'><div class='white-eye'></div></div>
+ <div class='flowId'>id</div>
+ <div class='srcDPID'>src</div>
+ <div class='dstDPID'>dst</div>
+ <div class='iperf'>iperf</div>
+ </div>
+
+ <div id='selectedFlows'></div>
+
+ <div id='flowChooser'></div>
+</div>
+<div id='confirm'>
+ <div id='confirm-background'></div>
+ <div id='confirm-panel'>
+ <div id='confirm-prompt'>A PROMPT</div>
+ <select id='confirm-select'></select>
+ <div id='confirm-buttons'>
+ <div id='confirm-ok' class='confirm-button'>OK</div>
+ <div id='confirm-cancel' class='confirm-button'>CANCEL</div>
+ </div>
+ </div>
+</div>
+
+<script src="d3/d3.v3.js" charset="utf-8"></script>
+<script src="d3/topojson.v0.min.js"></script>
+<script src="js/async.js"></script>
+<script src="js/debug.js"></script>
+<script src="js/constants.js"></script>
+<script src="js/globals.js"></script>
+<script src="js/utils.js"></script>
+<script src="js/model.js"></script>
+<script src="js/controller.js"></script>
+<script src="js/controllers.js"></script>
+
+<!-- choose ring or map layout -->
+<!--script src="js/rings.js"></script-->
+<script src="js/map.js"></script>
+
+<script src="js/topologyactions.js"></script>
+<script src="js/topology.js"></script>
+<script src="js/iperf.js"></script>
+<script src="js/flows.js"></script>
+<script src="js/init.js"></script>
+<script src="js/app.js"></script>
+</body>
+
+</html>
diff --git a/web/ons-demo/js/app.js b/web/ons-demo/js/app.js
new file mode 100644
index 0000000..d869de7
--- /dev/null
+++ b/web/ons-demo/js/app.js
@@ -0,0 +1,73 @@
+/*global d3, document∆*/
+
+
+function updateFlow(model) {
+ model.flows.forEach(function (flow) {
+ flow.flowId = flow.flowId.value;
+ flow.installerId = flow.installerId.value;
+ flow.dstDpid = flow.dataPath.dstPort.dpid.value;
+ flow.srcDpid = flow.dataPath.srcPort.dpid.value;
+ flow.dstPort = flow.dataPath.dstPort.port.value;
+ flow.srcPort = flow.dataPath.srcPort.port.value;
+ });
+}
+
+function sync() {
+ var d = Date.now();
+
+ updateModel(function (newModel) {
+// console.log('Update time: ' + (Date.now() - d)/1000 + 's');
+
+ if (newModel) {
+ updateFlow(newModel);
+ var modelChanged = false;
+ var newModelString = JSON.stringify(newModel);
+ if (!modelString || newModelString != modelString) {
+ modelChanged = true;
+ model = newModel;
+ modelString = newModelString;
+ } else {
+ // console.log('no change');
+ }
+
+ if (modelChanged) {
+ updateControllers();
+ updateSelectedFlows();
+ updateTopology();
+ }
+
+ updateHeader(newModel);
+
+ d3.select('#contents').style('visibility', 'visible');
+ }
+
+ // do it again in 1s
+ setTimeout(function () {
+ sync()
+ }, 1000);
+ });
+}
+
+// workaround for another Chrome v25 bug
+// viewbox transform stuff doesn't work in combination with browser zoom
+// also works in Chrome v27
+function zoomWorkaround() {
+ var zoom = window.document.body.clientWidth/window.document.width;
+ // workaround does not seem to be effective for transforming mouse coordinates
+ // map display does not use the transform stuff, so commenting out
+// d3.select('#svg-container').style('zoom', zoom);
+}
+
+d3.select(window).on('resize', zoomWorkaround);
+
+appInit(function () {
+ // workaround for Chrome v25 bug
+ // if executed immediately, the view box transform logic doesn't work properly
+ // fixed in Chrome v27
+ setTimeout(function () {
+ zoomWorkaround();
+ sync();
+ }, 100);
+});
+
+
diff --git a/web/ons-demo/js/async.js b/web/ons-demo/js/async.js
new file mode 100644
index 0000000..5b277cd
--- /dev/null
+++ b/web/ons-demo/js/async.js
@@ -0,0 +1,947 @@
+/*global setImmediate: false, setTimeout: false, console: false */
+(function () {
+
+ var async = {};
+
+ // global on the server, window in the browser
+ var root, previous_async;
+
+ root = this;
+ if (root != null) {
+ previous_async = root.async;
+ }
+
+ async.noConflict = function () {
+ root.async = previous_async;
+ return async;
+ };
+
+ function only_once(fn) {
+ var called = false;
+ return function() {
+ if (called) throw new Error("Callback was already called.");
+ called = true;
+ fn.apply(root, arguments);
+ }
+ }
+
+ //// cross-browser compatiblity functions ////
+
+ var _each = function (arr, iterator) {
+ if (arr.forEach) {
+ return arr.forEach(iterator);
+ }
+ for (var i = 0; i < arr.length; i += 1) {
+ iterator(arr[i], i, arr);
+ }
+ };
+
+ var _map = function (arr, iterator) {
+ if (arr.map) {
+ return arr.map(iterator);
+ }
+ var results = [];
+ _each(arr, function (x, i, a) {
+ results.push(iterator(x, i, a));
+ });
+ return results;
+ };
+
+ var _reduce = function (arr, iterator, memo) {
+ if (arr.reduce) {
+ return arr.reduce(iterator, memo);
+ }
+ _each(arr, function (x, i, a) {
+ memo = iterator(memo, x, i, a);
+ });
+ return memo;
+ };
+
+ var _keys = function (obj) {
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+ var keys = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ return keys;
+ };
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+ if (typeof process === 'undefined' || !(process.nextTick)) {
+ if (typeof setImmediate === 'function') {
+ async.setImmediate = setImmediate;
+ async.nextTick = setImmediate;
+ }
+ else {
+ async.setImmediate = async.nextTick;
+ async.nextTick = function (fn) {
+ setTimeout(fn, 0);
+ };
+ }
+ }
+ else {
+ async.nextTick = process.nextTick;
+ async.setImmediate = setImmediate;
+ }
+
+ async.each = function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ _each(arr, function (x) {
+ iterator(x, only_once(function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed >= arr.length) {
+ callback(null);
+ }
+ }
+ }));
+ });
+ };
+ async.forEach = async.each;
+
+ async.eachSeries = function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length) {
+ return callback();
+ }
+ var completed = 0;
+ var iterate = function () {
+ iterator(arr[completed], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed >= arr.length) {
+ callback(null);
+ }
+ else {
+ iterate();
+ }
+ }
+ });
+ };
+ iterate();
+ };
+ async.forEachSeries = async.eachSeries;
+
+ async.eachLimit = function (arr, limit, iterator, callback) {
+ var fn = _eachLimit(limit);
+ fn.apply(null, [arr, iterator, callback]);
+ };
+ async.forEachLimit = async.eachLimit;
+
+ var _eachLimit = function (limit) {
+
+ return function (arr, iterator, callback) {
+ callback = callback || function () {};
+ if (!arr.length || limit <= 0) {
+ return callback();
+ }
+ var completed = 0;
+ var started = 0;
+ var running = 0;
+
+ (function replenish () {
+ if (completed >= arr.length) {
+ return callback();
+ }
+
+ while (running < limit && started < arr.length) {
+ started += 1;
+ running += 1;
+ iterator(arr[started - 1], function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ running -= 1;
+ if (completed >= arr.length) {
+ callback();
+ }
+ else {
+ replenish();
+ }
+ }
+ });
+ }
+ })();
+ };
+ };
+
+
+ var doParallel = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.each].concat(args));
+ };
+ };
+ var doParallelLimit = function(limit, fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [_eachLimit(limit)].concat(args));
+ };
+ };
+ var doSeries = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ return fn.apply(null, [async.eachSeries].concat(args));
+ };
+ };
+
+
+ var _asyncMap = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err, v) {
+ results[x.index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ };
+ async.map = doParallel(_asyncMap);
+ async.mapSeries = doSeries(_asyncMap);
+ async.mapLimit = function (arr, limit, iterator, callback) {
+ return _mapLimit(limit)(arr, iterator, callback);
+ };
+
+ var _mapLimit = function(limit) {
+ return doParallelLimit(limit, _asyncMap);
+ };
+
+ // reduce only has a series version, as doing reduce in parallel won't
+ // work in many situations.
+ async.reduce = function (arr, memo, iterator, callback) {
+ async.eachSeries(arr, function (x, callback) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, memo);
+ });
+ };
+ // inject alias
+ async.inject = async.reduce;
+ // foldl alias
+ async.foldl = async.reduce;
+
+ async.reduceRight = function (arr, memo, iterator, callback) {
+ var reversed = _map(arr, function (x) {
+ return x;
+ }).reverse();
+ async.reduce(reversed, memo, iterator, callback);
+ };
+ // foldr alias
+ async.foldr = async.reduceRight;
+
+ var _filter = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.filter = doParallel(_filter);
+ async.filterSeries = doSeries(_filter);
+ // select alias
+ async.select = async.filter;
+ async.selectSeries = async.filterSeries;
+
+ var _reject = function (eachfn, arr, iterator, callback) {
+ var results = [];
+ arr = _map(arr, function (x, i) {
+ return {index: i, value: x};
+ });
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (v) {
+ if (!v) {
+ results.push(x);
+ }
+ callback();
+ });
+ }, function (err) {
+ callback(_map(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), function (x) {
+ return x.value;
+ }));
+ });
+ };
+ async.reject = doParallel(_reject);
+ async.rejectSeries = doSeries(_reject);
+
+ var _detect = function (eachfn, arr, iterator, main_callback) {
+ eachfn(arr, function (x, callback) {
+ iterator(x, function (result) {
+ if (result) {
+ main_callback(x);
+ main_callback = function () {};
+ }
+ else {
+ callback();
+ }
+ });
+ }, function (err) {
+ main_callback();
+ });
+ };
+ async.detect = doParallel(_detect);
+ async.detectSeries = doSeries(_detect);
+
+ async.some = function (arr, iterator, main_callback) {
+ async.each(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ main_callback(true);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(false);
+ });
+ };
+ // any alias
+ async.any = async.some;
+
+ async.every = function (arr, iterator, main_callback) {
+ async.each(arr, function (x, callback) {
+ iterator(x, function (v) {
+ if (!v) {
+ main_callback(false);
+ main_callback = function () {};
+ }
+ callback();
+ });
+ }, function (err) {
+ main_callback(true);
+ });
+ };
+ // all alias
+ async.all = async.every;
+
+ async.sortBy = function (arr, iterator, callback) {
+ async.map(arr, function (x, callback) {
+ iterator(x, function (err, criteria) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ callback(null, {value: x, criteria: criteria});
+ }
+ });
+ }, function (err, results) {
+ if (err) {
+ return callback(err);
+ }
+ else {
+ var fn = function (left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ };
+ callback(null, _map(results.sort(fn), function (x) {
+ return x.value;
+ }));
+ }
+ });
+ };
+
+ async.auto = function (tasks, callback) {
+ callback = callback || function () {};
+ var keys = _keys(tasks);
+ if (!keys.length) {
+ return callback(null);
+ }
+
+ var results = {};
+
+ var listeners = [];
+ var addListener = function (fn) {
+ listeners.unshift(fn);
+ };
+ var removeListener = function (fn) {
+ for (var i = 0; i < listeners.length; i += 1) {
+ if (listeners[i] === fn) {
+ listeners.splice(i, 1);
+ return;
+ }
+ }
+ };
+ var taskComplete = function () {
+ _each(listeners.slice(0), function (fn) {
+ fn();
+ });
+ };
+
+ addListener(function () {
+ if (_keys(results).length === keys.length) {
+ callback(null, results);
+ callback = function () {};
+ }
+ });
+
+ _each(keys, function (k) {
+ var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+ var taskCallback = function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ if (err) {
+ var safeResults = {};
+ _each(_keys(results), function(rkey) {
+ safeResults[rkey] = results[rkey];
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
+ // stop subsequent errors hitting callback multiple times
+ callback = function () {};
+ }
+ else {
+ results[k] = args;
+ async.setImmediate(taskComplete);
+ }
+ };
+ var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+ var ready = function () {
+ return _reduce(requires, function (a, x) {
+ return (a && results.hasOwnProperty(x));
+ }, true) && !results.hasOwnProperty(k);
+ };
+ if (ready()) {
+ task[task.length - 1](taskCallback, results);
+ }
+ else {
+ var listener = function () {
+ if (ready()) {
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ };
+ addListener(listener);
+ }
+ });
+ };
+
+ async.waterfall = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor !== Array) {
+ var err = new Error('First argument to waterfall must be an array of functions');
+ return callback(err);
+ }
+ if (!tasks.length) {
+ return callback();
+ }
+ var wrapIterator = function (iterator) {
+ return function (err) {
+ if (err) {
+ callback.apply(null, arguments);
+ callback = function () {};
+ }
+ else {
+ var args = Array.prototype.slice.call(arguments, 1);
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ }
+ else {
+ args.push(callback);
+ }
+ async.setImmediate(function () {
+ iterator.apply(null, args);
+ });
+ }
+ };
+ };
+ wrapIterator(async.iterator(tasks))();
+ };
+
+ var _parallel = function(eachfn, tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ eachfn.map(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ eachfn.each(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.parallel = function (tasks, callback) {
+ _parallel({ map: async.map, each: async.each }, tasks, callback);
+ };
+
+ async.parallelLimit = function(tasks, limit, callback) {
+ _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
+ };
+
+ async.series = function (tasks, callback) {
+ callback = callback || function () {};
+ if (tasks.constructor === Array) {
+ async.mapSeries(tasks, function (fn, callback) {
+ if (fn) {
+ fn(function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ callback.call(null, err, args);
+ });
+ }
+ }, callback);
+ }
+ else {
+ var results = {};
+ async.eachSeries(_keys(tasks), function (k, callback) {
+ tasks[k](function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[k] = args;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
+ };
+
+ async.iterator = function (tasks) {
+ var makeCallback = function (index) {
+ var fn = function () {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ };
+ fn.next = function () {
+ return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+ };
+ return fn;
+ };
+ return makeCallback(0);
+ };
+
+ async.apply = function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function () {
+ return fn.apply(
+ null, args.concat(Array.prototype.slice.call(arguments))
+ );
+ };
+ };
+
+ var _concat = function (eachfn, arr, fn, callback) {
+ var r = [];
+ eachfn(arr, function (x, cb) {
+ fn(x, function (err, y) {
+ r = r.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, r);
+ });
+ };
+ async.concat = doParallel(_concat);
+ async.concatSeries = doSeries(_concat);
+
+ async.whilst = function (test, iterator, callback) {
+ if (test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.whilst(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.doWhilst = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (test()) {
+ async.doWhilst(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
+ async.until = function (test, iterator, callback) {
+ if (!test()) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ async.until(test, iterator, callback);
+ });
+ }
+ else {
+ callback();
+ }
+ };
+
+ async.doUntil = function (iterator, test, callback) {
+ iterator(function (err) {
+ if (err) {
+ return callback(err);
+ }
+ if (!test()) {
+ async.doUntil(iterator, test, callback);
+ }
+ else {
+ callback();
+ }
+ });
+ };
+
+ async.queue = function (worker, concurrency) {
+ if (concurrency === undefined) {
+ concurrency = 1;
+ }
+ function _insert(q, data, pos, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ var item = {
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.saturated && q.tasks.length === concurrency) {
+ q.saturated();
+ }
+ async.setImmediate(q.process);
+ });
+ }
+
+ var workers = 0;
+ var q = {
+ tasks: [],
+ concurrency: concurrency,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ _insert(q, data, false, callback);
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
+ },
+ process: function () {
+ if (workers < q.concurrency && q.tasks.length) {
+ var task = q.tasks.shift();
+ if (q.empty && q.tasks.length === 0) {
+ q.empty();
+ }
+ workers += 1;
+ var next = function () {
+ workers -= 1;
+ if (task.callback) {
+ task.callback.apply(task, arguments);
+ }
+ if (q.drain && q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
+ var cb = only_once(next);
+ worker(task.data, cb);
+ }
+ },
+ length: function () {
+ return q.tasks.length;
+ },
+ running: function () {
+ return workers;
+ }
+ };
+ return q;
+ };
+
+ async.cargo = function (worker, payload) {
+ var working = false,
+ tasks = [];
+
+ var cargo = {
+ tasks: tasks,
+ payload: payload,
+ saturated: null,
+ empty: null,
+ drain: null,
+ push: function (data, callback) {
+ if(data.constructor !== Array) {
+ data = [data];
+ }
+ _each(data, function(task) {
+ tasks.push({
+ data: task,
+ callback: typeof callback === 'function' ? callback : null
+ });
+ if (cargo.saturated && tasks.length === payload) {
+ cargo.saturated();
+ }
+ });
+ async.setImmediate(cargo.process);
+ },
+ process: function process() {
+ if (working) return;
+ if (tasks.length === 0) {
+ if(cargo.drain) cargo.drain();
+ return;
+ }
+
+ var ts = typeof payload === 'number'
+ ? tasks.splice(0, payload)
+ : tasks.splice(0);
+
+ var ds = _map(ts, function (task) {
+ return task.data;
+ });
+
+ if(cargo.empty) cargo.empty();
+ working = true;
+ worker(ds, function () {
+ working = false;
+
+ var args = arguments;
+ _each(ts, function (data) {
+ if (data.callback) {
+ data.callback.apply(null, args);
+ }
+ });
+
+ process();
+ });
+ },
+ length: function () {
+ return tasks.length;
+ },
+ running: function () {
+ return working;
+ }
+ };
+ return cargo;
+ };
+
+ var _console_fn = function (name) {
+ return function (fn) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ fn.apply(null, args.concat([function (err) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (typeof console !== 'undefined') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ }
+ else if (console[name]) {
+ _each(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ }]));
+ };
+ };
+ async.log = _console_fn('log');
+ async.dir = _console_fn('dir');
+ /*async.info = _console_fn('info');
+ async.warn = _console_fn('warn');
+ async.error = _console_fn('error');*/
+
+ async.memoize = function (fn, hasher) {
+ var memo = {};
+ var queues = {};
+ hasher = hasher || function (x) {
+ return x;
+ };
+ var memoized = function () {
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ callback.apply(null, memo[key]);
+ }
+ else if (key in queues) {
+ queues[key].push(callback);
+ }
+ else {
+ queues[key] = [callback];
+ fn.apply(null, args.concat([function () {
+ memo[key] = arguments;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, arguments);
+ }
+ }]));
+ }
+ };
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+ };
+
+ async.unmemoize = function (fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
+ };
+
+ async.times = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.map(counter, iterator, callback);
+ };
+
+ async.timesSeries = function (count, iterator, callback) {
+ var counter = [];
+ for (var i = 0; i < count; i++) {
+ counter.push(i);
+ }
+ return async.mapSeries(counter, iterator, callback);
+ };
+
+ async.compose = function (/* functions... */) {
+ var fns = Array.prototype.reverse.call(arguments);
+ return function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ async.reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([function () {
+ var err = arguments[0];
+ var nextargs = Array.prototype.slice.call(arguments, 1);
+ cb(err, nextargs);
+ }]))
+ },
+ function (err, results) {
+ callback.apply(that, [err].concat(results));
+ });
+ };
+ };
+
+ var _applyEach = function (eachfn, fns /*args...*/) {
+ var go = function () {
+ var that = this;
+ var args = Array.prototype.slice.call(arguments);
+ var callback = args.pop();
+ return eachfn(fns, function (fn, cb) {
+ fn.apply(that, args.concat([cb]));
+ },
+ callback);
+ };
+ if (arguments.length > 2) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ };
+ async.applyEach = doParallel(_applyEach);
+ async.applyEachSeries = doSeries(_applyEach);
+
+ async.forever = function (fn, callback) {
+ function next(err) {
+ if (err) {
+ if (callback) {
+ return callback(err);
+ }
+ throw err;
+ }
+ fn(next);
+ }
+ next();
+ };
+
+ // AMD / RequireJS
+ if (typeof define !== 'undefined' && define.amd) {
+ define([], function () {
+ return async;
+ });
+ }
+ // Node.js
+ else if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
+ // included directly via <script> tag
+ else {
+ root.async = async;
+ }
+
+}());
\ No newline at end of file
diff --git a/web/ons-demo/js/constants.js b/web/ons-demo/js/constants.js
new file mode 100644
index 0000000..236d79a
--- /dev/null
+++ b/web/ons-demo/js/constants.js
@@ -0,0 +1,31 @@
+/***************************************************************************************************
+timeout used by controller functions. after the timeout expires the "pending" action
+is removed and the topology view is whatever is reported by the API
+***************************************************************************************************/
+/* var pendingTimeout = 30000; */
+var pendingTimeout = 60000;
+
+/***************************************************************************************************
+CSS names for the pallette of colors used by the topology view
+***************************************************************************************************/
+var colors = [
+ 'color1',
+ 'color2',
+ 'color3',
+ 'color4',
+ 'color7',
+ 'color8',
+ 'color9',
+// 'color11',
+ 'color12'
+];
+colors.reverse();
+
+/***************************************************************************************************
+Widths of each switch type
+***************************************************************************************************/
+var widths = {
+ edge: 6,
+ aggregation: 16,
+ core: 20
+}
diff --git a/web/ons-demo/js/controller.js b/web/ons-demo/js/controller.js
new file mode 100644
index 0000000..fb516ae
--- /dev/null
+++ b/web/ons-demo/js/controller.js
@@ -0,0 +1,122 @@
+/*global d3*/
+
+function callURL(url, cb) {
+ d3.text(url, function (error, result) {
+ if (error) {
+ console.log(url + ' : ' + error.status);
+ } else {
+ if (cb) {
+ cb(result);
+ }
+// console.log(result);
+ }
+ });
+}
+
+function MAC(dpid) {
+ var cmps = dpid.split(':');
+ var MAC = '00:00:c0:a8:' + [cmps[6], cmps[7]].join(':');
+ return MAC;
+}
+
+var controllerFunctions = {
+ linkCmd: function (cmd, link) {
+ var url = '/proxy/gui/link/' + [cmd, link['src-switch'], link['src-port'], link['dst-switch'], link['dst-port']].join('/');
+ callURL(url);
+
+ },
+ switchCmd: function (cmd, s) {
+ var url = '/proxy/gui/switch/' + [cmd, s.dpid].join('/');
+ callURL(url);
+ },
+ ctrlCmd: function (cmd, c) {
+ var url = '/proxy/gui/controller/' + [cmd, c].join('/');
+ callURL(url);
+ },
+ addFlowCmd: function (src, dst) {
+ var url = '/proxy/gui/addflow/' + [src.dpid, 1, dst.dpid, 1, MAC(src.dpid), MAC(dst.dpid)].join('/');
+ callURL(url);
+ },
+ delFlowCmd: function (flow) {
+ var url = '/proxy/gui/delflow/' + flow.flowId;
+ callURL(url);
+ },
+ startIPerfCmd: function (flow, duration, numSamples) {
+ var flowId = parseInt(flow.flowId, 16);
+ var url = '/proxy/gui/iperf/start/' + [flowId, duration, numSamples].join('/');
+ callURL(url)
+ },
+ getIPerfDataCmd: function (flow, cb) {
+ var flowId = parseInt(flow.flowId, 16);
+ var url = '/proxy/gui/iperf/rate/' + flowId;
+ callURL(url, cb);
+ },
+ switchControllerCmd: function (cmd) {
+ var url = '/proxy/gui/switchctrl/' + cmd;
+ callURL(url);
+ },
+ resetCmd: function () {
+ var url = '/proxy/gui/reset';
+ callURL(url);
+ },
+ scaleCmd: function () {
+ var url = '/proxy/gui/scale';
+ callURL(url);
+ }
+};
+
+function linkUp(link) {
+ controllerFunctions.linkCmd('up', link);
+}
+
+function linkDown(link) {
+ controllerFunctions.linkCmd('down', link);
+}
+
+function switchUp(s) {
+ controllerFunctions.switchCmd('up', s);
+}
+
+function switchDown(s) {
+ controllerFunctions.switchCmd('down', s);
+}
+
+function controllerUp(c) {
+ controllerFunctions.ctrlCmd('up', c);
+}
+
+function controllerDown(c) {
+ controllerFunctions.ctrlCmd('down', c);
+}
+
+function addFlow(src, dst) {
+ controllerFunctions.addFlowCmd(src, dst);
+}
+
+function deleteFlow(flow) {
+ controllerFunctions.delFlowCmd(flow);
+}
+
+function startIPerf(flow, duration, numSamples) {
+ controllerFunctions.startIPerfCmd(flow, duration, numSamples);
+}
+
+function getIPerfData(flow, cb) {
+ controllerFunctions.getIPerfDataCmd(flow, cb);
+}
+
+function switchLocal() {
+ controllerFunctions.switchControllerCmd('local');
+}
+function switchAll() {
+ controllerFunctions.switchControllerCmd('all');
+}
+
+function resetNetwork() {
+ controllerFunctions.resetCmd();
+}
+
+function scaleNetwork() {
+ controllerFunctions.scaleCmd();;
+}
+
diff --git a/web/ons-demo/js/controllers.js b/web/ons-demo/js/controllers.js
new file mode 100644
index 0000000..501ac1d
--- /dev/null
+++ b/web/ons-demo/js/controllers.js
@@ -0,0 +1,71 @@
+function updateControllers() {
+ var controllers = d3.select('#controllers').selectAll('.controller').data(model.controllers);
+ controllers.enter().append('div')
+ .each(function (c) {
+ controllerColorMap[c] = colors.pop();
+ d3.select(document.body).classed(controllerColorMap[c] + '-selected', true);
+ })
+ .text(function (d) {
+ return d;
+ })
+ .append('div')
+ .attr('class', 'black-eye');
+
+ controllers.attr('class', function (d) {
+ var color = 'colorInactive';
+ if (model.activeControllers.indexOf(d) != -1) {
+ color = controllerColorMap[d];
+ }
+ var className = 'controller ' + color;
+ return className;
+ });
+
+ // this should never be needed
+ // controllers.exit().remove();
+
+ controllers.on('dblclick', function (c) {
+ if (model.activeControllers.indexOf(c) != -1) {
+ var prompt = 'Dectivate ' + c + '?';
+ var that = this;
+ doConfirm(prompt, function (result) {
+ if (result) {
+ controllerDown(c);
+ setPending(d3.select(that));
+ };
+ })
+ } else {
+ var prompt = 'Activate ' + c + '?';
+ var that = this;
+ doConfirm(prompt, function (result) {
+ if (result) {
+ controllerUp(c);
+ setPending(d3.select(that));
+ };
+ });
+ }
+ });
+
+ controllers.select('.black-eye').on('click', function (c) {
+ var allSelected = true;
+ for (var key in controllerColorMap) {
+ if (!d3.select(document.body).classed(controllerColorMap[key] + '-selected')) {
+ allSelected = false;
+ break;
+ }
+ }
+ if (allSelected) {
+ for (var key in controllerColorMap) {
+ d3.select(document.body).classed(controllerColorMap[key] + '-selected', key == c)
+ }
+ } else {
+ for (var key in controllerColorMap) {
+ d3.select(document.body).classed(controllerColorMap[key] + '-selected', true)
+ }
+ }
+
+ // var selected = d3.select(document.body).classed(controllerColorMap[c] + '-selected');
+ // d3.select(document.body).classed(controllerColorMap[c] + '-selected', !selected);
+ });
+
+
+}
\ No newline at end of file
diff --git a/web/ons-demo/js/debug.js b/web/ons-demo/js/debug.js
new file mode 100644
index 0000000..3d3b302
--- /dev/null
+++ b/web/ons-demo/js/debug.js
@@ -0,0 +1,31 @@
+/***************************************************************************************************
+find the links that include the switch with this dpid
+***************************************************************************************************/
+function debug_findlink(model, dpid) {
+ var links = [];
+ model.links.forEach(function (link) {
+ if (link['src-switch'] == dpid || link['dst-switch'] == dpid) {
+ links.push(link);
+ }
+ });
+ return links;
+}
+
+function debug_findswitch(model, dpid) {
+ var sw;
+
+ model.edgeSwitches.forEach(function (s) {
+ if (s.dpid == dpid)
+ sw = s;
+ });
+ model.aggregationSwitches.forEach(function (s) {
+ if (s.dpid == dpid)
+ sw = s;
+ });
+ model.coreSwitches.forEach(function (s) {
+ if (s.dpid == dpid)
+ sw = s;
+ });
+
+ return sw;
+}
\ No newline at end of file
diff --git a/web/ons-demo/js/flows.js b/web/ons-demo/js/flows.js
new file mode 100644
index 0000000..9f72fe2
--- /dev/null
+++ b/web/ons-demo/js/flows.js
@@ -0,0 +1,361 @@
+function startFlowAnimation(flow) {
+// console.log('starting animation for flow: ' + flow.flowId);
+
+ var flowSelection = d3.select(document.getElementById(makeFlowKey(flow)));
+ if (flowSelection.select('animate').empty()) {
+ flowSelection.append('svg:animate')
+ .attr('attributeName', 'stroke-dashoffset')
+ .attr('attributeType', 'xml')
+ .attr('from', '500')
+ .attr('to', '-500')
+ .attr('dur', '20s')
+ .attr('repeatCount', 'indefinite');
+ }
+}
+
+function stopFlowAnimation(flow) {
+ var flowSelection = d3.select(document.getElementById(makeFlowKey(flow)));
+ flowSelection.select('animate').remove();
+}
+
+
+function updateSelectedFlowsTopology() {
+ // DRAW THE FLOWS
+ var topologyFlows = [];
+ selectedFlows.forEach(function (flow) {
+ if (flow) {
+ topologyFlows.push(flow);
+ }
+ });
+
+ var flows = flowLayer.selectAll('.flow').data(topologyFlows, function (d) {
+ return d.flowId;
+ });
+
+ flows.enter().append("svg:path").attr('class', 'flow')
+ .attr('stroke-dasharray', '4, 10')
+
+ flows.exit().remove();
+
+ flows.attr('d', function (d) {
+ if (!d) {
+ return;
+ }
+ var pts = [];
+ if (d.createPending) {
+ // create a temporary vector to indicate the pending flow
+ var s1 = d3.select(document.getElementById(d.srcDpid));
+ var s2 = d3.select(document.getElementById(d.dstDpid));
+
+ var pt1 = document.querySelector('svg').createSVGPoint();
+ pt1.x = s1.attr('x');
+ pt1.y = s1.attr('y');
+ if (drawingRings) {
+ pt1 = pt1.matrixTransform(s1[0][0].getCTM());
+ }
+ pts.push(pt1);
+
+ var pt2 = document.querySelector('svg').createSVGPoint();
+ pt2.x = s2.attr('x');
+ pt2.y = s2.attr('y');
+ if (drawingRings) {
+ pt2 = pt2.matrixTransform(s2[0][0].getCTM());
+ }
+ pts.push(pt2);
+
+ } else if (d.dataPath && d.dataPath.flowEntries) {
+ d.dataPath.flowEntries.forEach(function (flowEntry) {
+ var s = d3.select(document.getElementById(flowEntry.dpid.value));
+ // s[0] is null if the flow entry refers to a non-existent switch
+ if (s[0][0]) {
+ var pt = document.querySelector('svg').createSVGPoint();
+ pt.x = s.attr('x');
+ pt.y = s.attr('y');
+ if (drawingRings) {
+ pt = pt.matrixTransform(s[0][0].getCTM());
+ }
+ pts.push(pt);
+ } else {
+ console.log('flow refers to non-existent switch: ' + flowEntry.dpid.value);
+ }
+ });
+ }
+ if (pts.length) {
+ return line(pts);
+ } else {
+ return "M0,0";
+ }
+ })
+ .attr('id', function (d) {
+ if (d) {
+ return makeFlowKey(d);
+ }
+ })
+ .classed('pending', function (d) {
+ return d && (d.createPending || d.deletePending);
+ });
+}
+
+function updateSelectedFlowsTable() {
+ function rowEnter(d) {
+ var row = d3.select(this);
+ row.append('div').classed('deleteFlow', true);
+ row.append('div').classed('flowId', true);
+ row.append('div').classed('srcDPID', true);
+ row.append('div').classed('dstDPID', true);
+ row.append('div').classed('iperf', true);
+
+ row.select('.iperf')
+ .append('div')
+ .attr('class', 'iperf-container')
+ .append('svg:svg')
+ .attr('viewBox', '0 0 1000 32')
+ .attr('preserveAspectRatio', 'none')
+ .append('svg:g')
+ .append('svg:path')
+ .attr('class', 'iperfdata');
+
+ row.on('mouseover', function (d) {
+ if (d) {
+ var path = document.getElementById(makeFlowKey(d));
+ d3.select(path).classed('highlight', true);
+ }
+ });
+ row.on('mouseout', function (d) {
+ if (d) {
+ var path = document.getElementById(makeFlowKey(d));
+ d3.select(path).classed('highlight', false);
+ }
+ });
+ }
+
+ function rowUpdate(d) {
+ var row = d3.select(this);
+ row.attr('id', function (d) {
+ if (d) {
+ return makeSelectedFlowKey(d);
+ }
+ });
+
+ if (!d || !hasIPerf(d)) {
+ row.select('.iperfdata')
+ .attr('d', 'M0,0');
+ }
+
+ row.select('.deleteFlow').on('click', function () {
+ deselectFlow(d);
+ });
+ row.on('dblclick', function () {
+ if (d) {
+ var prompt = 'Delete flow ' + d.flowId + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ deleteFlow(d);
+ d.deletePending = true;
+ updateSelectedFlows();
+
+ setTimeout(function () {
+ d.deletePending = false;
+ updateSelectedFlows();
+ }, pendingTimeout)
+ };
+ });
+ }
+ });
+
+ row.select('.flowId')
+ .text(function (d) {
+ if (d) {
+ if (d.flowId) {
+ return d.flowId;
+ } else {
+ return '0x--';
+ }
+ }
+ })
+ .classed('pending', function (d) {
+ return d && (d.createPending || d.deletePending);
+ });
+
+ row.select('.srcDPID')
+ .text(function (d) {
+ if (d) {
+ return d.srcDpid;
+ }
+ });
+
+ row.select('.dstDPID')
+ .text(function (d) {
+ if (d) {
+ return d.dstDpid;
+ }
+ });
+ }
+
+ var flows = d3.select('#selectedFlows')
+ .selectAll('.selectedFlow')
+ .data(selectedFlows);
+
+ flows.enter()
+ .append('div')
+ .classed('selectedFlow', true)
+ .each(rowEnter);
+
+ flows.each(rowUpdate);
+
+ flows.exit().remove();
+}
+
+function updateSelectedFlows() {
+ // make sure that all of the selected flows are either
+ // 1) valid (meaning they are in the latest list of flows)
+ // 2) pending
+ if (model) {
+ var flowMap = {};
+ model.flows.forEach(function (flow) {
+ flowMap[makeFlowKey(flow)] = flow;
+ });
+
+ var newSelectedFlows = [];
+ selectedFlows.forEach(function (flow) {
+ if (flow) {
+ var liveFlow = flowMap[makeFlowKey(flow)];
+ if (liveFlow) {
+ flow.flowId = liveFlow.flowId;
+ if (flow.createPending) {
+ startIPerfForFlow(flow);
+ flow.createPending = false;
+ }
+ flow.dataPath = liveFlow.dataPath;
+ newSelectedFlows.push(flow);
+ } else if (flow.createPending) {
+ newSelectedFlows.push(flow);
+ } else if (hasIPerf(flow)) {
+ clearIPerf(flow);
+ }
+ }
+ });
+ selectedFlows = newSelectedFlows;
+ }
+ selectedFlows.forEach(function (flow) {
+ if (!hasIPerf(flow)) {
+ startIPerfForFlow(flow);
+ }
+ });
+ while (selectedFlows.length < 3) {
+ selectedFlows.push(null);
+ }
+
+ updateSelectedFlowsTable();
+ // on app init, the table is updated before the svg is constructed
+ if (flowLayer) {
+ updateSelectedFlowsTopology();
+ }
+}
+
+function selectFlow(flow) {
+ var flowKey = makeFlowKey(flow);
+ var alreadySelected = false;
+ selectedFlows.forEach(function (f) {
+ if (f && makeFlowKey(f) === flowKey) {
+ alreadySelected = true;
+ }
+ });
+
+ if (!alreadySelected) {
+ selectedFlows.unshift(flow);
+ selectedFlows = selectedFlows.slice(0, 3);
+ updateSelectedFlows();
+ }
+}
+
+function deselectFlow(flow, ifCreatePending) {
+ if (!flow) {
+ return;
+ }
+
+ var flowKey = makeFlowKey(flow);
+ var newSelectedFlows = [];
+ selectedFlows.forEach(function (flow) {
+ if (!flow ||
+ flowKey !== makeFlowKey(flow) ||
+ flowKey === makeFlowKey(flow) && ifCreatePending && !flow.createPending ) {
+ newSelectedFlows.push(flow);
+ } else {
+ if (hasIPerf(flow)) {
+ clearIPerf(flow);
+ }
+ }
+ });
+ selectedFlows = newSelectedFlows;
+ while (selectedFlows.length < 3) {
+ selectedFlows.push(null);
+ }
+
+ updateSelectedFlows();
+}
+
+function deselectFlowIfCreatePending(flow) {
+ deselectFlow(flow, true);
+}
+
+function showFlowChooser() {
+ function rowEnter(d) {
+ var row = d3.select(this);
+
+ row.append('div')
+ .classed('black-eye', true).
+ on('click', function () {
+ selectFlow(d);
+ });
+
+ row.append('div')
+ .classed('flowId', true)
+ .text(function (d) {
+ return d.flowId;
+ });
+
+ row.append('div')
+ .classed('srcDPID', true)
+ .text(function (d) {
+ return d.srcDpid;
+ });
+
+
+ row.append('div')
+ .classed('dstDPID', true)
+ .text(function (d) {
+ return d.dstDpid;
+ });
+
+ }
+
+ var flowChooser = d3.select(document.getElementById('flowChooser'));
+ flowChooser.html('');
+ flowChooser.style('-webkit-transform', 'translate3d(-100%, 0, 0)')
+ .style('-webkit-transition');
+
+ var flows = flowChooser
+ .append('div')
+ .style('pointer-events', 'auto')
+ .selectAll('.selectedFlow')
+ .data(model.flows)
+ .enter()
+ .append('div')
+ .classed('selectedFlow', true)
+ .each(rowEnter);
+
+
+ setTimeout(function () {
+ flowChooser.style('-webkit-transition', '-webkit-transform .25s');
+ setTimeout(function () {
+ flowChooser.style('-webkit-transform', 'translate3d(0,0,0)');
+ }, 0);
+
+
+ d3.select(document.body).on('click', function () {
+ flowChooser.style('-webkit-transform', 'translate3d(-100%, 0, 0)')
+ d3.select(document.body).on('click', null);
+ });
+ }, 0);
+}
diff --git a/web/ons-demo/js/forward.js b/web/ons-demo/js/forward.js
new file mode 100644
index 0000000..5e854ee
--- /dev/null
+++ b/web/ons-demo/js/forward.js
@@ -0,0 +1,12 @@
+/***************************************************************************************************
+forward declarations for functions
+***************************************************************************************************/
+
+var updateTopology;
+
+
+/***************************************************************************************************
+defined by whichever topology module is included
+***************************************************************************************************/
+var createTopologyView;
+var drawTopology;
diff --git a/web/ons-demo/js/globals.js b/web/ons-demo/js/globals.js
new file mode 100644
index 0000000..2063ba5
--- /dev/null
+++ b/web/ons-demo/js/globals.js
@@ -0,0 +1,57 @@
+/***************************************************************************************************
+global variables
+***************************************************************************************************/
+
+
+/***************************************************************************************************
+the latest update to the model
+***************************************************************************************************/
+var model;
+
+/***************************************************************************************************
+cached JSON representation of the model. used to detect model changes and update the UI.
+***************************************************************************************************/
+var modelString;
+
+/***************************************************************************************************
+the root element for the topology view
+***************************************************************************************************/
+var topology;
+
+/***************************************************************************************************
+links that were created in the webui but which have not appeared in the links API response yet
+these timeout after pendingTimeout
+***************************************************************************************************/
+var pendingLinks = {};
+
+/***************************************************************************************************
+current links including pending
+***************************************************************************************************/
+var links;
+
+/***************************************************************************************************
+a map from srcDPID => map of dstDPID=>link
+***************************************************************************************************/
+var linkMap;
+
+/***************************************************************************************************
+the flows that are displayed in the selected flow table
+this may include pending flows which have not appeared in the flows API response yet
+***************************************************************************************************/
+var selectedFlows = [];
+
+/***************************************************************************************************
+a mapping from controller name to color used for color coding the topology and ONOS nodes views
+***************************************************************************************************/
+var controllerColorMap = {};
+
+/***************************************************************************************************
+defined by rings.js or map.js this is where the flows are drawn.
+***************************************************************************************************/
+var flowLayer;
+
+/***************************************************************************************************
+hack to make the old ring drawing code compatible with the shared flow drawing code
+will be obsoleted once the ring drawing code is disposed of
+***************************************************************************************************/
+var drawingRings;
\ No newline at end of file
diff --git a/web/ons-demo/js/init.js b/web/ons-demo/js/init.js
new file mode 100644
index 0000000..2df38eb
--- /dev/null
+++ b/web/ons-demo/js/init.js
@@ -0,0 +1,55 @@
+function appInit(cb) {
+
+ // populates selected flows with empty rows
+ updateSelectedFlows();
+
+ d3.select('#showFlowChooser').on('click', function () {
+ showFlowChooser();
+ });
+
+ d3.select('#action-all').on('click', function () {
+ var prompt = "Add backup controllers?"
+ doConfirm(prompt, function (result) {
+ if (result) {
+ switchAll();
+ }
+ });
+ });
+
+ d3.select('#action-local').on('click', function () {
+ var prompt = "Switch controllers to local?"
+ doConfirm(prompt, function (result) {
+ if (result) {
+ switchLocal();
+ }
+ });
+ });
+
+ d3.select('#action-scale').on('click', function () {
+ var prompt = "Scale network?"
+ doConfirm(prompt, function (result) {
+ if (result) {
+ scaleNetwork();
+ }
+ });
+ });
+
+ d3.select('#action-reset').on('click', function () {
+ var prompt = "Reset network?"
+ doConfirm(prompt, function (result) {
+ if (result) {
+ resetNetwork();
+ }
+ });
+ });
+
+ d3.select('#action-kill').on('click', function () {
+ var prompt = "Kill ONOS instance?";
+ var options = model.activeControllers;
+ doConfirm(prompt, function (result) {
+ controllerDown(result);
+ }, options);
+ });
+
+ createTopologyView(cb);
+}
diff --git a/web/ons-demo/js/iperf.js b/web/ons-demo/js/iperf.js
new file mode 100644
index 0000000..ee0e305
--- /dev/null
+++ b/web/ons-demo/js/iperf.js
@@ -0,0 +1,190 @@
+var enableIPerfLog = false;
+
+function iperfLog(message, flow) {
+ if (enableIPerfLog) {
+ console.log('flow: ' + flow.flowId + '===>' + message);
+ }
+}
+
+function hasIPerf(flow) {
+ return flow && flow.iperfFetchTimeout;
+}
+
+function clearIPerf(flow) {
+ iperfLog('clearing iperf interval for: ' + flow.flowId, flow);
+ clearTimeout(flow.iperfFetchTimeout);
+ delete flow.iperfFetchTimeout;
+ clearInterval(flow.iperfDisplayInterval);
+ delete flow.iperfDisplayInterval;
+ clearTimeout(flow.animationTimeout);
+ delete flow.animationTimeout;
+ stopFlowAnimation(flow);
+ delete flow.iperfData.timestamp;
+
+ delete flow.iperfData;
+}
+
+function startIPerfForFlow(flow) {
+ var duration = 10000; // seconds
+ var interval = 100; // ms. this is defined by the server
+ var updateRate = 3000; // ms
+ var pointsToDisplay = 1000;
+
+ function makeGraph(iperfData) {
+ var d = 'M0,0';
+
+ var now = flow.iperfData.startTime + (Date.now() - flow.iperfData.localNow)/1000;
+
+ if (iperfData.samples && iperfData.samples.length) {
+
+ var lastX;
+ var i = iperfData.samples.length - 1;
+ while (i) {
+ var sample = iperfData.samples[i];
+
+ var x = (1000 - (now - sample.time)*10);
+ // workaround for discontinuity in iperf data
+ if (x < 0) {
+ i -= 1;
+ continue;
+ }
+
+ var y = 24 * sample.value/1000000;
+ if (y > 24) {
+ y = 24;
+ }
+ if (i == iperfData.samples.length - 1) {
+ d = 'M' + x + ',30';
+ }
+
+ // handle gaps
+ // 1.5 for rounding error
+ if (lastX && lastX - x > 1.5) {
+ d += 'L' + lastX + ',30';
+ d += 'M' + x + ',30'
+ }
+ lastX = x;
+
+ d += 'L' + x + ',' + (30-y);
+
+ i -= 1;
+ }
+ d += 'L' + lastX + ',30';
+ }
+ return d;
+ }
+
+ if (flow.flowId) {
+ iperfLog('starting iperf', flow);
+ startIPerf(flow, duration, updateRate/interval);
+
+ flow.iperfDisplayInterval = setInterval(function () {
+ if (flow.iperfData) {
+ var iperfPath = d3.select(document.getElementById(makeSelectedFlowKey(flow))).select('path');
+ flow.iperfData.samples.sort(function (a, b) {
+ return a.time - b.time;
+ });
+ iperfPath.attr('d', makeGraph(flow.iperfData));
+ }
+
+
+ }, interval);
+
+ var animationTimeout;
+ flow.iperfData = {
+ samples: []
+ }
+
+ function resetFlowAnimationTimeout() {
+ clearTimeout(flow.animationTimeout);
+ // kill the animation if iperfdata stops flowing
+ flow.animationTimeout = setTimeout(function () {
+ stopFlowAnimation(flow);
+ }, updateRate*1.5);
+ }
+
+ var lastTime;
+ function fetchData() {
+ iperfLog('Requesting iperf data', flow);
+ var fetchTime = Date.now();
+ getIPerfData(flow, function (data) {
+ var requestTime = Date.now() - fetchTime;
+ var requestTimeMessage = 'iperf request completed in: ' + requestTime + 'ms';
+ if (requestTime > 1000) {
+ requestTimeMessage = requestTimeMessage.toUpperCase();
+ }
+ iperfLog(requestTimeMessage, flow);
+
+ if (!flow.iperfData) {
+ iperfLog('iperf session closed', flow);
+ return;
+ }
+
+ try {
+ var iperfData = JSON.parse(data);
+
+// console.log('end-time: ' + iperfData['end-time']);
+
+ // if the data is fresh
+ if (!(flow.iperfData.timestamp && iperfData.timestamp != flow.iperfData.timestamp)) {
+ if (!flow.iperfData.timestamp) {
+ iperfLog('received first iperf buffer', flow);
+ } else {
+ iperfLog('received duplicate iperf buffer with timestamp: ' + iperfData.timestamp, flow);
+ }
+ } else {
+ iperfLog('received new iperf buffer with timstamp: ' + iperfData.timestamp, flow);
+ startFlowAnimation(flow);
+ resetFlowAnimationTimeout();
+
+ var endTime = Math.floor(iperfData['end-time']*10)/10;
+
+ var startTime = endTime - (iperfData.samples.length * interval/1000);
+ // set now on the first buffer
+ if (!flow.iperfData.startTime) {
+ flow.iperfData.startTime = startTime;
+ flow.iperfData.localNow = Date.now();
+ }
+
+ iperfLog('iperf buffer start time: ' + startTime, flow);
+ if (lastTime && (startTime - lastTime) > updateRate/1000) {
+ iperfLog('iperf buffer gap: ' + (startTime - lastTime), flow);
+ }
+ lastTime = startTime;
+
+ // clear out the old data
+ while (flow.iperfData.samples.length > pointsToDisplay + iperfData.samples.length) {
+ flow.iperfData.samples.shift();
+ }
+
+ // if the client gets too out of sync, resynchronize
+ var clientNow = flow.iperfData.startTime + (Date.now() - flow.iperfData.localNow)/1000;
+ if (Math.abs(clientNow - startTime) > (updateRate/1000) * 2) {
+ iperfLog('resynchronizing now: ' + clientNow + ' => ' + startTime, flow);
+ flow.iperfData.startTime = startTime;
+ flow.iperfData.localNow = Date.now();
+ }
+
+ var time = startTime;
+ iperfData.samples.forEach(function (s) {
+ var sample = {
+ time: time,
+ value: s
+ };
+ flow.iperfData.samples.push(sample);
+ time += interval/1000;
+ });
+ }
+ flow.iperfData.timestamp = iperfData.timestamp;
+ } catch (e) {
+ iperfLog('bad iperf data: ' + data, flow);
+ }
+ flow.iperfFetchTimeout = setTimeout(fetchData, updateRate*.25); // over sample to avoid gaps
+// iperfLog(data, flow);
+ });
+ }
+
+ // wait a buffer to make sure the old iperf session gets cleared out
+ flow.iperfFetchTimeout = setTimeout(fetchData, updateRate);
+ }
+}
\ No newline at end of file
diff --git a/web/ons-demo/js/map.js b/web/ons-demo/js/map.js
new file mode 100644
index 0000000..d0eb120
--- /dev/null
+++ b/web/ons-demo/js/map.js
@@ -0,0 +1,405 @@
+(function () {
+
+var projection = d3.geo.mercator()
+ .center([82, 46])
+ .scale(10000)
+ .rotate([-180,0]);
+
+var switchXML;
+
+function createMap(svg, cb) {
+ topology = svg.append('svg:svg').attr('id', 'viewBox').attr('viewBox', '0 0 1000 1000').
+ attr('id', 'viewbox');
+
+ var map = topology.append("g").attr('id', 'map');
+
+ var path = d3.geo.path().projection(projection);
+
+ d3.json('data/world.json', function(error, topology) {
+ map.selectAll('path')
+ .data(topojson.object(topology, topology.objects.world).geometries)
+ .enter()
+ .append('path')
+ .attr('d', path)
+
+ d3.xml('assets/switch.svg', function (xml) {
+ switchXML = document.importNode(xml.documentElement, true);;
+ cb();
+ });
+ });
+}
+
+/***************************************************************************************************
+
+***************************************************************************************************/
+var switchMap;
+function makeSwitchMap() {
+ switchMap = {};
+ model.coreSwitches.forEach(function (s) {
+ switchMap[s.dpid] = s;
+ });
+ model.aggregationSwitches.forEach(function (s) {
+ switchMap[s.dpid] = s;
+ });
+ model.edgeSwitches.forEach(function (s) {
+ switchMap[s.dpid] = s;
+ });
+}
+
+/***************************************************************************************************
+create a map from edge->aggregation and aggreation->core switches
+***************************************************************************************************/
+var switchAssociations;
+function makeAssociations() {
+ switchAssociations = {};
+
+ var key;
+ for (key in model.configuration.association) {
+ var aggregationSwitches = model.configuration.association[key];
+ aggregationSwitches.forEach(function (s) {
+ switchAssociations[s] = key;
+ });
+ }
+}
+
+/***************************************************************************************************
+get the upstream switch. this only makes sense for aggregation and edge switches
+***************************************************************************************************/
+function getUpstream(dpid, className) {
+ if (className === 'aggregation') {
+ return switchAssociations[dpid];
+ } else if (className === 'edge') {
+ var aggregationDpid = dpid.split(':');
+ aggregationDpid[7] = '01'; // the last component of the agg switch is always '01'
+ return aggregationDpid.join(':');
+ }
+}
+
+
+
+/*****************a**********************************************************************************
+create a map to hold the fanout information for the switches
+***************************************************************************************************/
+var fanouts;
+function makeFanouts() {
+ fanouts = {};
+ model.coreSwitches.forEach(function (s) {
+ fanouts[s.dpid] = model.configuration.geo[s.dpid];
+ fanouts[s.dpid].count = 0;
+ });
+
+ model.aggregationSwitches.forEach(function (s) {
+ fanouts[s.dpid] = {count: 0};
+ var upstreamFanout = fanouts[getUpstream(s.dpid, 'aggregation')];
+ upstreamFanout.count += 1;
+ });
+
+ model.edgeSwitches.forEach(function (s) {
+ fanouts[s.dpid] = {};
+ var upstreamFanout = fanouts[getUpstream(s.dpid, 'edge')];
+ upstreamFanout.count += 1;
+ });
+}
+
+
+var projection;
+var switchLayer;
+var labelsLayer;
+var linksLayer;
+createTopologyView = function (cb) {
+ var svg = createRootSVG();
+
+ createMap(svg, function () {
+ switchLayer = topology.append('g');
+ labelsLayer = topology.append('g');
+ linksLayer = topology.append('g');
+ flowLayer = topology.append('g');
+
+
+ cb();
+ });
+}
+
+function drawCoreFlowCounts() {
+ var links = {};
+ model.links.forEach(function (l) {
+ links[makeLinkKey(l)] = l;
+ });
+
+ var flowCounts = [];
+ countCoreLinkFlows().forEach(function (count) {
+ var l = links[count.key];
+ if (l) {
+ var src = d3.select(document.getElementById(l['src-switch']));
+ var dst = d3.select(document.getElementById(l['dst-switch']));
+
+ if (!src.empty() && !dst.empty()) {
+ var x1 = parseFloat(src.attr('x'));
+ var x2 = parseFloat(dst.attr('x'));
+ var y1 = parseFloat(src.attr('y'));
+ var y2 = parseFloat(dst.attr('y'));
+
+ var slope = (y2 - y1)/(x2 - x1);
+
+ var offset = 15;
+ var xOffset = offset;
+ var yOffset = slope*offset;
+
+ var d = Math.sqrt(xOffset*xOffset + yOffset*yOffset);
+ var scaler = offset/d;
+
+ count.pt = {
+ x: x1 + (x2 - x1)/2 + xOffset*scaler,
+ y: y1 + (y2 - y1)/2 + yOffset*scaler
+ }
+ }
+ flowCounts.push(count);
+ }
+ });
+
+
+ var counts = linksLayer.selectAll('.flowCount').data(flowCounts, function (d) {
+ return d.key;
+ });
+
+ counts.enter().append('svg:text')
+ .attr('class', 'flowCount')
+ .attr('x', function (d) {
+ return d.pt.x;
+ })
+ .attr('y', function (d) {
+ return d.pt.y;
+ });
+
+ counts.text(function (d) {
+ return d.value;
+ });
+
+ counts.exit().remove();
+}
+
+function drawLinkLines() {
+
+ // key on link dpids since these will come/go during demo
+ var linkLines = linksLayer.selectAll('.link').data(links, function (d) {
+ return d['src-switch']+'->'+d['dst-switch'];
+ });
+
+ // add new links
+ linkLines.enter().append("svg:path").attr("class", "link");
+
+ linkLines.attr('id', function (d) {
+ return makeLinkKey(d);
+ }).attr("d", function (d) {
+ var src = d3.select(document.getElementById(d['src-switch']));
+ var dst = d3.select(document.getElementById(d['dst-switch']));
+
+ if (src.empty() || dst.empty()) {
+ return "M0,0";
+ }
+
+ var srcPt = document.querySelector('svg').createSVGPoint();
+ srcPt.x = src.attr('x');
+ srcPt.y = src.attr('y');
+
+ var dstPt = document.querySelector('svg').createSVGPoint();
+ dstPt.x = dst.attr('x');
+ dstPt.y = dst.attr('y');
+
+ var midPt = document.querySelector('svg').createSVGPoint();
+ midPt.x = (srcPt.x + dstPt.x)/2;
+ midPt.y = (srcPt.y + dstPt.y)/2;
+
+ return line([srcPt, midPt, dstPt]);
+ })
+ .attr("marker-mid", function(d) { return "url(#arrow)"; })
+ .classed('pending', function (d) {
+ return d.pending;
+ });
+
+ // remove old links
+ linkLines.exit().remove();
+}
+
+
+var fanOutAngles = {
+ aggregation: 100,
+ edge: 5
+}
+
+var fanOutDistances = {
+ aggregation: 60,
+ edge: 140
+}
+
+function makeSwitchesModel(switches, className) {
+ var switchesModel = [];
+ switches.forEach(function (s) {
+ var geo = model.configuration.geo[s.dpid];
+
+ var pos, label;
+ if (geo) {
+ pos = projection([geo.lng, geo.lat]);
+ label = geo.label;
+ } else {
+ var upstream = getUpstream(s.dpid, className);
+ if (upstream) {
+ var upstreamGeo = fanouts[upstream];
+ pos = projection([upstreamGeo.lng, upstreamGeo.lat]);
+
+ var fanOutAngle = upstreamGeo.fanOutAngle;
+ fanOutAngle -= (upstreamGeo.count - 1) * fanOutAngles[className]/2;
+
+ var angle = toRadians(fanOutAngle);
+ var xOff = Math.sin(angle) * fanOutDistances[className];
+ var yOff = Math.cos(angle) * fanOutDistances[className];
+
+ pos = [pos[0] + xOff, pos[1] + yOff];
+
+ var fakeGeo = projection.invert(pos);
+
+ var fanout = fanouts[s.dpid];
+ fanout.fanOutAngle = fanOutAngle;
+ fanout.lng = fakeGeo[0];
+ fanout.lat = fakeGeo[1];
+
+ upstreamGeo.fanOutAngle += fanOutAngles[className];
+
+ } else {
+ pos = projection([-98, 39]);
+ }
+ }
+
+ switchesModel.push({
+ dpid: s.dpid,
+ state: s.state,
+ className: className,
+ controller: s.controller,
+ label: label,
+ x: pos[0],
+ y: pos[1]
+ });
+ });
+
+ return switchesModel;
+}
+
+function switchEnter(d) {
+ var g = d3.select(this);
+ var width;
+
+ // attempt to draw an svg switch
+ if (false && d.className == 'core') {
+ width = 30;
+ g.select(function () {
+ return this.appendChild(switchXML.cloneNode(true));
+ })
+ .classed(d.className, true)
+ .attr('x', d.x - 30)
+ .attr('y', d.y - 30);
+
+ } else {
+ width = widths[d.className];
+ g.append('svg:circle').attr('r', width)
+ .classed(d.className, true)
+ .attr('cx', d.x)
+ .attr('cy', d.y);
+ }
+
+
+ if (d.label) {
+ g.append('svg:text')
+ .classed('label', true)
+ .text(d.label)
+ .attr("text-anchor", function (d) {
+ return d.x > 500 ? "end" : "start";
+ })
+ .attr('x', function (d) {
+ return d.x > 500 ? d.x - width*.8 : d.x + width*.8;
+ })
+ .attr('y', d.y - width*.8);
+ }
+}
+
+function labelsEnter(switches) {
+ return labelsLayer.selectAll('g').data(switches, function (d) {
+ return d.dpid;
+ }).enter().append('svg:g')
+ .classed('nolabel', true)
+ .attr("id", function (data) {
+ return data.dpid + '-label';
+ })
+ .append("svg:text")
+ .text(function (data) {return data.dpid;})
+ .attr('x', function (d) {
+ return d.x;
+ })
+ .attr('y', function (d) {
+ return d.y;
+ })
+ .attr("text-anchor", function (d) {
+ return d.x > 500 ? "end" : "start";
+ })
+
+}
+
+function switchesEnter(switches) {
+ switches.enter()
+ .append('svg:g')
+ .attr("id", function (d) {
+ return d.dpid;
+ })
+ .attr('x', function (d) {
+ return d.x;
+ })
+ .attr('y', function (d) {
+ return d.y;
+ })
+ .each(switchEnter);
+}
+
+
+function switchesUpdate(switches) {
+ switches.each(function (d) {
+ // if there's a pending state changed and then the state changes, clear the pending class
+ var circle = d3.select(this);
+ if (d.state === 'ACTIVE' && circle.classed('inactive') ||
+ d.state === 'INACTIVE' && circle.classed('active')) {
+ circle.classed('pending', false);
+ }
+ })
+ .attr('class', function (d) {
+ if (d.state === 'ACTIVE' && d.controller) {
+ return 'active ' + controllerColorMap[d.controller];
+ } else {
+ return 'inactive ' + 'colorInactive';
+ }
+ });
+}
+
+drawTopology = function () {
+
+ makeSwitchMap();
+ makeAssociations();
+ makeFanouts();
+
+ var coreSwitches = makeSwitchesModel(model.coreSwitches, 'core');
+ var aggregationSwitches = makeSwitchesModel(model.aggregationSwitches, 'aggregation');
+ var edgeSwitches = makeSwitchesModel(model.edgeSwitches, 'edge');
+ var allSwitches = coreSwitches.concat(aggregationSwitches).concat(edgeSwitches);
+
+ var switchSelection = switchLayer.selectAll('g')
+ .data(allSwitches, function (d) {
+ return d.dpid;
+ });
+ switchesEnter(switchSelection)
+ switchesUpdate(switchSelection);
+
+ drawLinkLines();
+
+ drawCoreFlowCounts();
+
+ labelsEnter(allSwitches);
+}
+
+})();
\ No newline at end of file
diff --git a/web/ons-demo/js/model.js b/web/ons-demo/js/model.js
new file mode 100644
index 0000000..df4a751
--- /dev/null
+++ b/web/ons-demo/js/model.js
@@ -0,0 +1,152 @@
+/*global async, d3*/
+
+function toD3(results) {
+ var model = {
+ edgeSwitches: [],
+ aggregationSwitches: [],
+ coreSwitches: [],
+ flows: [],
+ controllers: results.controllers,
+ activeControllers: results.activeControllers,
+ links: results.links,
+ configuration: results.configuration
+ };
+
+ // remove bad flows;
+ results.flows.forEach(function (f) {
+ if (f.dataPath && f.dataPath.flowEntries && f.dataPath.flowEntries.length > 1) {
+ model.flows.push(f);
+ }
+ })
+
+ // sort the switches
+ results.switches.sort(function (a, b) {
+ var aA = a.dpid.split(':');
+ var bB = b.dpid.split(':');
+ for (var i=0; i<aA.length; i+=1) {
+ if (aA[i] != bB[i]) {
+ return parseInt(aA[i], 16) - parseInt(bB[i], 16);
+ }
+ }
+ return 0;
+ });
+
+ // identify switch types
+ var coreSwitchDPIDs = {};
+ results.configuration.core.forEach(function (dpid) {
+ coreSwitchDPIDs[dpid] = true;
+ });
+
+ var aggregationSwitchDPIDs = {};
+ results.configuration.aggregation.forEach(function (dpid) {
+ aggregationSwitchDPIDs[dpid] = true;
+ });
+
+ results.switches.forEach(function (s) {
+ var mapping = results.mapping[s.dpid]
+ if (mapping) {
+ s.controller = mapping[0].controllerId;
+ }
+
+ if (coreSwitchDPIDs[s.dpid]) {
+ model.coreSwitches.push(s);
+ } else if (aggregationSwitchDPIDs[s.dpid]) {
+ model.aggregationSwitches.push(s);
+ } else {
+ model.edgeSwitches.push(s);
+ }
+ });
+
+ return model;
+}
+
+var urls = {
+ links: '/wm/core/topology/links/json',
+ switches: '/wm/core/topology/switches/all/json',
+ flows: '/wm/flow/getsummary/0/0/json?proxy',
+ activeControllers: '/wm/registry/controllers/json',
+ controllers: 'data/controllers.json',
+ mapping: '/wm/registry/switches/json',
+ configuration: 'data/configuration.json'
+}
+
+var mockURLs = {
+ links: 'data/wm_core_topology_links_json.json',
+ switches: 'data/wm_core_topology_switches_all_json.json',
+ flows: 'data/wm_flow_getall_json.json',
+ activeControllers: 'data/wm_registry_controllers_json.json',
+ controllers: 'data/controllers.json',
+ mapping: 'data/wm_registry_switches_json.json',
+ configuration: 'data/configuration.json'
+}
+
+var proxyURLs = {
+ links: '/wm/core/topology/links/json?proxy',
+ switches: '/wm/core/topology/switches/all/json?proxy',
+ flows: '/wm/flow/getsummary/0/0/json?proxy',
+ activeControllers: '/wm/registry/controllers/json?proxy',
+ controllers: 'data/controllers.json',
+ mapping: '/wm/registry/switches/json?proxy',
+ configuration: 'data/configuration.json'
+}
+
+var params = parseURLParameters();
+if (params.mock) {
+ urls = mockURLs;
+}
+if (params.proxy) {
+ urls = proxyURLs;
+}
+
+var timeoutMS = 20000;
+
+function makeRequest(key) {
+ var url = urls[key];
+ if (url) {
+ return function (cb) {
+ var timeout;
+ var xhr = d3.json(url, function (error, result) {
+ clearTimeout(timeout);
+
+ if (error) {
+ error = url + ' : ' + error.status;
+ }
+
+ if (cb) {
+ cb(error, result);
+ }
+ });
+ timeout = setTimeout(function () {
+ xhr.abort();
+ cb(url + ' timed out after ' + timeoutMS + ' ms');
+ cb = null;
+ }, timeoutMS);
+ }
+ } else {
+ return function (cb) {
+ cb(null, []);
+ }
+ }
+}
+
+
+function updateModel(cb) {
+ async.parallel({
+ links: makeRequest('links'),
+ switches: makeRequest('switches'),
+ controllers: makeRequest('controllers'),
+ activeControllers: makeRequest('activeControllers'),
+ mapping: makeRequest('mapping'),
+ configuration: makeRequest('configuration'),
+ flows: makeRequest('flows')
+ },
+ function(err, results) {
+ if (!err) {
+ var model = toD3(results);
+ cb(model);
+ } else {
+ console.log(JSON.stringify(err));
+ cb(null);
+ }
+ });
+}
diff --git a/web/ons-demo/js/rings.js b/web/ons-demo/js/rings.js
new file mode 100644
index 0000000..979d28b
--- /dev/null
+++ b/web/ons-demo/js/rings.js
@@ -0,0 +1,327 @@
+(function () {
+
+createTopologyView = function (cb) {
+
+ window.addEventListener('resize', function () {
+ // this is too slow. instead detect first resize event and hide the paths that have explicit matrix applied
+ // either that or is it possible to position the paths so they get the automatic transform as well?
+// updateTopology();
+ });
+
+ var svg = createRootSVG();
+
+ topology = svg.append('svg:svg').attr('id', 'viewBox').attr('viewBox', '0 0 1000 1000').attr('preserveAspectRatio', 'none').
+ attr('id', 'viewbox').append('svg:g').attr('id', 'topology').attr('transform', 'translate(500 500)');
+
+ flowLayer = d3.select('svg');
+
+ // hack to make the shared flow drawing code work
+ drawingRings = true;
+
+ cb();
+}
+
+function updateLinkLines() {
+
+ // key on link dpids since these will come/go during demo
+ var linkLines = d3.select('svg').selectAll('.link').data(links, function (d) {
+ return d['src-switch']+'->'+d['dst-switch'];
+ });
+
+ // add new links
+ linkLines.enter().append("svg:path").attr("class", "link");
+
+ linkLines.attr('id', function (d) {
+ return makeLinkKey(d);
+ }).attr("d", function (d) {
+ var src = d3.select(document.getElementById(d['src-switch']));
+ var dst = d3.select(document.getElementById(d['dst-switch']));
+
+ if (src.empty() || dst.empty()) {
+ return "M0,0";
+ }
+
+ var srcPt = document.querySelector('svg').createSVGPoint();
+ srcPt.x = src.attr('x');
+ srcPt.y = src.attr('y');
+ srcPt = srcPt.matrixTransform(src[0][0].getCTM());
+
+ var dstPt = document.querySelector('svg').createSVGPoint();
+ dstPt.x = dst.attr('x');
+ dstPt.y = dst.attr('y');
+ dstPt = dstPt.matrixTransform(dst[0][0].getCTM());
+
+ var midPt = document.querySelector('svg').createSVGPoint();
+ midPt.x = (srcPt.x + dstPt.x)/2;
+ midPt.y = (srcPt.y + dstPt.y)/2;
+
+ return line([srcPt, midPt, dstPt]);
+ })
+ .attr("marker-mid", function(d) { return "url(#arrow)"; })
+ .classed('pending', function (d) {
+ return d.pending;
+ });
+
+ // remove old links
+ linkLines.exit().remove();
+}
+
+
+function createRingTopologyModel(model) {
+ var rings = [{
+ radius: 3,
+ width: widths.edge,
+ switches: model.edgeSwitches,
+ className: 'edge',
+ angles: []
+ }, {
+ radius: 2.25,
+ width: widths.aggregation,
+ switches: model.aggregationSwitches,
+ className: 'aggregation',
+ angles: []
+ }, {
+ radius: 0.75,
+ width: widths.core,
+ switches: model.coreSwitches,
+ className: 'core',
+ angles: []
+ }];
+
+
+ var aggRanges = {};
+
+ // arrange edge switches at equal increments
+ var k = 360 / rings[0].switches.length;
+ rings[0].switches.forEach(function (s, i) {
+ var angle = k * i;
+
+ rings[0].angles[i] = angle;
+
+ // record the angle for the agg switch layout
+ var dpid = s.dpid.split(':');
+ dpid[7] = '01'; // the last component of the agg switch is always '01'
+ var aggdpid = dpid.join(':');
+ var aggRange = aggRanges[aggdpid];
+ if (!aggRange) {
+ aggRange = aggRanges[aggdpid] = {};
+ aggRange.min = aggRange.max = angle;
+ } else {
+ aggRange.max = angle;
+ }
+ });
+
+ // arrange aggregation switches to "fan out" to edge switches
+ k = 360 / rings[1].switches.length;
+ rings[1].switches.forEach(function (s, i) {
+// rings[1].angles[i] = k * i;
+ var range = aggRanges[s.dpid];
+
+ rings[1].angles[i] = (range.min + range.max)/2;
+ });
+
+ // find the association between core switches and aggregation switches
+ var aggregationSwitchMap = {};
+ model.aggregationSwitches.forEach(function (s, i) {
+ aggregationSwitchMap[s.dpid] = i;
+ });
+
+ // put core switches next to linked aggregation switches
+ k = 360 / rings[2].switches.length;
+ rings[2].switches.forEach(function (s, i) {
+// rings[2].angles[i] = k * i;
+ var associatedAggregationSwitches = model.configuration.association[s.dpid];
+ // TODO: go between if there are multiple
+ var index = aggregationSwitchMap[associatedAggregationSwitches[0]];
+
+ rings[2].angles[i] = rings[1].angles[index];
+ });
+
+ // TODO: construct this form initially rather than converting. it works better because
+ // it allows binding by dpid
+ var testRings = [];
+ rings.forEach(function (ring) {
+ var testRing = [];
+ ring.switches.forEach(function (s, i) {
+ var testSwitch = {
+ dpid: s.dpid,
+ state: s.state,
+ radius: ring.radius,
+ width: ring.width,
+ className: ring.className,
+ angle: ring.angles[i],
+ controller: s.controller
+ };
+ testRing.push(testSwitch);
+ });
+
+
+ testRings.push(testRing);
+ });
+
+
+// return rings;
+ return testRings;
+}
+
+drawTopology = function () {
+ // DRAW THE SWITCHES
+ var rings = topology.selectAll('.ring').data(createRingTopologyModel(model));
+
+ function ringEnter(data, i) {
+ if (!data.length) {
+ return;
+ }
+
+ // create the nodes
+ var nodes = d3.select(this).selectAll("g")
+ .data(data, function (data) {
+ return data.dpid;
+ })
+ .enter().append("svg:g")
+ .attr("id", function (data, i) {
+ return data.dpid;
+ })
+ .attr("transform", function(data, i) {
+ return "rotate(" + data.angle+ ")translate(" + data.radius * 150 + ")rotate(" + (-data.angle) + ")";
+ });
+
+ // add the cirles representing the switches
+ nodes.append("svg:circle")
+ .attr("transform", function(data, i) {
+ var m = document.querySelector('#viewbox').getTransformToElement().inverse();
+ if (data.scale) {
+ m = m.scale(data.scale);
+ }
+ return "matrix( " + m.a + " " + m.b + " " + m.c + " " + m.d + " " + m.e + " " + m.f + " )";
+ })
+ .attr("x", function (data) {
+ return -data.width / 2;
+ })
+ .attr("y", function (data) {
+ return -data.width / 2;
+ })
+ .attr("r", function (data) {
+ return data.width;
+ });
+ }
+
+ // append switches
+ rings.enter().append("svg:g")
+ .attr("class", "ring")
+ .each(ringEnter);
+
+
+ function ringUpdate(data, i) {
+ var nodes = d3.select(this).selectAll("g")
+ .data(data, function (data) {
+ return data.dpid;
+ });
+ nodes.select('circle')
+ .each(function (data) {
+ // if there's a pending state changed and then the state changes, clear the pending class
+ var circle = d3.select(this);
+ if (data.state === 'ACTIVE' && circle.classed('inactive') ||
+ data.state === 'INACTIVE' && circle.classed('active')) {
+ circle.classed('pending', false);
+ }
+ })
+ .attr('class', function (data) {
+ if (data.state === 'ACTIVE' && data.controller) {
+ return data.className + ' active ' + controllerColorMap[data.controller];
+ } else {
+ return data.className + ' inactive ' + 'colorInactive';
+ }
+ });
+ }
+
+ // update switches
+ rings.each(ringUpdate);
+
+
+ // Now setup the labels
+ // This is done separately because SVG draws in node order and we want the labels
+ // always on top
+ var labelRings = topology.selectAll('.labelRing').data(createRingTopologyModel(model));
+
+ function labelRingEnter(data) {
+ if (!data.length) {
+ return;
+ }
+
+ // create the nodes
+ var nodes = d3.select(this).selectAll("g")
+ .data(data, function (data) {
+ return data.dpid;
+ })
+ .enter().append("svg:g")
+ .classed('nolabel', true)
+ .attr("id", function (data) {
+ return data.dpid + '-label';
+ })
+ .attr("transform", function(data, i) {
+ return "rotate(" + data.angle+ ")translate(" + data.radius * 150 + ")rotate(" + (-data.angle) + ")";
+ })
+
+ // add the text nodes which show on mouse over
+ nodes.append("svg:text")
+ .text(function (data) {return data.dpid;})
+ .attr("x", function (data) {
+ if (data.angle <= 90 || data.angle >= 270 && data.angle <= 360) {
+ if (data.className == 'edge') {
+ return - data.width*3 - 4;
+ } else {
+ return - data.width - 4;
+ }
+ } else {
+ if (data.className == 'edge') {
+ return data.width*3 + 4;
+ } else {
+ return data.width + 4;
+ }
+ }
+ })
+ .attr("y", function (data) {
+ var y;
+ if (data.angle <= 90 || data.angle >= 270 && data.angle <= 360) {
+ if (data.className == 'edge') {
+ y = data.width*3/2 + 4;
+ } else {
+ y = data.width/2 + 4;
+ }
+ } else {
+ if (data.className == 'edge') {
+ y = data.width*3/2 + 4;
+ } else {
+ y = data.width/2 + 4;
+ }
+ }
+ return y - 6;
+ })
+ .attr("text-anchor", function (data) {
+ if (data.angle <= 90 || data.angle >= 270 && data.angle <= 360) {
+ return "end";
+ } else {
+ return "start";
+ }
+ })
+ .attr("transform", function(data) {
+ var m = document.querySelector('#viewbox').getTransformToElement().inverse();
+ if (data.scale) {
+ m = m.scale(data.scale);
+ }
+ return "matrix( " + m.a + " " + m.b + " " + m.c + " " + m.d + " " + m.e + " " + m.f + " )";
+ })
+ }
+
+ labelRings.enter().append("svg:g")
+ .attr("class", "textRing")
+ .each(labelRingEnter);
+
+ // switches should not change during operation of the ui so no
+ // rings.exit()
+
+ updateLinkLines();
+}
+
+})();
diff --git a/web/ons-demo/js/topology.js b/web/ons-demo/js/topology.js
new file mode 100644
index 0000000..7f91de8
--- /dev/null
+++ b/web/ons-demo/js/topology.js
@@ -0,0 +1,30 @@
+/***************************************************************************************************
+functions for creating and interacting with the topology view of the webui
+
+flow related topology is in flows.js
+***************************************************************************************************/
+
+(function () {
+
+updateTopology = function() {
+
+ /* currently rings.js and map.js can be included to define the topology display */
+
+ reconcilePendingLinks(model);
+ updateLinkMap(links);
+
+ drawTopology();
+
+ // setup the mouseover behaviors
+ var allSwitches = d3.selectAll('.edge, .core, .aggregation');
+
+ allSwitches.on('mouseover', mouseOverSwitch);
+ allSwitches.on('mouseout', mouseOutSwitch);
+ allSwitches.on('mouseup', mouseUpSwitch);
+ allSwitches.on('mousedown', mouseDownSwitch);
+
+ // only do switch up/down for core switches
+ d3.selectAll('.core').on('dblclick', doubleClickSwitch);
+}
+
+})();
diff --git a/web/ons-demo/js/topologyactions.js b/web/ons-demo/js/topologyactions.js
new file mode 100644
index 0000000..28d418b
--- /dev/null
+++ b/web/ons-demo/js/topologyactions.js
@@ -0,0 +1,286 @@
+function clearHighlight() {
+ topology.selectAll('circle').each(function (data) {
+ data.mouseDown = false;
+ d3.select('#topologyArea').classed('linking', false);
+ mouseOutSwitch(data);
+ });
+ d3.select('#linkVector').remove();
+};
+
+function mouseOverSwitch(data) {
+
+ d3.event.preventDefault();
+
+ d3.select(document.getElementById(data.dpid + '-label')).classed('nolabel', false);
+
+ if (data.highlighted) {
+ return;
+ }
+
+ // only highlight valid link or flow destination by checking for class of existing highlighted circle
+ var highlighted = topology.selectAll('.highlight')[0];
+ if (highlighted.length == 1) {
+ var s = d3.select(highlighted[0]).select('circle');
+ // only allow links
+ // edge->edge (flow)
+ // aggregation->core
+ // core->core
+ if (data.className == 'edge' && !s.classed('edge') ||
+ data.className == 'core' && !s.classed('core') && !s.classed('aggregation') ||
+ data.className == 'aggregation' && !s.classed('core')) {
+ return;
+ }
+
+ // the second highlighted switch is the target for a link or flow
+ data.target = true;
+ }
+
+ var node = d3.select(document.getElementById(data.dpid));
+ node.classed('highlight', true).select('circle').transition().duration(100).attr("r", widths.core);
+ data.highlighted = true;
+ node.moveToFront();
+}
+
+function mouseOutSwitch(data) {
+ d3.select(document.getElementById(data.dpid + '-label')).classed('nolabel', true);
+
+ if (data.mouseDown)
+ return;
+
+ var node = d3.select(document.getElementById(data.dpid));
+ node.classed('highlight', false).select('circle').transition().duration(100).attr("r", widths[data.className]);
+ data.highlighted = false;
+ data.target = false;
+}
+
+function mouseDownSwitch(data) {
+ mouseOverSwitch(data);
+ data.mouseDown = true;
+ d3.select('#topologyArea').classed('linking', true);
+
+ d3.select('svg')
+ .append('svg:path')
+ .attr('id', 'linkVector')
+ .attr('d', function () {
+ var s = d3.select(document.getElementById(data.dpid));
+
+ var pt = document.querySelector('svg').createSVGPoint();
+ pt.x = s.attr('x');
+ pt.y = s.attr('y');
+ pt = pt.matrixTransform(s[0][0].getCTM());
+
+ return line([pt, pt]);
+ });
+
+
+ if (data.className === 'core') {
+ d3.selectAll('.edge').classed('nodrop', true);
+ }
+ if (data.className === 'edge') {
+ d3.selectAll('.core').classed('nodrop', true);
+ d3.selectAll('.aggregation').classed('nodrop', true);
+ }
+ if (data.className === 'aggregation') {
+ d3.selectAll('.edge').classed('nodrop', true);
+ d3.selectAll('.aggregation').classed('nodrop', true);
+ }
+}
+
+function mouseUpSwitch(data) {
+ if (data.mouseDown) {
+ data.mouseDown = false;
+ d3.select('#topologyArea').classed('linking', false);
+ d3.event.stopPropagation();
+ d3.selectAll('.nodrop').classed('nodrop', false);
+ }
+}
+
+function doubleClickSwitch(data) {
+ clearHighlight();
+
+ var circle = d3.select(document.getElementById(data.dpid)).select('circle');
+ if (data.state == 'ACTIVE') {
+ var prompt = 'Deactivate ' + data.dpid + '?';
+ doConfirm(prompt, function(result) {
+ if (result) {
+ switchDown(data);
+ setPending(circle);
+ }
+ });
+ } else {
+ var prompt = 'Activate ' + data.dpid + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ switchUp(data);
+ setPending(circle);
+ }
+ });
+ }
+}
+
+d3.select(window).on('mouseup', function () {
+ d3.selectAll('.nodrop').classed('nodrop', false);
+
+ function removeLink(link) {
+ var path1 = document.getElementById(link['src-switch'] + '=>' + link['dst-switch']);
+ var path2 = document.getElementById(link['dst-switch'] + '=>' + link['src-switch']);
+
+ if (path1) {
+ setPending(d3.select(path1));
+ }
+ if (path2) {
+ setPending(d3.select(path2));
+ }
+
+ linkDown(link);
+ }
+
+
+ var highlighted = topology.selectAll('.highlight')[0];
+ if (highlighted.length == 2) {
+ var s1Data = highlighted[0].__data__;
+ var s2Data = highlighted[1].__data__;
+
+ var srcData, dstData;
+ if (s1Data.target) {
+ dstData = s1Data;
+ srcData = s2Data;
+ } else {
+ dstData = s2Data;
+ srcData = s1Data;
+ }
+
+ if (s1Data.className == 'edge' && s2Data.className == 'edge') {
+ var prompt = 'Create flow from ' + srcData.dpid + ' to ' + dstData.dpid + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ addFlow(srcData, dstData);
+
+ var flow = {
+ dataPath: {
+ srcPort: {
+ dpid: {
+ value: srcData.dpid
+ }
+ },
+ dstPort: {
+ dpid: {
+ value: dstData.dpid
+ }
+ }
+ },
+ srcDpid: srcData.dpid,
+ dstDpid: dstData.dpid,
+ createPending: true
+ };
+
+ selectFlow(flow);
+
+ setTimeout(function () {
+ deselectFlowIfCreatePending(flow);
+ }, pendingTimeout);
+ }
+ });
+
+ } else {
+ var map = linkMap[srcData.dpid];
+ if (map && map[dstData.dpid]) {
+ var prompt = 'Remove link between ' + srcData.dpid + ' and ' + dstData.dpid + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ removeLink(map[dstData.dpid]);
+ }
+ });
+ } else {
+ map = linkMap[dstData.dpid];
+ if (map && map[srcData.dpid]) {
+ var prompt = 'Remove link between ' + dstData.dpid + ' and ' + srcData.dpid + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ removeLink(map[srcData.dpid]);
+ }
+ });
+ } else {
+ var prompt = 'Create link between ' + srcData.dpid + ' and ' + dstData.dpid + '?';
+ doConfirm(prompt, function (result) {
+ if (result) {
+ var link1 = {
+ 'src-switch': srcData.dpid,
+ 'src-port': 1,
+ 'dst-switch': dstData.dpid,
+ 'dst-port': 1,
+ pending: true
+ };
+ pendingLinks[makeLinkKey(link1)] = link1;
+ var link2 = {
+ 'src-switch': dstData.dpid,
+ 'src-port': 1,
+ 'dst-switch': srcData.dpid,
+ 'dst-port': 1,
+ pending: true
+ };
+ pendingLinks[makeLinkKey(link2)] = link2;
+ updateTopology();
+
+ linkUp(link1);
+
+ // remove the pending links after 10s
+ setTimeout(function () {
+ delete pendingLinks[makeLinkKey(link1)];
+ delete pendingLinks[makeLinkKey(link2)];
+
+ updateTopology();
+ }, pendingTimeout);
+ }
+ });
+ }
+ }
+ }
+
+ clearHighlight();
+ } else {
+ clearHighlight();
+ }
+});
+
+d3.select(document.body).on('mousemove', function () {
+ if (!d3.select('#topologyArea').classed('linking')) {
+ return;
+ }
+ var linkVector = document.getElementById('linkVector');
+ if (!linkVector) {
+ return;
+ }
+ linkVector = d3.select(linkVector);
+
+ var highlighted = topology.selectAll('.highlight')[0];
+ var s1 = null, s2 = null;
+ if (highlighted.length > 1) {
+ var s1 = d3.select(highlighted[0]);
+ var s2 = d3.select(highlighted[1]);
+
+ } else if (highlighted.length > 0) {
+ var s1 = d3.select(highlighted[0]);
+ }
+ var src = s1;
+ if (s2 && !s2.data()[0].target) {
+ src = s2;
+ }
+ if (src) {
+ linkVector.attr('d', function () {
+ var srcPt = document.querySelector('svg').createSVGPoint();
+ srcPt.x = src.attr('x');
+ srcPt.y = src.attr('y');
+ srcPt = srcPt.matrixTransform(src[0][0].getCTM());
+
+ var svg = document.getElementById('topology');
+ var mouse = d3.mouse(viewbox);
+ var dstPt = document.querySelector('svg').createSVGPoint();
+ dstPt.x = mouse[0];
+ dstPt.y = mouse[1];
+ dstPt = dstPt.matrixTransform(viewbox.getCTM());
+
+ return line([srcPt, dstPt]);
+ });
+ }
+});
diff --git a/web/ons-demo/js/utils.js b/web/ons-demo/js/utils.js
new file mode 100644
index 0000000..d7220c5
--- /dev/null
+++ b/web/ons-demo/js/utils.js
@@ -0,0 +1,264 @@
+/***************************************************************************************************
+extract url parameters into a map
+***************************************************************************************************/
+function parseURLParameters() {
+ var parameters = {};
+
+ var search = location.href.split('?')[1];
+ if (search) {
+ search.split('&').forEach(function (param) {
+ var key = param.split('=')[0];
+ var value = param.split('=')[1];
+ parameters[key] = decodeURIComponent(value);
+ });
+ }
+
+ return parameters;
+}
+
+/***************************************************************************************************
+convenience function for moving an SVG element to the front so that it draws on top
+***************************************************************************************************/
+d3.selection.prototype.moveToFront = function() {
+ return this.each(function(){
+ this.parentNode.appendChild(this);
+ });
+};
+
+/***************************************************************************************************
+standard function for generating the 'd' attribute for a path from an array of points
+***************************************************************************************************/
+var line = d3.svg.line()
+ .x(function(d) {
+ return d.x;
+ })
+ .y(function(d) {
+ return d.y;
+ });
+
+
+/***************************************************************************************************
+starts the "pending" animation
+***************************************************************************************************/
+function setPending(selection) {
+ selection.classed('pending', false);
+ setTimeout(function () {
+ selection.classed('pending', true);
+ }, 0);
+}
+
+/***************************************************************************************************
+convert angle in degrees to radians
+***************************************************************************************************/
+function toRadians (degrees) {
+ return degrees * (Math.PI / 180);
+}
+
+/***************************************************************************************************
+used to generate DOM element id for this link
+***************************************************************************************************/
+function makeLinkKey(link) {
+ return link['src-switch'] + '=>' + link['dst-switch'];
+}
+
+/***************************************************************************************************
+used to generate DOM element id for this flow in the topology view
+***************************************************************************************************/
+function makeFlowKey(flow) {
+ return flow.srcDpid + '=>' + flow.dstDpid;
+}
+
+/***************************************************************************************************
+used to generate DOM element id for this flow in the selected flows table
+***************************************************************************************************/
+function makeSelectedFlowKey(flow) {
+ return 'S' + makeFlowKey(flow);
+}
+
+/***************************************************************************************************
+update the app header using the current model
+***************************************************************************************************/
+function updateHeader() {
+ d3.select('#lastUpdate').text(new Date().toLocaleString());
+
+ var activeSwitchCount = 0;
+ model.edgeSwitches.forEach(function (s) {
+ if (s.state === 'ACTIVE') {
+ activeSwitchCount += 1;
+ }
+ });
+ model.aggregationSwitches.forEach(function (s) {
+ if (s.state === 'ACTIVE') {
+ activeSwitchCount += 1;
+ }
+ });
+ model.coreSwitches.forEach(function (s) {
+ if (s.state === 'ACTIVE') {
+ activeSwitchCount += 1;
+ }
+ });
+
+ d3.select('#activeSwitches').text(activeSwitchCount);
+
+
+
+ d3.select('#activeFlows').text(model.flows.length);
+ d3.select('#activeLinks').text(model.links.length);
+}
+
+/***************************************************************************************************
+update the global linkmap
+***************************************************************************************************/
+function updateLinkMap(links) {
+ linkMap = {};
+ links.forEach(function (link) {
+ var srcDPID = link['src-switch'];
+ var dstDPID = link['dst-switch'];
+
+ var srcMap = linkMap[srcDPID] || {};
+
+ srcMap[dstDPID] = link;
+
+ linkMap[srcDPID] = srcMap;
+ });
+}
+
+/***************************************************************************************************
+// removes links from the pending list that are now in the model
+***************************************************************************************************/
+function reconcilePendingLinks(model) {
+ links = [];
+ model.links.forEach(function (link) {
+ links.push(link);
+ delete pendingLinks[makeLinkKey(link)]
+ })
+ var linkId;
+ for (linkId in pendingLinks) {
+ links.push(pendingLinks[linkId]);
+ }
+}
+
+/***************************************************************************************************
+used by both ring and map models
+***************************************************************************************************/
+function createRootSVG() {
+ var svg = d3.select('#svg-container').append('svg:svg');
+
+ svg.append("svg:defs").append("svg:marker")
+ .attr("id", "arrow")
+ .attr("viewBox", "0 -5 10 10")
+ .attr("refX", -1)
+ .attr("markerWidth", 5)
+ .attr("markerHeight", 5)
+ .attr("orient", "auto")
+ .append("svg:path")
+ .attr("d", "M0,-3L10,0L0,3");
+
+ return svg;
+}
+
+/***************************************************************************************************
+counts the number of flows which pass through each core<->core link
+***************************************************************************************************/
+function countCoreLinkFlows() {
+ var allCounts = {};
+ model.flows.forEach(function (f) {
+ if (f.dataPath && f.dataPath.flowEntries && f.dataPath.flowEntries.length > 1) {
+ var flowEntries = f.dataPath.flowEntries;
+ var i;
+
+ for (i = 0; i < flowEntries.length - 1; i += 1) {
+ var linkKey = flowEntries[i].dpid.value + '=>' + flowEntries[i+1].dpid.value;
+ if (!allCounts[linkKey]) {
+ allCounts[linkKey] = 1;
+ } else {
+ allCounts[linkKey] += 1;
+ }
+ }
+ }
+ });
+
+ var coreCounts = {};
+ var i, j;
+ for (i = 0; i < model.coreSwitches.length - 1; i += 1) {
+ for (j = i + 1; j < model.coreSwitches.length; j += 1) {
+ var si = model.coreSwitches[i];
+ var sj = model.coreSwitches[j];
+ var key1 = si.dpid + '=>' + sj.dpid;
+ var key2 = sj.dpid + '=>' + si.dpid;
+ var linkCount = 0;
+ if (allCounts[key1]) {
+ linkCount += allCounts[key1];
+ }
+ if (allCounts[key2]) {
+ linkCount += allCounts[key2];
+ }
+
+ coreCounts[key1] = linkCount;
+ }
+ }
+
+ return d3.entries(coreCounts);
+}
+
+
+/***************************************************************************************************
+
+***************************************************************************************************/
+function doConfirm(prompt, cb, options) {
+ var confirm = d3.select('#confirm');
+ confirm.select('#confirm-prompt').text(prompt);
+
+ var select = d3.select(document.getElementById('confirm-select'));
+ if (options) {
+ select.style('display', 'block');
+ select.text('');
+ select.selectAll('option').
+ data(options)
+ .enter()
+ .append('option')
+ .attr('value', function (d) {return d})
+ .text(function (d) {return d});
+ } else {
+ select.style('display', 'none');
+ }
+
+ function show() {
+ confirm.style('display', '-webkit-box');
+ confirm.style('opacity', 0);
+ setTimeout(function () {
+ confirm.style('opacity', 1);
+ }, 0);
+ }
+
+ function dismiss() {
+ confirm.style('opacity', 0);
+ confirm.on('webkitTransitionEnd', function () {
+ confirm.style('display', 'none');
+ confirm.on('webkitTransitionEnd', null);
+ });
+ }
+
+ confirm.select('#confirm-ok').on('click', function () {
+ d3.select(this).on('click', null);
+ dismiss();
+ if (options) {
+ cb(select[0][0].value);
+ } else {
+ cb(true);
+ }
+ });
+
+ confirm.select('#confirm-cancel').on('click', function () {
+ d3.select(this).on('click', null);
+ dismiss();
+ cb(false);
+ });
+
+ show();
+}
+
+
+
+
+
diff --git a/web/pingall.py b/web/pingall.py
new file mode 100755
index 0000000..0643cb9
--- /dev/null
+++ b/web/pingall.py
@@ -0,0 +1,53 @@
+#! /usr/bin/env python
+import sys
+import time
+import os
+
+hosts=['onosdevz1', 'onosdevz2', 'onosdevz3', 'onosdevz4', 'onosdevz5', 'onosdevz6', 'onosdevz7', 'onosdevz8']
+filename = sys.argv[1]
+
+ping_cnt=3
+wait=ping_cnt
+
+f = open(filename, 'r')
+nr_ping = 0
+for line in f:
+ if line[0] != "#":
+ fid=int(line.strip().split()[0])
+ src_dpid=line.strip().split()[2]
+ dst_dpid=line.strip().split()[4]
+ src_nwid=int(src_dpid.split(':')[-2], 16)
+ dst_nwid=int(dst_dpid.split(':')[-2], 16)
+ src_hostid=int(src_dpid.split(':')[-1], 16)
+ dst_hostid=int(dst_dpid.split(':')[-1], 16)
+ cmd="echo \"192.168.%d.%d -> 192.168.%d.%d\" > /tmp/ping.%d" % (src_nwid, src_hostid, dst_nwid, dst_hostid,fid)
+ os.popen(cmd)
+ cmd="ssh %s \'ssh -o StrictHostKeyChecking=no 1.1.%d.1 \'ping -c %d -W 1 192.168.%d.%d\'\' >> /tmp/ping.%d 2>&1 &" % (hosts[src_nwid-1], src_hostid, ping_cnt, dst_nwid, dst_hostid,fid)
+# print cmd
+ result = os.popen(cmd).read()
+ nr_ping = nr_ping + 1
+
+print "waiting for ping(s) to finish (%d sec)" % (wait)
+time.sleep(wait)
+cmd="cat /tmp/ping.* | grep loss |wc -l"
+while 1:
+ result = int(os.popen(cmd).read())
+ if result == nr_ping:
+ break
+
+cmd='cat /tmp/ping.* | grep " 0% packet loss" |wc -l'
+result = int(os.popen(cmd).read())
+if result != nr_ping:
+ print "fail: %d ping(s) failed (out of %d)" % (nr_ping - result, nr_ping)
+else:
+ print "success: all %d ping(s) got through" % (result)
+
+for i in range(nr_ping):
+ cmd="cat /tmp/ping.%d | grep loss | awk '{print $6}'" % (i+1)
+ cmd2="cat /tmp/ping.%d | head -n 1" % (i+1)
+ result = os.popen(cmd).read().strip()
+ result2 = os.popen(cmd2).read().strip()
+ if result != "0%":
+ print "flow # %d fail (%s)" % (i+1, result2)
+
+f.close()
diff --git a/web/pingallm-local.py b/web/pingallm-local.py
new file mode 100755
index 0000000..7dc69f8
--- /dev/null
+++ b/web/pingallm-local.py
@@ -0,0 +1,92 @@
+#! /usr/bin/env python
+import sys
+import time
+import os
+import re
+import json
+
+ping_cnt=10
+wait1=ping_cnt
+wait2=10
+
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+
+def read_config():
+ global controllers, cluster_basename
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ controllers = conf['controllers']
+ cluster_basename = conf['cluster_basename']
+ f.close()
+
+def do_pingall(nwid):
+ pid=os.getpid()
+ os.popen("rm -f /tmp/ping.*")
+
+ filename = sys.argv[1]
+ f = open(filename, 'r')
+ nr_ping = 0
+ fids=[]
+ for line in f:
+ if line[0] != "#":
+ fid=int(line.strip().split()[0])
+ logfile="/tmp/ping.%d" % (fid)
+ src_dpid=line.strip().split()[2]
+ dst_dpid=line.strip().split()[4]
+ src_nwid=int(src_dpid.split(':')[-2], 16)
+ dst_nwid=int(dst_dpid.split(':')[-2], 16)
+ src_hostid=int(src_dpid.split(':')[-1], 16)
+ dst_hostid=int(dst_dpid.split(':')[-1], 16)
+
+ if src_nwid == nwid:
+ cmd="echo \"Pingall flow %d : 192.168.%d.%d -> 192.168.%d.%d\" > %s" % (fid, src_nwid, src_hostid, dst_nwid, dst_hostid,logfile)
+ os.popen(cmd)
+# cmd="ssh %s \'${HOME}/ONOS/test-network/mininet/mrun host%d \'ping -c %d -W 1 192.168.%d.%d\'\' >> %s 2>&1 &" % (controllers[src_nwid-1], src_hostid, ping_cnt, dst_nwid, dst_hostid,logfile)
+ cmd="${HOME}/ONOS/test-network/mininet/mrun host%d \'ping -c %d -W 1 192.168.%d.%d\' >> %s 2>&1 &" % (src_hostid, ping_cnt, dst_nwid, dst_hostid,logfile)
+ print cmd
+ result = os.popen(cmd).read()
+# time.sleep(0.2)
+ fids.append(fid)
+ nr_ping = nr_ping + 1
+
+ f.close()
+ return fids
+
+def wait_ping_finish(nr_ping):
+ print "all pings started.. waiting for completion (%d sec)" % (wait1)
+ time.sleep(wait1)
+ cmd="cat /tmp/ping.* | grep \"packet loss\" |wc -l"
+ for i in range(wait2):
+ nr_done = int(os.popen(cmd).read())
+ if nr_done == nr_ping:
+ break
+ print "%d ping finished" % nr_done
+ time.sleep(1)
+
+ return nr_done
+
+def report(fids, nr_done):
+ cmd='cat /tmp/ping.* | grep " 0% packet loss" |wc -l'
+ nr_success = int(os.popen('cat /tmp/ping.* | grep " 0% packet loss" |wc -l').read())
+ nr_incomplete = len(fids) - nr_done
+ nr_fail = nr_done - nr_success
+
+ print "Pingall Result: success %d fail %d incomplete %d" % (nr_success, nr_fail, nr_incomplete)
+ if nr_fail > 0 or nr_incomplete > 0:
+ for i in fids:
+ cmd="cat /tmp/ping.%d | head -n 1" % (i)
+ flow_desc = os.popen(cmd).read().strip()
+
+ cmd="cat /tmp/ping.%d | grep \"packet loss\"" % (i)
+ result = os.popen(cmd).read().strip()
+
+ if not re.search(" 0% packet loss", result):
+ print "flow # %d %s : %s" % (i, flow_desc, result)
+
+if __name__ == "__main__":
+ read_config()
+ hostname=os.popen('hostname').read().strip()
+ nwid=int(hostname.replace("%s" % cluster_basename, ""))
+ fids=do_pingall(nwid)
+ nr_done=wait_ping_finish(len(fids))
+ report(fids, nr_done)
diff --git a/web/pingallm.py b/web/pingallm.py
new file mode 100755
index 0000000..db1f81c
--- /dev/null
+++ b/web/pingallm.py
@@ -0,0 +1,86 @@
+#! /usr/bin/env python
+import sys
+import time
+import os
+import re
+import json
+
+ping_cnt=3
+wait1=ping_cnt
+wait2=10
+
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+
+def read_config():
+ global controllers
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ controllers = conf['controllers']
+ f.close()
+
+def do_pingall():
+
+ pid=os.getpid()
+ os.popen("rm -f /tmp/ping.*")
+
+ filename = sys.argv[1]
+ f = open(filename, 'r')
+ nr_ping = 0
+ for line in f:
+ if line[0] != "#":
+ fid=int(line.strip().split()[0])
+# logfile="/tmp/ping.pid%d.%d" % (pid, fid)
+ logfile="/tmp/ping.%d" % (fid)
+ src_dpid=line.strip().split()[2]
+ dst_dpid=line.strip().split()[4]
+ src_nwid=int(src_dpid.split(':')[-2], 16)
+ dst_nwid=int(dst_dpid.split(':')[-2], 16)
+ src_hostid=int(src_dpid.split(':')[-1], 16)
+ dst_hostid=int(dst_dpid.split(':')[-1], 16)
+ cmd="echo \"Pingall flow %d : 192.168.%d.%d -> 192.168.%d.%d\" > %s" % (fid, src_nwid, src_hostid, dst_nwid, dst_hostid,logfile)
+ os.popen(cmd)
+ cmd="ssh %s \'${HOME}/ONOS/test-network/mininet/mrun host%d \'ping -c %d -W 1 192.168.%d.%d\'\' >> %s 2>&1 &" % (controllers[src_nwid-1], src_hostid, ping_cnt, dst_nwid, dst_hostid,logfile)
+ print cmd
+ result = os.popen(cmd).read()
+ time.sleep(0.2)
+ nr_ping = nr_ping + 1
+
+ f.close()
+ return nr_ping
+
+def wait_ping_finish(nr_ping):
+ print "all pings started.. waiting for completion (%d sec)" % (wait1)
+ time.sleep(wait1)
+ cmd="cat /tmp/ping.* | grep \"packet loss\" |wc -l"
+ for i in range(wait2):
+ nr_done = int(os.popen(cmd).read())
+ if nr_done == nr_ping:
+ break
+ print "%d ping finished" % nr_done
+ time.sleep(1)
+
+ return nr_done
+
+def report(nr_ping, nr_done):
+ cmd='cat /tmp/ping.* | grep " 0% packet loss" |wc -l'
+ nr_success = int(os.popen('cat /tmp/ping.* | grep " 0% packet loss" |wc -l').read())
+ nr_incomplete = nr_ping - nr_done
+ nr_fail = nr_done - nr_success
+
+ print "Pingall Result: success %d fail %d incomplete %d" % (nr_success, nr_fail, nr_incomplete)
+ if nr_fail > 0 or nr_incomplete > 0:
+ for i in range(nr_ping):
+ cmd="cat /tmp/ping.%d | head -n 1" % (i+1)
+ flow_desc = os.popen(cmd).read().strip()
+
+ cmd="cat /tmp/ping.%d | grep \"packet loss\"" % (i+1)
+ result = os.popen(cmd).read().strip()
+
+ if not re.search(" 0% packet loss", result):
+ print "flow # %d %s : %s" % (i+1, flow_desc, result)
+
+if __name__ == "__main__":
+ read_config()
+ nr_ping=do_pingall()
+ nr_done=wait_ping_finish(nr_ping)
+ report(nr_ping, nr_done)
diff --git a/web/preset_flow.py b/web/preset_flow.py
new file mode 100755
index 0000000..626a2ba
--- /dev/null
+++ b/web/preset_flow.py
@@ -0,0 +1,25 @@
+#! /usr/bin/env python
+import itertools
+import sys
+
+src_port=1
+dst_port=1
+
+n=int(sys.argv[1])
+a=range(2,n+1)
+nflow=int(sys.argv[2])
+
+print "# For %d nodes cluster, %d flows per network pair, total %d flows" % (n, nflow, (n-1)*(n-2)/2 * nflow * 2)
+
+flow_id=1
+pair_id=1
+for i in itertools.combinations(a,2):
+ for f in range(2, nflow+2):
+ snet_id=int(i[0])
+ dnet_id=int(i[1])
+ term_id=f
+ print "%d ps_%d_1 00:00:00:00:00:00:%02x:%02x %d 00:00:00:00:00:00:%02x:%02x %d matchSrcMac 00:00:c0:a8:%02x:%02x matchDstMac 00:00:c0:a8:%02x:%02x" % (flow_id,pair_id,snet_id,term_id,src_port,dnet_id,term_id,dst_port,snet_id,term_id,dnet_id,term_id)
+ flow_id = flow_id + 1
+ print "%d ps_%d_2 00:00:00:00:00:00:%02x:%02x %d 00:00:00:00:00:00:%02x:%02x %d matchSrcMac 00:00:c0:a8:%02x:%02x matchDstMac 00:00:c0:a8:%02x:%02x" % (flow_id,pair_id,dnet_id,term_id,dst_port,snet_id,term_id,src_port,dnet_id,term_id,snet_id,term_id)
+ flow_id = flow_id + 1
+ pair_id = pair_id + 1
diff --git a/web/preset_flow.sh b/web/preset_flow.sh
new file mode 100755
index 0000000..696c94c
--- /dev/null
+++ b/web/preset_flow.sh
@@ -0,0 +1,11 @@
+#! /bin/bash
+Cluster=4
+for n in 8 24; do
+ let nr_flows=\($Cluster-1\)*\($Cluster-2\)*$n
+ ./preset_flow.py $Cluster $n > flowdef_${Cluster}node_$nr_flows.txt
+done
+Cluster=8
+for n in 1 3 6 10 24; do
+ let nr_flows=\($Cluster-1\)*\($Cluster-2\)*$n
+ ./preset_flow.py $Cluster $n > flowdef_${Cluster}node_$nr_flows.txt
+done
diff --git a/web/pusher.py b/web/pusher.py
new file mode 100755
index 0000000..2a3528b
--- /dev/null
+++ b/web/pusher.py
@@ -0,0 +1,152 @@
+#! /usr/bin/env python
+
+
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+from flask import Flask, json, Response, render_template, make_response, request
+
+## Global Var ##
+ControllerIP="127.0.0.1"
+ControllerPort=8080
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+app = Flask(__name__)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+# @app.route("/wm/fprog/pusher/setrate/<dpid>/<rate>/json")
+# Sample output:
+# "true"
+def set_rate(dpid,rate):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/pusher/setrate/%s/%s/json\"" % (ControllerIP, ControllerPort, dpid, rate)
+ debug("set_rate %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to set rate"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "Sending rate to %s is successfully set to %s" % (dpid, rate)
+
+# @app.route("/wm/fprog/pusher/suspend/<dpid>/json")
+# Sample output:
+# "true"
+def suspend(dpid):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/pusher/suspend/%s/json\"" % (ControllerIP, ControllerPort, dpid)
+ debug("suspend %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to suspend"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "DPID %s is successfully suspended" % dpid
+
+# @app.route("/wm/fprog/pusher/resume/<dpid>/json")
+# Sample output:
+# "true"
+def resume(dpid):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/pusher/resume/%s/json\"" % (ControllerIP, ControllerPort, dpid)
+ debug("resume %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to resume"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "DPID %s is successfully resumed" % dpid
+
+# @app.route("/wm/fprog/pusher/barrier/<dpid>/json")
+# Sample output:
+# "{"version":1,"type":"BARRIER_REPLY","length":8,"xid":4,"lengthU":8}"
+def barrier(dpid):
+ try:
+ command = "curl -s \"http://%s:%s/wm/fprog/pusher/barrier/%s/json\"" % (ControllerIP, ControllerPort, dpid)
+ debug("barrier %s" % command)
+
+ result = os.popen(command).read()
+ debug("result %s" % result)
+ if result == "false":
+ print "Failed to send barrier"
+ return;
+ except:
+ log_error("Controller IF has issue")
+ exit(1)
+
+ print "Barrier reply from %s : %s" % (dpid, result)
+
+
+if __name__ == "__main__":
+ usage_msg1 = "Usage:\n"
+ usage_msg2 = "%s rate <dpid> <rate> : Set sending rate[bytes/ms] to the switch\n" % (sys.argv[0])
+ usage_msg3 = " suspend <dpid> : Suspend sending message to the switch\n"
+ usage_msg4 = " resume <dpid> : Resume sending message to the switch\n"
+ usage_msg5 = " barrier <dpid> : Send barrier message to the switch\n"
+ usage_msg = usage_msg1 + usage_msg2 + usage_msg3 + usage_msg4 + usage_msg5;
+
+ app.debug = True;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+ if len(sys.argv) < 2:
+ log_error(usage_msg)
+ exit(1)
+
+ # Do the work
+ if sys.argv[1] == "rate":
+ if len(sys.argv) < 4:
+ log_error(usage_msg)
+ exit(1)
+ set_rate(sys.argv[2], sys.argv[3])
+ elif sys.argv[1] == "suspend":
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+ suspend(sys.argv[2])
+ elif sys.argv[1] == "resume":
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+ resume(sys.argv[2])
+ elif sys.argv[1] == "barrier":
+ if len(sys.argv) < 3:
+ log_error(usage_msg)
+ exit(1)
+ barrier(sys.argv[2])
+ else:
+ log_error(usage_msg)
+ exit(1)
diff --git a/web/rest-test.sh b/web/rest-test.sh
new file mode 100755
index 0000000..2551f12
--- /dev/null
+++ b/web/rest-test.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+rm -f rest.json
+touch rest.json
+
+urls="http://localhost:8080/wm/core/topology/switches/all/json http://localhost:8080/wm/core/topology/links/json http://localhost:8080/wm/registry/controllers/json http://localhost:8080/wm/registry/switches/json"
+
+for url in $urls; do
+ echo "---REST CALL---" >> rest.json
+ echo "curl -s $url" >> rest.json
+ echo "---Result----" >> rest.json
+ curl -s $url | python -m json.tool >> rest.json
+done
diff --git a/web/restapi2.py b/web/restapi2.py
index bf049fd..c9952ac 100755
--- a/web/restapi2.py
+++ b/web/restapi2.py
@@ -28,6 +28,11 @@
@app.route('/', methods=['GET'])
@app.route('/<filename>', methods=['GET'])
@app.route('/tpl/<filename>', methods=['GET'])
+@app.route('/ons-demo/<filename>', methods=['GET'])
+@app.route('/ons-demo/js/<filename>', methods=['GET'])
+@app.route('/ons-demo/css/<filename>', methods=['GET'])
+@app.route('/ons-demo/assets/<filename>', methods=['GET'])
+@app.route('/ons-demo/data/<filename>', methods=['GET'])
def return_file(filename="index.html"):
if request.path == "/":
fullpath = "./index.html"
@@ -48,6 +53,103 @@
return response
+## PROXY API (allows development where the webui is served from someplace other than the controller)##
+ONOS_GUI3_HOST="http://gui3.onlab.us:8080"
+ONOS_LOCAL_HOST="http://localhost:8080" ;# for Amazon EC2
+
+@app.route("/wm/core/topology/switches/all/json")
+def switches():
+ if request.args.get('proxy') == None:
+ host = ONOS_LOCAL_HOST
+ else:
+ host = ONOS_GUI3_HOST
+
+ try:
+ command = "curl -s %s/wm/core/topology/switches/all/json" % (host)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/wm/core/topology/links/json")
+def links():
+ if request.args.get('proxy') == None:
+ host = ONOS_LOCAL_HOST
+ else:
+ host = ONOS_GUI3_HOST
+
+ try:
+ command = "curl -s %s/wm/core/topology/links/json" % (host)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/wm/flow/getall/json")
+def flows():
+ if request.args.get('proxy') == None:
+ host = ONOS_LOCAL_HOST
+ else:
+ host = ONOS_GUI3_HOST
+
+ try:
+ command = "curl -s %s/wm/flow/getall/json" % (host)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/wm/registry/controllers/json")
+def registry_controllers():
+ if request.args.get('proxy') == None:
+ host = ONOS_LOCAL_HOST
+ else:
+ host = ONOS_GUI3_HOST
+
+ try:
+ command = "curl -s %s/wm/registry/controllers/json" % (host)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/wm/registry/switches/json")
+def registry_switches():
+ if request.args.get('proxy') == None:
+ host = ONOS_LOCAL_HOST
+ else:
+ host = ONOS_GUI3_HOST
+
+ try:
+ command = "curl -s %s/wm/registry/switches/json" % (host)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+
+
+
## REST API ##
#@app.route("/wm/topology/links/json")
#def links():
@@ -127,7 +229,7 @@
ret = {}
ret[switchId]=aggr
else:
- ret = {}
+ ret = {}
js = json.dumps(ret)
resp = Response(js, status=200, mimetype='application/json')
@@ -244,11 +346,11 @@
sw_dpid = parsedResult['dpid']
return sw_dpid
-
+
if __name__ == "__main__":
app.debug = True
- app.run(host="0.0.0.0", port=9000)
+ app.run(threaded=True, host="0.0.0.0", port=9000)
# query_switch()
# query_links()
# devices()
diff --git a/web/shortest_path.py b/web/shortest_path.py
index 8a77d61..0f23bf4 100755
--- a/web/shortest_path.py
+++ b/web/shortest_path.py
@@ -67,11 +67,12 @@
inPort = f['inPort']['value'];
outPort = f['outPort']['value'];
dpid = f['dpid']['value']
- print "FlowEntry: (%s, %s, %s)" % (inPort, dpid, outPort)
+ print " FlowEntry: (%s, %s, %s)" % (inPort, dpid, outPort)
if __name__ == "__main__":
- usage_msg = "Usage: %s <src-dpid> <src-port> <dest-dpid> <dest-port>" % (sys.argv[0])
+ usage_msg = "Compute the shortest path between two switch ports in the Network MAP\n"
+ usage_msg = usage_msg + "Usage: %s <src-dpid> <src-port> <dest-dpid> <dest-port>" % (sys.argv[0])
# app.debug = False;
diff --git a/web/topology_rest.py b/web/topology_rest.py
index b109ccc..b3a415e 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -7,20 +7,55 @@
import argparse
import io
import time
+import random
+
+import re
from flask import Flask, json, Response, render_template, make_response, request
-## Global Var ##
+CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
+LINK_FILE=os.getenv("HOME") + "/ONOS/web/link.json"
+ONOSDIR=os.getenv("HOME") + "/ONOS"
+
+## Global Var for ON.Lab local REST ##
RestIP="localhost"
RestPort=8080
-#DBName="onos-network-map"
-controllers=["onos9vpc", "onos10vpc", "onos11vpc", "onos12vpc"]
-
+ONOS_DEFAULT_HOST="localhost" ;# Has to set if LB=False
DEBUG=1
-pp = pprint.PrettyPrinter(indent=4)
+pp = pprint.PrettyPrinter(indent=4)
app = Flask(__name__)
+def read_config():
+ global LB, TESTBED, controllers, core_switches, ONOS_GUI3_HOST, ONOS_GUI3_CONTROL_HOST
+ f = open(CONFIG_FILE)
+ conf = json.load(f)
+ LB = conf['LB']
+ TESTBED = conf['TESTBED']
+ controllers = conf['controllers']
+ core_switches=conf['core_switches']
+ ONOS_GUI3_HOST=conf['ONOS_GUI3_HOST']
+ ONOS_GUI3_CONTROL_HOST=conf['ONOS_GUI3_CONTROL_HOST']
+ f.close()
+
+def read_link_def():
+ global link_def
+ f=open(LINK_FILE)
+ try:
+ link_def=json.load(f)
+ f.close()
+ except:
+ print "Can't read link def file (link.json)"
+ sys.exit(1)
+
+def get_link_ports(src_dpid, dst_dpid):
+ ret = (-1, -1)
+ for link in link_def:
+ if link['src-switch'] == src_dpid and link['dst-switch'] == dst_dpid:
+ ret = (link['src-port'], link['dst-port'])
+ break
+ return ret
+
## Worker Functions ##
def log_error(txt):
print '%s' % (txt)
@@ -29,7 +64,6 @@
if DEBUG:
print '%s' % (txt)
-## Rest APIs ##
### File Fetch ###
@app.route('/ui/img/<filename>', methods=['GET'])
@app.route('/img/<filename>', methods=['GET'])
@@ -38,15 +72,29 @@
@app.route('/js/views/<filename>', methods=['GET'])
@app.route('/js/<filename>', methods=['GET'])
@app.route('/lib/<filename>', methods=['GET'])
+@app.route('/log/<filename>', methods=['GET'])
@app.route('/', methods=['GET'])
@app.route('/<filename>', methods=['GET'])
@app.route('/tpl/<filename>', methods=['GET'])
+@app.route('/ons-demo/<filename>', methods=['GET'])
+@app.route('/ons-demo/js/<filename>', methods=['GET'])
+@app.route('/ons-demo/d3/<filename>', methods=['GET'])
+@app.route('/ons-demo/css/<filename>', methods=['GET'])
+@app.route('/ons-demo/assets/<filename>', methods=['GET'])
+@app.route('/ons-demo/data/<filename>', methods=['GET'])
def return_file(filename="index.html"):
if request.path == "/":
fullpath = "./index.html"
else:
fullpath = str(request.path)[1:]
+ try:
+ open(fullpath)
+ except:
+ response = make_response("Cannot find a file: %s" % (fullpath), 500)
+ response.headers["Content-type"] = "text/html"
+ return response
+
response = make_response(open(fullpath).read())
suffix = fullpath.split(".")[-1]
@@ -58,38 +106,240 @@
response.headers["Content-type"] = "text/css"
elif suffix == "png":
response.headers["Content-type"] = "image/png"
+ elif suffix == "svg":
+ response.headers["Content-type"] = "image/svg+xml"
return response
-init_topo1 = {
- "nodes" : [
- {"name" : "sw0", "group" : 0},
- {"name" : "sw1", "group" : 0},
- {"name" : "sw2", "group" : 0},
- {"name" : "sw3", "group" : 0},
- {"name" : "sw4", "group" : 0},
- {"name" : "sw5", "group" : 0},
- {"name" : "host0", "group" : 1}
- ],
- "links" : [
- {"source" :0, "target": 1},
- {"source" :1, "target": 0},
- {"source" :0, "target": 2},
- {"source" :2, "target": 0},
- {"source" :1, "target": 3},
- {"source" :3, "target": 1},
- {"source" :2, "target": 3},
- {"source" :3, "target": 2},
- {"source" :2, "target": 4},
- {"source" :4, "target": 2},
- {"source" :3, "target": 5},
- {"source" :5, "target": 3},
- {"source" :4, "target": 5},
- {"source" :5, "target": 4},
- {"source" :6, "target": 0},
- {"source" :0, "target": 6}
- ]
-}
+## Proxy ##
+@app.route("/proxy/gui/link/<cmd>/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>")
+def proxy_link_change(cmd, src_dpid, src_port, dst_dpid, dst_port):
+ try:
+ command = "curl -s %s/gui/link/%s/%s/%s/%s/%s" % (ONOS_GUI3_CONTROL_HOST, cmd, src_dpid, src_port, dst_dpid, dst_port)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/switchctrl/<cmd>")
+def proxy_switch_controller_setting(cmd):
+ try:
+ command = "curl -s %s/gui/switchctrl/%s" % (ONOS_GUI3_CONTROL_HOST, cmd)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/switch/<cmd>/<dpid>")
+def proxy_switch_status_change(cmd, dpid):
+ try:
+ command = "curl -s %s/gui/switch/%s/%s" % (ONOS_GUI3_CONTROL_HOST, cmd, dpid)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/controller/<cmd>/<controller_name>")
+def proxy_controller_status_change(cmd, controller_name):
+ try:
+ command = "curl -s %s/gui/controller/%s/%s" % (ONOS_GUI3_CONTROL_HOST, cmd, controller_name)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/addflow/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>/<srcMAC>/<dstMAC>")
+def proxy_add_flow(src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC):
+ try:
+ command = "curl -s %s/gui/addflow/%s/%s/%s/%s/%s/%s" % (ONOS_GUI3_CONTROL_HOST, src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/delflow/<flow_id>")
+def proxy_del_flow(flow_id):
+ try:
+ command = "curl -s %s/gui/delflow/%s" % (ONOS_GUI3_CONTROL_HOST, flow_id)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/iperf/start/<flow_id>/<duration>/<samples>")
+def proxy_iperf_start(flow_id,duration,samples):
+ try:
+ command = "curl -m 40 -s %s/gui/iperf/start/%s/%s/%s" % (ONOS_GUI3_CONTROL_HOST, flow_id, duration, samples)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/iperf/rate/<flow_id>")
+def proxy_iperf_rate(flow_id):
+ try:
+ command = "curl -s %s/gui/iperf/rate/%s" % (ONOS_GUI3_CONTROL_HOST, flow_id)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/reset")
+def proxy_gui_reset():
+ result = ""
+ try:
+ command = "curl -m 300 -s %s/gui/reset" % (ONOS_GUI3_CONTROL_HOST)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+@app.route("/proxy/gui/scale")
+def proxy_gui_scale():
+ result = ""
+ try:
+ command = "curl -m 300 -s %s/gui/scale" % (ONOS_GUI3_CONTROL_HOST)
+ print command
+ result = os.popen(command).read()
+ except:
+ print "REST IF has issue"
+ exit
+
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
+
+###### ONOS REST API ##############################
+## Worker Func ###
+def get_json(url):
+ code = 200
+ try:
+ command = "curl -m 60 -s %s" % (url)
+ result = os.popen(command).read()
+ parsedResult = json.loads(result)
+ if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
+ print "REST %s returned code %s" % (command, parsedResult['code'])
+ code=500
+ except:
+ print "REST IF %s has issue" % command
+ result = ""
+ code = 500
+
+ return (code, result)
+
+def pick_host():
+ if LB == True:
+ nr_host=len(controllers)
+ r=random.randint(0, nr_host - 1)
+ host=controllers[r]
+ else:
+ host=ONOS_DEFAULT_HOST
+
+ return "http://" + host + ":8080"
+
+## Switch ##
+@app.route("/wm/core/topology/switches/all/json")
+def switches():
+ if request.args.get('proxy') == None:
+ host = pick_host()
+ else:
+ host = ONOS_GUI3_HOST
+
+ url ="%s/wm/core/topology/switches/all/json" % (host)
+ (code, result) = get_json(url)
+
+ resp = Response(result, status=code, mimetype='application/json')
+ return resp
+
+## Link ##
+@app.route("/wm/core/topology/links/json")
+def links():
+ if request.args.get('proxy') == None:
+ host = pick_host()
+ else:
+ host = ONOS_GUI3_HOST
+
+ url ="%s/wm/core/topology/links/json" % (host)
+ (code, result) = get_json(url)
+
+ resp = Response(result, status=code, mimetype='application/json')
+ return resp
+
+## FlowSummary ##
+@app.route("/wm/flow/getsummary/<start>/<range>/json")
+def flows(start, range):
+ if request.args.get('proxy') == None:
+ host = pick_host()
+ else:
+ host = ONOS_GUI3_HOST
+
+ url ="%s/wm/flow/getsummary/%s/%s/json" % (host, start, range)
+ (code, result) = get_json(url)
+
+ resp = Response(result, status=code, mimetype='application/json')
+ return resp
+
+@app.route("/wm/registry/controllers/json")
+def registry_controllers():
+ if request.args.get('proxy') == None:
+ host = pick_host()
+ else:
+ host = ONOS_GUI3_HOST
+
+ url= "%s/wm/registry/controllers/json" % (host)
+ (code, result) = get_json(url)
+
+ resp = Response(result, status=code, mimetype='application/json')
+ return resp
+
+
+@app.route("/wm/registry/switches/json")
+def registry_switches():
+ if request.args.get('proxy') == None:
+ host = pick_host()
+ else:
+ host = ONOS_GUI3_HOST
+
+ url="%s/wm/registry/switches/json" % (host)
+ (code, result) = get_json(url)
+
+ resp = Response(result, status=code, mimetype='application/json')
+ return resp
def node_id(switch_array, dpid):
id = -1
@@ -100,6 +350,7 @@
return id
+## API for ON.Lab local GUI ##
@app.route('/topology', methods=['GET'])
def topology_for_gui():
try:
@@ -109,7 +360,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
topo = {}
switches = []
@@ -125,52 +377,10 @@
sw['name']=dpid
sw['group']= -1
-# if state == "ACTIVE":
-# if dpid.split(":")[5] == "0a":
-# sw['group']=1
-# if dpid.split(":")[5] == "0b":
-# sw['group']=2
-# if dpid.split(":")[5] == "0c":
-# sw['group']=3
-# if dpid.split(":")[5] == "0d":
-# sw['group']=4
if state == "INACTIVE":
sw['group']=0
switches.append(sw)
-## Comment in if we need devies
-# sw_index = len(switches) - 1
-# for p in v['ports']:
-# for d in p['devices']:
-# device = {}
-# device['attached_switch']=dpid
-# device['name']=d['mac']
-# if d['state'] == "ACTIVE":
-# device['group']=1000
-# else:
-# device['group']=1001
-#
-# switches.append(device)
-# device_index = len (switches) -1
-# link = {}
-# link['source'] = device_index
-# link['target'] = sw_index
-# link['type'] = -1
-# links.append(link)
-# link = {}
-# link['source'] = sw_index
-# link['target'] = device_index
-# link['type'] = -1
-# links.append(link)
-
-# try:
-# command = "curl -s \'http://%s:%s/wm/registry/controllers/json\'" % (RestIP, RestPort)
-# result = os.popen(command).read()
-# controllers = json.loads(result)
-# except:
-# log_error("xx REST IF has issue: %s" % command)
-# log_error("%s" % result)
-
try:
command = "curl -s \'http://%s:%s/wm/registry/switches/json\'" % (RestIP, RestPort)
result = os.popen(command).read()
@@ -187,28 +397,28 @@
if switches[sw_id]['group'] != 0:
switches[sw_id]['group'] = controllers.index(ctrl) + 1
- try:
- v1 = "00:00:00:00:00:0a:0d:00"
+# try:
+# v1 = "00:00:00:00:00:0a:0d:00"
# v1 = "00:00:00:00:00:0d:00:d1"
- p1=1
- v2 = "00:00:00:00:00:0b:0d:03"
+# p1=1
+# v2 = "00:00:00:00:00:0b:0d:03"
# v2 = "00:00:00:00:00:0d:00:d3"
- p2=1
- command = "curl -s http://%s:%s/wm/topology/route/%s/%s/%s/%s/json" % (RestIP, RestPort, v1, p1, v2, p2)
- result = os.popen(command).read()
- parsedResult = json.loads(result)
- except:
- log_error("No route")
- parsedResult = {}
+# p2=1
+# command = "curl -s http://%s:%s/wm/topology/route/%s/%s/%s/%s/json" % (RestIP, RestPort, v1, p1, v2, p2)
+# result = os.popen(command).read()
+# parsedResult = json.loads(result)
+# except:
+# log_error("No route")
+# parsedResult = {}
- path = []
- if parsedResult.has_key('flowEntries'):
- flowEntries= parsedResult['flowEntries']
- for i, v in enumerate(flowEntries):
- if i < len(flowEntries) - 1:
- sdpid= flowEntries[i]['dpid']['value']
- ddpid = flowEntries[i+1]['dpid']['value']
- path.append( (sdpid, ddpid))
+ #path = []
+ #if parsedResult.has_key('flowEntries'):
+ # flowEntries= parsedResult['flowEntries']
+ # for i, v in enumerate(flowEntries):
+ # if i < len(flowEntries) - 1:
+ # sdpid= flowEntries[i]['dpid']['value']
+ # ddpid = flowEntries[i+1]['dpid']['value']
+ # path.append( (sdpid, ddpid))
try:
command = "curl -s \'http://%s:%s/wm/core/topology/links/json\'" % (RestIP, RestPort)
@@ -217,7 +427,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for v in parsedResult:
link = {}
@@ -230,19 +441,18 @@
link['source'] = src_id
link['target'] = dst_id
- onpath = 0
- for (s,d) in path:
- if s == v['src-switch'] and d == v['dst-switch']:
- onpath = 1
- break
- link['type'] = onpath
+ #onpath = 0
+ #for (s,d) in path:
+ # if s == v['src-switch'] and d == v['dst-switch']:
+ # onpath = 1
+ # break
+ #link['type'] = onpath
links.append(link)
topo['nodes'] = switches
topo['links'] = links
- pp.pprint(topo)
js = json.dumps(topo)
resp = Response(js, status=200, mimetype='application/json')
return resp
@@ -258,7 +468,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
topo = {}
switches = []
@@ -291,12 +502,12 @@
parsedResult = []
# exit(1)
- path = [];
+ path = [];
for i, v in enumerate(parsedResult):
if i < len(parsedResult) - 1:
sdpid= parsedResult[i]['switch']
ddpid = parsedResult[i+1]['switch']
- path.append( (sdpid, ddpid))
+ path.append( (sdpid, ddpid))
try:
command = "curl -s \'http://%s:%s/wm/core/topology/links/json\'" % (RestIP, RestPort)
@@ -305,7 +516,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for v in parsedResult:
link = {}
@@ -329,7 +541,6 @@
topo['nodes'] = switches
topo['links'] = links
-# pp.pprint(topo)
js = json.dumps(topo)
resp = Response(js, status=200, mimetype='application/json')
return resp
@@ -345,7 +556,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
# print command
# print result
@@ -374,7 +586,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
devices = []
for v in parsedResult:
@@ -401,14 +614,12 @@
device['attachmentPoint']=attachpoints
devices.append(device)
- print devices
js = json.dumps(devices)
resp = Response(js, status=200, mimetype='application/json')
return resp
#{"entityClass":"DefaultEntityClass","mac":["7c:d1:c3:e0:8c:a3"],"ipv4":["192.168.2.102","10.1.10.35"],"vlan":[],"attachmentPoint":[{"port":13,"switchDPID":"00:01:00:12:e2:78:32:44","errorStatus":null}],"lastSeen":1357333593496}
-
## return fake stat for now
@app.route("/wm/core/switch/<switchId>/<statType>/json")
def switch_stat(switchId, statType):
@@ -421,7 +632,7 @@
ret = {}
ret[switchId]=aggr
else:
- ret = {}
+ ret = {}
js = json.dumps(ret)
resp = Response(js, status=200, mimetype='application/json')
@@ -438,7 +649,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
debug("query_links %s" % command)
# pp.pprint(parsedResult)
@@ -454,7 +666,8 @@
except:
log_error("REST IF has issue: %s" % command)
log_error("%s" % result)
- sys.exit(0)
+ return
+# sys.exit(0)
for p in linkResults:
if p.has_key('type') and p['type'] == "port":
@@ -476,113 +689,437 @@
resp = Response(js, status=200, mimetype='application/json')
return resp
-topo_less = {
- "nodes" : [
- {"name" : "00:a0", "group" : 1},
- {"name" : "00:a1", "group" : 1},
- {"name" : "00:a2", "group" : 1},
- ],
- "links" : [
- {"source" :0, "target": 1},
- {"source" :1, "target": 0},
- {"source" :0, "target": 2},
- {"source" :2, "target": 0},
- {"source" :1, "target": 2},
- {"source" :2, "target": 1},
- ]
-}
-
-topo_more = {
- "nodes" : [
- {"name" : "00:a3", "group" : 2},
- {"name" : "00:a0", "group" : 1},
- {"name" : "00:a1", "group" : 1},
- {"name" : "00:a2", "group" : 1},
- ],
- "links" : [
- {"source" :1, "target": 2},
- {"source" :2, "target": 1},
- {"source" :1, "target": 3},
- {"source" :3, "target": 1},
- {"source" :2, "target": 3},
- {"source" :3, "target": 2},
- {"source" :0, "target": 2},
- ]
-}
-
-@app.route("/topology_more")
-def topology_more():
- topo = topo_more
- js = json.dumps(topo)
- resp = Response(js, status=200, mimetype='application/json')
- return resp
-
-@app.route("/topology_less")
-def topology_less():
- topo = topo_less
- js = json.dumps(topo)
- resp = Response(js, status=200, mimetype='application/json')
- return resp
-
-cont_status1 = [
- {"name":"onos9vpc", "onos": 1, "cassandra": 1},
- {"name":"onos10vpc", "onos": 0, "cassandra": 1},
- {"name":"onos11vpc", "onos": 1, "cassandra": 0},
- {"name":"onos12vpc", "onos": 1, "cassandra": 0}]
-
-cont_status2 = [
- {"name":"onos9vpc", "onos": 0, "cassandra": 1},
- {"name":"onos10vpc", "onos": 0, "cassandra": 1},
- {"name":"onos11vpc", "onos": 0, "cassandra": 1},
- {"name":"onos12vpc", "onos": 0, "cassandra": 1}]
-
-@app.route("/controller_status1")
-def controller_status1():
- status = cont_status1
- js = json.dumps(status)
- resp = Response(js, status=200, mimetype='application/json')
- pp.pprint(resp)
- return resp
-
-@app.route("/controller_status2")
-def controller_status2():
- status = cont_status2
- js = json.dumps(status)
- resp = Response(js, status=200, mimetype='application/json')
- pp.pprint(resp)
- return resp
-
@app.route("/controller_status")
def controller_status():
- onos_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh status | awk '{print $1}'"
+# onos_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh status | awk '{print $1}'"
+ onos_check="cd; onos status | grep %s | awk '{print $2}'"
#cassandra_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-cassandra.sh status"
cont_status=[]
for i in controllers:
status={}
onos=os.popen(onos_check % i).read()[:-1]
+# onos=os.popen(onos_check % (i, i.lower())).read()[:-1]
status["name"]=i
status["onos"]=onos
- status["cassandra"]=1
+ status["cassandra"]=0
cont_status.append(status)
js = json.dumps(cont_status)
resp = Response(js, status=200, mimetype='application/json')
- pp.pprint(js)
return resp
+### Command ###
+@app.route("/gui/controller/<cmd>/<controller_name>")
+def controller_status_change(cmd, controller_name):
+ if (TESTBED == "hw"):
+ start_onos="/home/admin/bin/onos start %s" % (controller_name[-1:])
+# start_onos="/home/admin/bin/onos start %s > /tmp/debug " % (controller_name[-1:])
+ stop_onos="/home/admin/bin/onos stop %s" % (controller_name[-1:])
+# stop_onos="/home/admin/bin/onos stop %s > /tmp/debug " % (controller_name[-1:])
+# print "Debug: Controller command %s called %s" % (cmd, controller_name)
+ else:
+ # No longer use -i to specify keys (use .ssh/config to specify it)
+ start_onos="ssh %s \"cd ONOS; ./start-onos.sh start\"" % (controller_name)
+ stop_onos="ssh %s \"cd ONOS; ./start-onos.sh stop\"" % (controller_name)
+# start_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh start" % (controller_name)
+# stop_onos="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh stop" % (controller_name)
+ if cmd == "up":
+ result=os.popen(start_onos).read()
+ ret = "controller %s is up: %s" % (controller_name, result)
+ elif cmd == "down":
+ result=os.popen(stop_onos).read()
+ ret = "controller %s is down: %s" % (controller_name, result)
+
+ return ret
+
+@app.route("/gui/switchctrl/<cmd>")
+def switch_controller_setting(cmd):
+ if cmd =="local":
+ print "All aggr switches connects to local controller only"
+ result=""
+ if (TESTBED == "sw"):
+ for i in range(1, len(controllers)):
+ cmd_string="ssh %s 'cd ONOS/scripts; ./ctrl-local.sh'" % (controllers[i])
+ result += os.popen(cmd_string).read()
+ else:
+ cmd_string="cd; switch local > /tmp/watch"
+ result += os.popen(cmd_string).read()
+ elif cmd =="all":
+ print "All aggr switches connects to all controllers except for core controller"
+ result=""
+ if (TESTBED == "sw"):
+ for i in range(1, len(controllers)):
+ cmd_string="ssh %s 'cd ONOS/scripts; ./ctrl-add-ext.sh'" % (controllers[i])
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./ctrl-add-ext.sh'" % (controllers[i])
+ print "cmd is: "+cmd_string
+ result += os.popen(cmd_string).read()
+ else:
+ cmd_string="/home/admin/bin/switch all > /tmp/watch"
+ result += os.popen(cmd_string).read()
+
+ return result
+
+@app.route("/gui/reset")
+def reset_demo():
+ if (TESTBED == "hw"):
+ cmd_string="cd ~/bin; ./demo-reset-hw.sh > /tmp/watch &"
+ else:
+ cmd_string="cd ~/ONOS/scripts; ./demo-reset-sw.sh > /tmp/watch &"
+ os.popen(cmd_string)
+ return "Reset"
+
+@app.route("/gui/scale")
+def scale_demo():
+ if (TESTBED == "hw"):
+ cmd_string="cd ~/bin; ~/bin/demo-scale-out-hw.sh > /tmp/watch &"
+ else:
+ cmd_string="cd ~/ONOS/scripts; ./demo-scale-out-sw.sh > /tmp/watch &"
+ os.popen(cmd_string)
+ return "scale"
+
+@app.route("/gui/switch/<cmd>/<dpid>")
+def switch_status_change(cmd, dpid):
+ result = ""
+ if (TESTBED == "hw"):
+ return result
+
+ r = re.compile(':')
+ dpid = re.sub(r, '', dpid)
+ host=controllers[0]
+ cmd_string="ssh %s 'cd ONOS/scripts; ./switch.sh %s %s'" % (host, dpid, cmd)
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./switch.sh %s %s'" % (host, dpid, cmd)
+ get_status="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./switch.sh %s'" % (host, dpid)
+ print "cmd_string"
+
+ if cmd =="up" or cmd=="down":
+ print "make dpid %s %s" % (dpid, cmd)
+ os.popen(cmd_string)
+ result=os.popen(get_status).read()
+
+ return result
+
+#* Link Up
+#http://localhost:9000/gui/link/up/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>
+@app.route("/gui/link/up/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>")
+def link_up(src_dpid, src_port, dst_dpid, dst_port):
+ result = ""
+
+ if (TESTBED == "sw"):
+ result = link_up_sw(src_dpid, src_port, dst_dpid, dst_port)
+ else:
+ result = link_up_hw(src_dpid, src_port, dst_dpid, dst_port)
+ return result
+
+# Link up on software testbed
+def link_up_sw(src_dpid, src_port, dst_dpid, dst_port):
+
+ cmd = 'up'
+ result=""
+ for dpid in (src_dpid, dst_dpid):
+ if dpid in core_switches:
+ host = controllers[0]
+ else:
+ hostid=int(dpid.split(':')[-2])
+ host = controllers[hostid-1]
+
+ if dpid == src_dpid:
+ (port, dontcare) = get_link_ports(dpid, dst_dpid)
+ else:
+ (port, dontcare) = get_link_ports(dpid, src_dpid)
+
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
+ cmd_string="ssh %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
+ print cmd_string
+ res=os.popen(cmd_string).read()
+ result = result + ' ' + res
+
+ return result
+
+# if hostid == 2 :
+# src_ports = [51]
+# else :
+# src_ports = [26]
+#
+# for port in src_ports :
+# cmd_string="ssh -i ~/.ssh/onlabkey.pem %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, dpid, port, cmd)
+# print cmd_string
+# res=os.popen(cmd_string).read()
+
+
+
+# Link up on hardware testbed
+def link_up_hw(src_dpid, src_port, dst_dpid, dst_port):
+
+ port1 = src_port
+ port2 = dst_port
+ if src_dpid == "00:00:00:00:ba:5e:ba:11":
+ if dst_dpid == "00:00:00:08:a2:08:f9:01":
+ port1 = 24
+ port2 = 24
+ elif dst_dpid == "00:01:00:16:97:08:9a:46":
+ port1 = 23
+ port2 = 23
+ elif src_dpid == "00:00:00:00:ba:5e:ba:13":
+ if dst_dpid == "00:00:20:4e:7f:51:8a:35":
+ port1 = 22
+ port2 = 22
+ elif dst_dpid == "00:00:00:00:00:00:ba:12":
+ port1 = 23
+ port2 = 23
+ elif src_dpid == "00:00:00:00:00:00:ba:12":
+ if dst_dpid == "00:00:00:00:ba:5e:ba:13":
+ port1 = 23
+ port2 = 23
+ elif dst_dpid == "00:00:00:08:a2:08:f9:01":
+ port1 = 22
+ port2 = 22
+ elif dst_dpid == "00:00:20:4e:7f:51:8a:35":
+ port1 = 24
+ port2 = 21
+ elif src_dpid == "00:01:00:16:97:08:9a:46":
+ if dst_dpid == "00:00:00:00:ba:5e:ba:11":
+ port1 = 23
+ port2 = 23
+ elif dst_dpid == "00:00:20:4e:7f:51:8a:35":
+ port1 = 24
+ port2 = 24
+ elif src_dpid == "00:00:00:08:a2:08:f9:01":
+ if dst_dpid == "00:00:00:00:ba:5e:ba:11":
+ port1 = 24
+ port2 = 24
+ elif dst_dpid == "00:00:00:00:00:00:ba:12":
+ port1 = 22
+ port2 = 22
+ elif dst_dpid == "00:00:20:4e:7f:51:8a:35":
+ port1 = 23
+ port2 = 23
+ elif src_dpid == "00:00:20:4e:7f:51:8a:35":
+ if dst_dpid == "00:00:00:00:00:00:ba:12":
+ port1 = 21
+ port2 = 24
+ elif dst_dpid == "00:00:00:00:ba:5e:ba:13":
+ port1 = 22
+ port2 = 22
+ elif dst_dpid == "00:01:00:16:97:08:9a:46":
+ port1 = 24
+ port2 = 24
+ elif dst_dpid == "00:00:00:08:a2:08:f9:01":
+ port1 = 23
+ port2 = 23
+
+ cmd = 'up'
+ result=""
+ host = controllers[0]
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % (src_dpid, port1, cmd)
+ print cmd_string
+ res=os.popen(cmd_string).read()
+ result = result + ' ' + res
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % (dst_dpid, port2, cmd)
+ print cmd_string
+ res=os.popen(cmd_string).read()
+ result = result + ' ' + res
+
+
+ return result
+
+
+#* Link Down
+#http://localhost:9000/gui/link/down/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>
+@app.route("/gui/link/<cmd>/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>")
+def link_down(cmd, src_dpid, src_port, dst_dpid, dst_port):
+
+ if src_dpid in core_switches:
+ host = controllers[0]
+ else:
+ hostid=int(src_dpid.split(':')[-2])
+ host = controllers[hostid-1]
+
+ if (TESTBED == "sw"):
+ cmd_string="ssh %s 'cd ONOS/scripts; ./link.sh %s %s %s'" % (host, src_dpid, src_port, cmd)
+ else:
+ if ( src_dpid == "00:00:00:08:a2:08:f9:01" ):
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % ( dst_dpid, dst_port, cmd)
+ else:
+ cmd_string="~/ONOS/scripts/link-hw.sh %s %s %s " % ( src_dpid, src_port, cmd)
+ print cmd_string
+
+ result=os.popen(cmd_string).read()
+
+ return result
+
+#* Create Flow
+#http://localhost:9000/gui/addflow/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>/<srcMAC>/<dstMAC>
+#1 FOOBAR 00:00:00:00:00:00:01:01 1 00:00:00:00:00:00:01:0b 1 matchSrcMac 00:00:00:00:00:00 matchDstMac 00:01:00:00:00:00
+@app.route("/gui/addflow/<src_dpid>/<src_port>/<dst_dpid>/<dst_port>/<srcMAC>/<dstMAC>")
+def add_flow(src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC):
+ host = pick_host()
+ url ="%s/wm/flow/getsummary/%s/%s/json" % (host, 0, 0)
+ (code, result) = get_json(url)
+ parsedResult = json.loads(result)
+ if len(parsedResult) > 0:
+ if parsedResult[-1].has_key('flowId'):
+ flow_nr = int(parsedResult[-1]['flowId']['value'], 16)
+ else:
+ flow_nr = -1 # first flow
+ print "first flow"
+
+ flow_nr += 1
+ command = "%s/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (ONOSDIR, flow_nr, "dummy", src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
+ flow_nr += 1
+ command1 = "%s/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (ONOSDIR, flow_nr, "dummy", dst_dpid, dst_port, src_dpid, src_port, dstMAC, srcMAC)
+ print "add flow: %s, %s" % (command, command1)
+ errcode = os.popen(command).read()
+ errcode1 = os.popen(command1).read()
+ ret=command+":"+errcode+" "+command1+":"+errcode1
+ print ret
+ return ret
+
+#* Delete Flow
+#http://localhost:9000/gui/delflow/<flow_id>
+@app.route("/gui/delflow/<flow_id>")
+def del_flow(flow_id):
+ command = "%/web/delete_flow.py %s" % (ONOSDIR, flow_id)
+ print command
+ errcode = os.popen(command).read()
+ return errcode
+
+#* Start Iperf Througput
+#http://localhost:9000/gui/iperf/start/<flow_id>/<duration>
+@app.route("/gui/iperf/start/<flow_id>/<duration>/<samples>")
+def iperf_start(flow_id,duration,samples):
+ try:
+ command = "curl -s \'http://%s:%s/wm/flow/get/%s/json\'" % (RestIP, RestPort, flow_id)
+ print command
+ result = os.popen(command).read()
+ if len(result) == 0:
+ print "No Flow found"
+ return "Flow %s not found" % (flow_id);
+ except:
+ print "REST IF has issue"
+ return "REST IF has issue"
+ exit
+
+ parsedResult = json.loads(result)
+
+ flowId = int(parsedResult['flowId']['value'], 16)
+ src_dpid = parsedResult['dataPath']['srcPort']['dpid']['value']
+ src_port = parsedResult['dataPath']['srcPort']['port']['value']
+ dst_dpid = parsedResult['dataPath']['dstPort']['dpid']['value']
+ dst_port = parsedResult['dataPath']['dstPort']['port']['value']
+# print "FlowPath: (flowId = %s src = %s/%s dst = %s/%s" % (flowId, src_dpid, src_port, dst_dpid, dst_port)
+
+ if src_dpid in core_switches:
+ src_host = controllers[0]
+ else:
+ hostid=int(src_dpid.split(':')[-2])
+ if TESTBED == "hw":
+ src_host = "mininet%i" % hostid
+ else:
+ src_host = controllers[hostid-1]
+
+ if dst_dpid in core_switches:
+ dst_host = controllers[0]
+ else:
+ hostid=int(dst_dpid.split(':')[-2])
+ if TESTBED == "hw":
+ dst_host = "mininet%i" % hostid
+ else:
+ dst_host = controllers[hostid-1]
+
+# /runiperf.sh <flowid> <src_dpid> <dst_dpid> hw:svr|sw:svr|hw:client|sw:client <proto>/<duration>/<interval>/<samples>
+ protocol="udp"
+ interval=0.1
+ if TESTBED == "hw":
+ cmd_string="dsh -w %s 'cd ONOS/scripts; " % dst_host
+ else:
+ cmd_string="ssh %s 'cd ONOS/scripts; " % dst_host
+ cmd_string += "./runiperf.sh %d %s %s %s:%s %s/%s/%s/%s'" % (flowId, src_dpid, dst_dpid, TESTBED, "svr", protocol, duration, interval, samples)
+ print cmd_string
+ os.popen(cmd_string)
+
+ if TESTBED == "hw":
+ cmd_string="dsh -w %s 'cd ONOS/scripts; " % src_host
+ else:
+ cmd_string="ssh %s 'cd ONOS/scripts;" % src_host
+ cmd_string+="./runiperf.sh %d %s %s %s:%s %s/%s/%s/%s'" % (flowId, src_dpid, dst_dpid, TESTBED, "client", protocol, duration, interval, samples)
+ print cmd_string
+ os.popen(cmd_string)
+
+ return cmd_string
+
+
+#* Get Iperf Throughput
+#http://localhost:9000/gui/iperf/rate/<flow_id>
+@app.route("/gui/iperf/rate/<flow_id>")
+def iperf_rate(flow_id):
+ try:
+ command = "curl -s \'http://%s:%s/wm/flow/get/%s/json\'" % (RestIP, RestPort, flow_id)
+ print command
+ result = os.popen(command).read()
+ if len(result) == 0:
+ resp = Response(result, status=400, mimetype='text/html')
+ return "no such iperf flow (flowid %s)" % flow_id;
+ except:
+ print "REST IF has issue"
+ exit
+
+ parsedResult = json.loads(result)
+
+ flowId = int(parsedResult['flowId']['value'], 16)
+ src_dpid = parsedResult['dataPath']['srcPort']['dpid']['value']
+ src_port = parsedResult['dataPath']['srcPort']['port']['value']
+ dst_dpid = parsedResult['dataPath']['dstPort']['dpid']['value']
+ dst_port = parsedResult['dataPath']['dstPort']['port']['value']
+
+ if dst_dpid in core_switches:
+ host = controllers[0]
+ else:
+ hostid=int(dst_dpid.split(':')[-2])
+ if TESTBED == "hw":
+ host = "mininet%i" % hostid
+ else:
+ host = controllers[hostid-1]
+
+ try:
+ command = "curl -s http://%s:%s/log/iperfsvr_%s.out" % (host, 9000, flow_id)
+ print command
+ result = os.popen(command).read()
+ except:
+ exit
+
+ if re.match("Cannot", result):
+ resp = Response(result, status=400, mimetype='text/html')
+ return "no iperf file found (host %s flowid %s): %s" % (host, flow_id, result)
+ else:
+ resp = Response(result, status=200, mimetype='application/json')
+ return resp
if __name__ == "__main__":
+ random.seed()
+ read_config()
+ read_link_def()
if len(sys.argv) > 1 and sys.argv[1] == "-d":
- print "-- query all switches --"
- query_switch()
- print "-- query topo --"
- topology_for_gui()
-# print "-- query all links --"
+# add_flow("00:00:00:00:00:00:02:02", 1, "00:00:00:00:00:00:03:02", 1, "00:00:00:00:02:02", "00:00:00:00:03:0c")
+# link_change("up", "00:00:00:00:ba:5e:ba:11", 1, "00:00:00:00:00:00:00:00", 1)
+# link_change("down", "00:00:20:4e:7f:51:8a:35", 1, "00:00:00:00:00:00:00:00", 1)
+# link_change("up", "00:00:00:00:00:00:02:03", 1, "00:00:00:00:00:00:00:00", 1)
+# link_change("down", "00:00:00:00:00:00:07:12", 1, "00:00:00:00:00:00:00:00", 1)
+# print "-- query all switches --"
+# query_switch()
+# print "-- query topo --"
+# topology_for_gui()
+# link_change(1,2,3,4)
+ print "-- query all links --"
# query_links()
# print "-- query all devices --"
# devices()
+# iperf_start(1,10,15)
+# iperf_rate(1)
+# switches()
+# add_flow(1,2,3,4,5,6)
+ reset_demo()
else:
app.debug = True
app.run(threaded=True, host="0.0.0.0", port=9000)