add dpctl case ability
diff --git a/acctonUseDpctl/util.py b/acctonUseDpctl/util.py
new file mode 100755
index 0000000..757d889
--- /dev/null
+++ b/acctonUseDpctl/util.py
@@ -0,0 +1,34 @@
+import subprocess
+import json
+import os
+from pprint import pprint
+
+test_tmp_file=os.getcwd()+os.sep+"dpctloutputtmp.tmp"
+
+
+def apply_dpctl_cmd(test, config, cmd):
+ switch_ip = config["switch_ip"]
+ if len(switch_ip) == 0:
+ assert(0)
+
+ #create the tmp file
+ try:
+ subprocess.check_call(["ls", test_tmp_file])
+ except subprocess.CalledProcessError:
+ open(test_tmp_file, "w").close()
+ subprocess.call(["sudo", "chmod", "a+w", test_tmp_file])
+
+ #apply dpctl command
+ subprocess.call("dpctl tcp:"+switch_ip+":6633 "+cmd+" > "+test_tmp_file, shell=True)
+
+ with open(test_tmp_file) as tmp_file:
+ try:
+ json_result=json.loads(tmp_file.read(), encoding='utf-8')
+ except ValueError:
+ subprocess.call("cat "+ test_tmp_file, shell=True)
+ """
+ https://docs.python.org/2/library/unittest.html#
+ """
+ test.assertTrue(False, "NO json format, dpctl may fail")
+
+ return json_result
\ No newline at end of file
diff --git a/acctonUseDpctl/vlan.py b/acctonUseDpctl/vlan.py
new file mode 100755
index 0000000..b7bf28a
--- /dev/null
+++ b/acctonUseDpctl/vlan.py
@@ -0,0 +1,32 @@
+import logging
+import oftest.base_tests as base_tests
+from oftest import config
+from oftest.testutils import *
+from util import *
+
+
+class features(base_tests.SimpleDataPlane):
+ def runTest(self):
+ delete_all_flows(self.controller)
+ delete_all_groups(self.controller)
+
+ test_ports = sorted(config["port_map"].keys())
+
+ json_result = apply_dpctl_cmd(self, config, "features")
+ #pprint(json_result)
+ result=json_result["RECEIVED"][1]
+ self.assertTrue(result["tabs"]==64, "Table size is not correct")
+
+class get_config(base_tests.SimpleDataPlane):
+ def runTest(self):
+ delete_all_flows(self.controller)
+ delete_all_groups(self.controller)
+
+ test_ports = sorted(config["port_map"].keys())
+
+ json_result = apply_dpctl_cmd(self, config, "get-config")
+ #pprint(json_result)
+ result=json_result["RECEIVED"][1]
+ self.assertNotEqual(result["conf"], {}, "Config reply nothing")
+
+
\ No newline at end of file