new file mode 100644
@@ -0,0 +1,8956 @@
+[
+ {
+ "id": "60b7",
+ "name": "Create valid table",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 1,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "a540",
+ "name": "Create valid table without preactions",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 key action gact index 3 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 1,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "4765",
+ "name": "Try to create table without name",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/ keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "3d3c",
+ "name": "Try to create table without keysz",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "b48a",
+ "name": "Try to create table with keysz zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 0 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "cc89",
+ "name": "Try to create table with keysz > P4TC_MAX_KEYSZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 513 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "efba",
+ "name": "Try to create table with tentries > P4TC_MAX_TENTRIES",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 tentries 16777217 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "a24a",
+ "name": "Create table with tentries = P4TC_MAX_TENTRIES",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 tentries 16777216 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 16777216,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "67b7",
+ "name": "Try to create table with tentries zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 tentries 0 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "e8e8",
+ "name": "Try to create table with nummasks > P4TC_MAX_TMASKS",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 tmasks 129 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "6b5b",
+ "name": "Create table wth nummasks = P4TC_MAX_TMASKS",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 nummasks 128 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 128,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "615c",
+ "name": "Try to create table with nummasks zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 nummasks 0 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "ef97",
+ "name": "Create table with specific tt_id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 42,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "7a0f",
+ "name": "Try to create table same name twice",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 key action gact index 1 preactions gact index 4 postactions gact index 2",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 1,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "bd8d",
+ "name": "Try to create table same id twice",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname2 tblid 22 keysz 16 key action gact index 1 preactions gact index 4 postactions gact index 2",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 22",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "eeaf",
+ "name": "Try to create table without supplying pipeline name or id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ tblid 1 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "f35d",
+ "name": "Create table without supplying keys",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname keysz 16 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 1,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "b3c9",
+ "name": "Try to create table with name size > TCLASSNAMSIZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/7eozFYyaqVCD7H0xS3M5sMnluUqPgZewfSLnYPf4s3k0lbx8lKoR32zSqiGsh84qJ32vnLPdl7f2XcUh5yIdEP7uJy2C3iPtyU7159s9CMB0EtTAlWTVz4U1jkQ5h2advwp3KCVsZ1jlGgStoJL2op5ZxoThTSUQLR61a5RNDovoSFcq86Brh6oW9DSmTbN6SYygbG3JLnEHzRC5hh0jGmJKHq5ivBK9Y9FlNZQXC9wVwX4qTFAd8ITUTj2Au2Jg1 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "f3a5",
+ "name": "Try to create table with invalid action",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname2 keysz 16 key action connmark zone 103 reclassify index 1 action connmark goto chain 42 index 90 cookie c1a0c1a0 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "b3ec",
+ "name": "Try to create table with invalid action index",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname2 keysz 16 key action connmark zone 103 reclassify index 1 action connmark goto chain 42 index 90 cookie c1a0c1a0 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "40b0",
+ "name": "Create table with tblid of 4 bytes",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 2147483647 keysz 16 key action gact index 1 preactions gact index 4 postactions gact index 2",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 2147483647",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tblid": 2147483647,
+ "tname": "cb/tname"
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "eea7",
+ "name": "Update table's key size specifying table name",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname keysz 32",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 32,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "5d07",
+ "name": "Update table's key size specifying table id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ pipeid 22 tblid 22 keysz 32",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 32,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "46f5",
+ "name": "Try to update table's key size with zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 keysz 0",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "8306",
+ "name": "Try to update table's key size with > P4TC_MAX_KEYSZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 keysz 513",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "0d12",
+ "name": "Update table's with key size = P4TC_MAX_KEYSZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 keysz 512",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 512,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "67c0",
+ "name": "Try to update table tentries with zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 tentries 0",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "dfd1",
+ "name": "Try to update table wth tentries > P4TC_MAX_TENTRIES",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 tentries 16777217",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "36e3",
+ "name": "Update table with tentries = P4TC_MAX_TENTRIES",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 tentries 16777216",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 16777216,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "5c80",
+ "name": "Try to update table masks with zero",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 nummasks 0",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "011b",
+ "name": "Try to update table with nummasks > P4TC_MAX_TMASKS",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 nummasks 129",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "102b",
+ "name": "Update table with nummasks = P4TC_MAX_TMASKS",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 nummasks 128",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 128,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "ac3d",
+ "name": "Update table's postaction",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 postactions gact index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 22",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 5,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "64e5",
+ "name": "Update table's postaction and check old actions ref count and bind",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 postactions gact index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j actions get action gact index 4",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "total acts": 0
+ },
+ {
+ "actions": [
+ {
+ "kind": "gact",
+ "index": 4,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "80c9",
+ "name": "Update table's keys and check old keys's action reference",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 6",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 key action gact index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j actions get action gact index 3",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "total acts": 0
+ },
+ {
+ "actions": [
+ {
+ "kind": "gact",
+ "index": 3,
+ "ref": 1,
+ "bind": 0
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "a7f3",
+ "name": "Delete table by name",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/cb/tname",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "9524",
+ "name": "Delete table by id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 22",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 22",
+ "matchCount": "1",
+ "matchPattern": "Error: Unable to find table by id.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "c41b",
+ "name": "Try to delete inexistent table by name",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/cb/tname2",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "faca",
+ "name": "Try to delete inexistent table by id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 44",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 22",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "6da7",
+ "name": "Try to delete table without supplying pipeline name or id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ tblid 22",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/ tblid 22",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "a844",
+ "name": "Flush table",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "7f88",
+ "name": "Try to flush table without supplying pipeline name or id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 5,
+ "bind": 4
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 5,
+ "bind": 4
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "778c",
+ "name": "Create table with key size > P4TC_MAX_KEYSZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 513 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "64ed",
+ "name": "Create table with key size = P4TC_MAX_KEYSZ",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 512 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 512,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "508b",
+ "name": "Create table and update pipeline state",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update pipeline/ptables state ready",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get pipeline/ptables",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "pipeline"
+ },
+ {
+ "templates": [
+ {
+ "pmaxrules": 1,
+ "pnumtables": 2,
+ "pstate": "ready",
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "index": 1,
+ "ref": 2,
+ "bind": 1,
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ }
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "drop"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 2,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "ac1a",
+ "name": "Create table, update pipeline state and try to update pipeline after pipeline is sealed",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update pipeline/ptables maxrules 2",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get pipeline/ptables",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "pipeline"
+ },
+ {
+ "templates": [
+ {
+ "pmaxrules": 1,
+ "pnumtables": 2,
+ "pstate": "ready",
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "index": 1,
+ "ref": 2,
+ "bind": 1,
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ }
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "drop"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 2,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "0fb8",
+ "name": "Create table, update pipeline state and try to update table after pipelien is sealed",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname2 keysz 32",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname2",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 42,
+ "tname": "cb/tname2",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 5,
+ "bind": 4
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 5,
+ "bind": 4
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "32a6",
+ "name": "Create table with keys with more than one action",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 42 keysz 16 key action gact index 3 action gact index 4 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 42,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ },
+ {
+ "order": 2,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "ade0",
+ "name": "Update table key with more than one action",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 42 keysz 16 key action gact index 3 action gact index 4 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname key action gact index 4 action gact index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 42,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ },
+ {
+ "order": 2,
+ "kind": "gact",
+ "control_action": {
+ "type": "drop"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 5,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "95f5",
+ "name": "Update table's key",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname key action gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 42,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "aa0d",
+ "name": "Update table key with more than one action and check actions after",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 5",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 42 keysz 16 key action gact index 3 action gact index 4 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname key action gact index 4 action gact index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j actions ls action gact",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "total acts": 5
+ },
+ {
+ "actions": [
+ {
+ "kind": "gact",
+ "index": 1,
+ "ref": 2,
+ "bind": 1
+ },
+ {
+ "kind": "gact",
+ "index": 2,
+ "ref": 2,
+ "bind": 1
+ },
+ {
+ "kind": "gact",
+ "index": 3,
+ "ref": 1,
+ "bind": 0
+ },
+ {
+ "kind": "gact",
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ },
+ {
+ "kind": "gact",
+ "index": 5,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "e5e1",
+ "name": "Dump table using pipeline name to find pipeline",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 3 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname3 tblid 50 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tname": "cb/tname"
+ },
+ {
+ "tname": "cb/tname2"
+ },
+ {
+ "tname": "cb/tname3"
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "7f04",
+ "name": "Dump table using pipeline id to find pipeline",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 3 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname3 tblid 50 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ pipeid 22",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tname": "cb/tname"
+ },
+ {
+ "tname": "cb/tname2"
+ },
+ {
+ "tname": "cb/tname3"
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "96c5",
+ "name": "Try to create more table then numtables",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname3 tblid 50 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tname": "cb/tname"
+ },
+ {
+ "tname": "cb/tname2"
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "e3fa",
+ "name": "Try to dump table without specifying pipeline name or id",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 tblid 42 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname3 tblid 50 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/",
+ "matchCount": "1",
+ "matchPattern": "Error: Must specify pipeline name or id.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "6bcf",
+ "name": "Dump pipeline with amount of table > P4TC_MSGBATCH_SIZE",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action gact pass index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 17 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname2 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname3 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname4 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname5 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname6 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname7 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname8 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname9 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname10 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname11 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname12 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname13 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname14 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname15 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname16 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname17 tblid 2147483647 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tname": "cb/tname"
+ },
+ {
+ "tname": "cb/tname2"
+ },
+ {
+ "tname": "cb/tname3"
+ },
+ {
+ "tname": "cb/tname4"
+ },
+ {
+ "tname": "cb/tname5"
+ },
+ {
+ "tname": "cb/tname6"
+ },
+ {
+ "tname": "cb/tname7"
+ },
+ {
+ "tname": "cb/tname8"
+ },
+ {
+ "tname": "cb/tname9"
+ },
+ {
+ "tname": "cb/tname10"
+ },
+ {
+ "tname": "cb/tname11"
+ },
+ {
+ "tname": "cb/tname12"
+ },
+ {
+ "tname": "cb/tname13"
+ },
+ {
+ "tname": "cb/tname14"
+ },
+ {
+ "tname": "cb/tname15"
+ },
+ {
+ "tname": "cb/tname16"
+ }
+ ]
+ },
+ {
+ "pname": "ptables",
+ "pipeid": 22,
+ "obj": "table"
+ },
+ {
+ "templates": [
+ {
+ "tname": "cb/tname17"
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "2eb0",
+ "name": "Try to create valid table without control block name",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 2 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/tname keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "6d73",
+ "name": "Update table default_hit after pipeline is sealed",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify flags defaultonly",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_hit_action action ptables/MyIngress/reclassify",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "default_hit": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "ptables/MyIngress/reclassify",
+ "index": 1,
+ "ref": 1,
+ "bind": 1,
+ "params": [],
+ "operations": [
+ {
+ "instruction": "act",
+ "control_action": {
+ "type": "pipe"
+ },
+ "operands": {
+ "OPA": {
+ "type": "action",
+ "pname": "kernel",
+ "id": "gact"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "permissions": "CRUDXCRUDX"
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "b0e8",
+ "name": "Update table default_miss after pipeline is sealed",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify flags defaultonly",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_miss_action permissions 0x37F action ptables/MyIngress/reclassify",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "default_miss": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "ptables/MyIngress/reclassify",
+ "index": 1,
+ "ref": 1,
+ "bind": 1,
+ "params": [],
+ "operations": [
+ {
+ "instruction": "act",
+ "control_action": {
+ "type": "pipe"
+ },
+ "operands": {
+ "OPA": {
+ "type": "action",
+ "pname": "kernel",
+ "id": "gact"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "permissions": "CR-DXCRUDX"
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "d13e",
+ "name": "Try to update table default_hit with permissions with more than 10 bits",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_hit_action permissions 0x337F",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "1991",
+ "name": "Try to update table default_miss with permissions with more than 10 bits",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_miss_action permissions 0x337F",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "cf57",
+ "name": "Try to update table default_miss after control update permissions are off",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_miss_action permissions 0x37F action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_miss_action action drop",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "default_miss": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "ptables/MyIngress/reclassify",
+ "index": 1,
+ "ref": 1,
+ "bind": 1,
+ "params": [],
+ "operations": [
+ {
+ "instruction": "act",
+ "control_action": {
+ "type": "pipe"
+ },
+ "operands": {
+ "OPA": {
+ "type": "action",
+ "pname": "kernel",
+ "id": "gact"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "permissions": "CR-DXCRUDX"
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "fa6c",
+ "name": "Try to update table default_hit after control update permissions are off",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_hit_action permissions 0x37F action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/ tblid 22 default_hit_action action drop",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "default_hit": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "ptables/MyIngress/reclassify",
+ "index": 1,
+ "ref": 1,
+ "bind": 1,
+ "params": [],
+ "operations": [
+ {
+ "instruction": "act",
+ "control_action": {
+ "type": "pipe"
+ },
+ "operands": {
+ "OPA": {
+ "type": "action",
+ "pname": "kernel",
+ "id": "gact"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "permissions": "CR-DXCRUDX"
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "7a70",
+ "name": "Delete only table default_hit",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_hit_action action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 22 default_hit_action",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "6afa",
+ "name": "Try to delete only table default_hit when delete permissions is off",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_hit_action permissions 0x3BF action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 22 default_hit_action",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "19cc",
+ "name": "Delete _only table default_miss",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_miss_action action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 22 default_miss_action",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "f3b2",
+ "name": "Try to delete only table default_miss when delete permissions is off",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create action/ptables/MyIngress/reclassify actid 7 cmd act kernel.gact.4",
+ 0
+ ],
+ [
+ "$TC p4template update action/ptables/MyIngress/reclassify state active",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4 table_acts act name ptables/MyIngress/reclassify",
+ 0
+ ],
+ [
+ "$TC p4template update pipeline/ptables state ready",
+ 0
+ ],
+ [
+ "$TC p4template update table/ptables/ tblid 22 default_miss_action permissions 0x3BF action ptables/MyIngress/reclassify",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template del table/ptables/ tblid 22 default_miss_action",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 4,
+ "bind": 3
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "07b9",
+ "name": "Create table specifying permissions",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 permissions 0x1FF key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "permissions": "-RUDXCRUDX",
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "07fd",
+ "name": "Create table specifying permissions with more than 10 bits",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 permissions 0x4FF key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "b635",
+ "name": "Update table permissions",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 permissions 0x1FF key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname permissions 0x3F key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "permissions": "----XCRUDX",
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "a226",
+ "name": "Try to update table permissions with 0x400",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ],
+ [
+ "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template update table/ptables/cb/tname permissions 0x400 key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchJSON": [
+ {
+ "obj": "table",
+ "pname": "ptables",
+ "pipeid": 22
+ },
+ {
+ "templates": [
+ {
+ "tblid": 22,
+ "tname": "cb/tname",
+ "keysz": 16,
+ "max_entries": 256,
+ "masks": 8,
+ "permissions": "CRUD--R--X",
+ "key": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "pass"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 3,
+ "ref": 2,
+ "bind": 1
+ }
+ ]
+ },
+ "preactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ },
+ "postactions": {
+ "actions": [
+ {
+ "order": 1,
+ "kind": "gact",
+ "control_action": {
+ "type": "reclassify"
+ },
+ "prob": {
+ "random_type": "none",
+ "control_action": {
+ "type": "pass"
+ },
+ "val": 0
+ },
+ "index": 4,
+ "ref": 3,
+ "bind": 2
+ }
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ },
+ {
+ "id": "9539",
+ "name": "Try to create table without specifying data execute permission",
+ "category": [
+ "p4tc",
+ "template",
+ "table"
+ ],
+ "setup": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions flush action gact",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action pass index 1",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action drop index 2",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action ok index 3",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC actions add action reclassify index 4",
+ 0,
+ 1,
+ 255
+ ],
+ [
+ "$TC p4template create pipeline/ptables pipeid 22 maxrules 1 numtables 1 preactions action gact index 1 postactions action gact index 2",
+ 0
+ ]
+ ],
+ "cmdUnderTest": "$TC p4template create table/ptables/cb/tname tblid 22 keysz 16 permissions 0x3FE key action gact index 3 preactions gact index 4 postactions gact index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC -j p4template get table/ptables/cb/tname",
+ "matchCount": "1",
+ "matchPattern": "Error: Table name not found.*",
+ "teardown": [
+ [
+ "$TC p4template del pipeline/ptables",
+ 0
+ ],
+ [
+ "$TC actions flush action gact",
+ 0
+ ]
+ ]
+ }
+]