Merge into master from pull request #134:
.abat-automerge: push artifacts to separate repository (https://github.com/floodlight/loxigen/pull/134)
diff --git a/.abat-automerge b/.abat-automerge
index 36e8739..772134b 100755
--- a/.abat-automerge
+++ b/.abat-automerge
@@ -4,3 +4,7 @@
ln -sf ../../.hooks/pre-commit .git/hooks/pre-commit
make all check-all
+
+if [[ ${ARTIFACT_REPO_URL-} ]]; then
+ ./.build/push-artifacts.sh ${ARTIFACT_REPO_URL}
+fi
diff --git a/.build/push-artifacts.sh b/.build/push-artifacts.sh
new file mode 100755
index 0000000..fd607eb
--- /dev/null
+++ b/.build/push-artifacts.sh
@@ -0,0 +1,60 @@
+#!/bin/bash -eu
+
+# Push the loxigen artifacts to a dedicated git repository,
+# along with a nice commit message and a tag
+
+ARTIFACT_REPO_URL="$1"
+if [[ ! $ARTIFACT_REPO_URL ]]; then
+ echo "Call syntax: $0 <artifact_repo_url>" >&2
+ exit 1
+fi
+
+ARTIFACT_REPO=$(mktemp -d --tmpdir "push-artifacts-repo.XXXXXXX")
+
+git clone ${ARTIFACT_REPO_URL} ${ARTIFACT_REPO}
+find ${ARTIFACT_REPO} -mindepth 1 -maxdepth 1 -type d \! -name '.*' -print0 | xargs -0 rm -r
+make LOXI_OUTPUT_DIR=${ARTIFACT_REPO} clean all
+
+loxi_head=$(git rev-parse HEAD)
+last_loxi_log=$(git log --format=oneline -1)
+git_log_file=$(mktemp --tmpdir "git-log-file.XXXXXXX")
+
+last_loxi_revision=""
+
+if [[ -e "${ARTIFACT_REPO}/loxi-revision" ]]; then
+ last_loxi_revision=$(cat "${ARTIFACT_REPO}/loxi-revision" | cut -d ' ' -f 1)
+ if [[ $(git cat-file -t "$last_loxi_revision" 2>/dev/null) != "commit" ]]; then
+ echo "Last loxi revision ${last_loxi_revision} specified in ${ARTIFACT_REPO_URL}/loxi-revision not found in loxigen repo"
+ last_loxi_revision=""
+ fi
+fi
+
+if [[ $last_loxi_revision ]]; then
+ echo "Last loxi revision committed: $last_loxi_revision"
+ git log $last_loxi_revision..${loxi_head} >>$git_log_file
+ loxi_github_url="https://github.com/floodlight/loxigen/compare/${last_loxi_revision}...${loxi_head}"
+else
+ echo "No Previous loxi revision info found"
+ git log -1 HEAD >>$git_log_file
+ loxi_github_url="https://github.com/floodlight/loxigen/commit/${loxi_head}"
+fi
+
+
+(
+ set -xe
+ cd $ARTIFACT_REPO
+ echo $last_loxi_log >loxi-revision
+ git add -A
+
+ (
+ echo "Artifacts from ${loxi_github_url}"
+ echo
+ echo "Loxigen Head commit floodlight/loxigen@${loxi_head}"
+ cat $git_log_file
+ ) | git commit --file=-
+
+ git tag -a -f "loxi/${loxi_head}" -m "Tag Loxigen Revision ${loxi_head}"
+ git push
+)
+
+rm -rf ${ARTIFACT_REPO}
diff --git a/Makefile b/Makefile
index 7b241c3..fc9c6e4 100644
--- a/Makefile
+++ b/Makefile
@@ -43,9 +43,10 @@
\! \( -name '*.cache' -o -name '.*' \))
INPUT_FILES = $(wildcard openflow_input/*)
TEST_DATA = $(shell find test_data -name '*.data')
-OPENFLOWJ_WORKSPACE = openflowj-loxi
+OPENFLOWJ_OUTPUT_DIR = ${LOXI_OUTPUT_DIR}/openflowj
+OPENFLOWJ_ECLIPSE_WORKSPACE = openflowj-loxi
-all: c python java
+all: c python java wireshark
c: .loxi_ts.c
@@ -69,20 +70,35 @@
@echo "HTML documentation output to ${LOXI_OUTPUT_DIR}/pyloxi-doc"
java: .loxi_ts.java
- mkdir -p ${OPENFLOWJ_WORKSPACE}
- ln -sf ../java_gen/pre-written/pom.xml ${OPENFLOWJ_WORKSPACE}/pom.xml
- ln -sf ../java_gen/pre-written/LICENSE.txt ${OPENFLOWJ_WORKSPACE}/LICENSE.txt
- ln -sf ../java_gen/pre-written/src ${OPENFLOWJ_WORKSPACE}
- rsync --checksum --delete -rv ${LOXI_OUTPUT_DIR}/openflowj/src/ ${OPENFLOWJ_WORKSPACE}/gen-src
+ @rsync -rt java_gen/pre-written/ ${LOXI_OUTPUT_DIR}/openflowj/
+ @if [ -e ${OPENFLOWJ_ECLIPSE_WORKSPACE} ]; then \
+ rsync --checksum --delete -rv ${LOXI_OUTPUT_DIR}/openflowj/gen-src/ ${OPENFLOWJ_ECLIPSE_WORKSPACE}/gen-src; \
+ fi
.loxi_ts.java: ${LOXI_PY_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES} ${TEST_DATA}
./loxigen.py --install-dir=${LOXI_OUTPUT_DIR} --lang=java
touch $@
-java-eclipse: java
- cd ${OPENFLOWJ_WORKSPACE} && mvn eclipse:eclipse
+eclipse-workspace:
+ mkdir -p ${OPENFLOWJ_ECLIPSE_WORKSPACE}
+ ln -sf ../java_gen/pre-written/pom.xml ${OPENFLOWJ_ECLIPSE_WORKSPACE}/pom.xml
+ ln -sf ../java_gen/pre-written/LICENSE.txt ${OPENFLOWJ_ECLIPSE_WORKSPACE}/LICENSE.txt
+ ln -sf ../java_gen/pre-written/src ${OPENFLOWJ_ECLIPSE_WORKSPACE}
+ cd ${OPENFLOWJ_ECLIPSE_WORKSPACE} && mvn eclipse:eclipse
# Unfortunately, mvn eclipse:eclipse resolves the symlink, which doesn't work with eclipse
- cd ${OPENFLOWJ_WORKSPACE} && perl -pi -e 's{<classpathentry kind="src" path="[^"]*/java_gen/pre-written/src/}{<classpathentry kind="src" path="src/}' .classpath
+ cd ${OPENFLOWJ_ECLIPSE_WORKSPACE} && perl -pi -e 's{<classpathentry kind="src" path="[^"]*/java_gen/pre-written/src/}{<classpathentry kind="src" path="src/}' .classpath
+
+check-java: java
+ cd ${OPENFLOWJ_OUTPUT_DIR} && mvn compile test-compile test
+
+package-java: java
+ cd ${OPENFLOWJ_OUTPUT_DIR} && mvn package
+
+deploy-java: java
+ cd ${OPENFLOWJ_OUTPUT_DIR} && mvn deploy
+
+install-java: java
+ cd ${OPENFLOWJ_OUTPUT_DIR} && mvn install
wireshark: .loxi_ts.wireshark
@@ -119,18 +135,6 @@
make -C ${LOXI_OUTPUT_DIR}/locitest
${LOXI_OUTPUT_DIR}/locitest/locitest
-check-java: java
- cd ${OPENFLOWJ_WORKSPACE} && mvn compile test-compile test
-
-package-java: java
- cd ${OPENFLOWJ_WORKSPACE} && mvn package
-
-deploy-java: java
- cd ${OPENFLOWJ_WORKSPACE} && mvn deploy
-
-install-java: java
- cd ${OPENFLOWJ_WORKSPACE} && mvn install
-
pylint:
pylint -E ${LOXI_PY_FILES}
diff --git a/java_gen/codegen.py b/java_gen/codegen.py
index c01ba68..9a10bdf 100644
--- a/java_gen/codegen.py
+++ b/java_gen/codegen.py
@@ -73,7 +73,7 @@
def render_class(self, clazz, template, src_dir=None, **context):
if not src_dir:
- src_dir = "src/main/java/"
+ src_dir = "gen-src/main/java/"
context['class_name'] = clazz.name
context['package'] = clazz.package
@@ -147,7 +147,7 @@
unit_test = unit_tests.get_test_unit(i)
if unit_test.has_test_data:
self.render_class(clazz=unit_test,
- template='unit_test.java', src_dir="src/test/java",
+ template='unit_test.java', src_dir="gen-src/test/java",
version=unit_test.java_class.version,
test=unit_test, msg=unit_test.java_class,
test_data=unit_test.test_data)
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index cfece7d..f90c1f2 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -93,6 +93,12 @@
OFTableConfig = (
MaskedEnumGroup("table_miss_flags", mask="TABLE_MISS_MASK", members=set(("TABLE_MISS_CONTROLLER", "TABLE_MISS_CONTINUE", "TABLE_MISS_DROP"))),
),
+ OFGetConfigReply = (
+ MaskedEnumGroup("flags", mask="OFP_FRAG_MASK", members=set(("FRAG_NORMAL", "FRAG_DROP", "FRAG_REASM"))),
+ ),
+ OFSetConfig = (
+ MaskedEnumGroup("flags", mask="OFP_FRAG_MASK", members=set(("FRAG_NORMAL", "FRAG_DROP", "FRAG_REASM"))),
+ ),
)
# represents a metadata property associated with an EnumClass
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index bfe92a4..a502836 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -68,7 +68,7 @@
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4, EthType.IPv6));
public final static MatchField<IpEcn> IP_ECN =
- new MatchField<IpEcn>("ip_dscp", MatchFields.IP_ECN,
+ new MatchField<IpEcn>("ip_ecn", MatchFields.IP_ECN,
new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4, EthType.IPv6));
public final static MatchField<IpProtocol> IP_PROTO =
diff --git a/java_gen/templates/of_class.java b/java_gen/templates/of_class.java
index 4057b3d..b35df1c 100644
--- a/java_gen/templates/of_class.java
+++ b/java_gen/templates/of_class.java
@@ -430,5 +430,4 @@
return result;
}
-
}
diff --git a/java_gen/test.sh b/java_gen/test.sh
deleted file mode 100755
index 7b71ffd..0000000
--- a/java_gen/test.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-rm -rf target_code/
-cd ..
-./loxigen.py -ljava #&& ( cd target_code/Modules/openflowj/ && ant )
diff --git a/openflow_input/standard-1.0 b/openflow_input/standard-1.0
index ad2e76f..1df03bb 100644
--- a/openflow_input/standard-1.0
+++ b/openflow_input/standard-1.0
@@ -190,7 +190,7 @@
OFPC_ARP_MATCH_IP = 0x80,
};
-enum ofp_config_flags(wire_type=uint32_t, bitmask=True) {
+enum ofp_config_flags(wire_type=uint16_t, bitmask=True) {
OFPC_FRAG_NORMAL = 0x0,
OFPC_FRAG_DROP = 0x1,
OFPC_FRAG_REASM = 0x2,
@@ -371,7 +371,7 @@
uint8_t type == 8;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
@@ -380,7 +380,7 @@
uint8_t type == 9;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
diff --git a/openflow_input/standard-1.1 b/openflow_input/standard-1.1
index 7dedae7..a9aac6b 100644
--- a/openflow_input/standard-1.1
+++ b/openflow_input/standard-1.1
@@ -477,7 +477,7 @@
uint8_t type == 8;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
@@ -486,7 +486,7 @@
uint8_t type == 9;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
diff --git a/openflow_input/standard-1.2 b/openflow_input/standard-1.2
index 8f21594..c1e8a2b 100644
--- a/openflow_input/standard-1.2
+++ b/openflow_input/standard-1.2
@@ -515,7 +515,7 @@
uint8_t type == 8;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
@@ -524,7 +524,7 @@
uint8_t type == 9;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
diff --git a/openflow_input/standard-1.3 b/openflow_input/standard-1.3
index 1518931..87adcc4 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -648,7 +648,7 @@
uint8_t type == 8;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
@@ -657,7 +657,7 @@
uint8_t type == 9;
uint16_t length;
uint32_t xid;
- uint16_t flags;
+ enum ofp_config_flags flags;
uint16_t miss_send_len;
};
diff --git a/test_data/of13/get_config_reply.data b/test_data/of13/get_config_reply.data
index 111ac61..66ea834 100644
--- a/test_data/of13/get_config_reply.data
+++ b/test_data/of13/get_config_reply.data
@@ -9,3 +9,8 @@
xid=0x12345678,
flags=ofp.OFPC_FRAG_REASM,
miss_send_len=0xffff)
+-- java
+builder.setXid(0x12345678)
+ .setFlags(Sets.immutableEnumSet(OFConfigFlags.FRAG_REASM))
+ .setMissSendLen(0xffff)
+ .build()