Merge "Intents: Converted Switch/Port objects to longs for Plan calc" into dev/ramcloud-new-datamodel
diff --git a/build-ramcloud-java-bindings.sh b/build-ramcloud-java-bindings.sh
index 7f4dc6a..687ad99 100755
--- a/build-ramcloud-java-bindings.sh
+++ b/build-ramcloud-java-bindings.sh
@@ -4,13 +4,13 @@
set -x
-ONOS_HOME=~/ONOS
-RAMCLOUD_HOME=~/ramcloud
+ONOS_HOME=${ONOS_HOME:-~/ONOS}
+RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
# create ramcloud lib
-cp -p ${ONOS_HOME}/src/main/java/edu/stanford/ramcloud/JRamCloud.java ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
-cp -p ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
-cd ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
+cp -pvf ${ONOS_HOME}/src/main/java/edu/stanford/ramcloud/JRamCloud.java ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
+cp -pvf ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
+cd ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
javac JRamCloud.java
./build_so.sh
jar cvf ${RAMCLOUD_HOME}/bindings/java/RamCloud.jar ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/*.class
diff --git a/setup-ramcloud.sh b/setup-ramcloud.sh
index 1db2d1c..7ed99e1 100755
--- a/setup-ramcloud.sh
+++ b/setup-ramcloud.sh
@@ -2,8 +2,8 @@
set -x
-ONOS_HOME=~/ONOS
-RAMCLOUD_HOME=~/ramcloud
+ONOS_HOME=${ONOS_HOME:-~/ONOS}
+RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
if [ -d ${RAMCLOUD_HOME} ]; then
echo "${RAMCLOUD_HOME} already exist, please rename or remove them."
@@ -26,10 +26,10 @@
ln -s ${RAMCLOUD_HOME}/obj.custom obj.blueprint-java
-# crate ramcloud lib
-cp -p ${ONOS_HOME}/src/main/java/edu/stanford/ramcloud/JRamCloud.java ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
-cp -p ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
-cd ${HOME}/ramcloud/bindings/java/edu/stanford/ramcloud/
+# create ramcloud lib
+cp -pvf ${ONOS_HOME}/src/main/java/edu/stanford/ramcloud/JRamCloud.java ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
+cp -pvf ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
+cd ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/
javac JRamCloud.java
./build_so.sh
jar cvf ${RAMCLOUD_HOME}/bindings/java/RamCloud.jar ${RAMCLOUD_HOME}/bindings/java/edu/stanford/ramcloud/*.class
diff --git a/web/rest-intent/add-get-intent.rb b/web/rest-intent/add-get-intent.rb
index ea3a506..59dea82 100644
--- a/web/rest-intent/add-get-intent.rb
+++ b/web/rest-intent/add-get-intent.rb
@@ -146,7 +146,7 @@
def parse_options options
max_switches = options[:max_switches].to_i || 4
@switches = (1..max_switches).to_a
- @ports = (1..(max_switches - 1)).to_a
+ @ports = (1..max_switches).to_a
@intent_id = options[:intent_id]
@intent_id ||= 1
@intent_type = options[:intent_type]
@@ -166,19 +166,15 @@
def _create_intent src_switch, iterable_switches, json_intents
network_id = 1
iterable_switches.each_index do |sw_i|
- dst_switch = iterable_switches[sw_i]
- sw_set = @switches - [dst_switch]
- dst_port = sw_set.index(src_switch)
- dst_port = dst_port + 1
intent = {
:intent_id => "#{@intent_id}",
:intent_type => @intent_type,
:intent_op => @intent_op,
:srcSwitch => src_switch.to_s,
- :srcPort => @ports[sw_i],
+ :srcPort => @ports[-1],
:srcMac => "00:00:c0:a8:#{mac_format(src_switch)}",
:dstSwitch => iterable_switches[sw_i].to_s,
- :dstPort => dst_port,
+ :dstPort => @ports[-1],
:dstMac => "00:00:c0:a8:#{mac_format(iterable_switches[sw_i].to_i)}"
}
puts intent.inspect