genesisjoec
genesisjoec

Reputation: 1

Error when trying to push flows via API in OpenDaylight

I am trying to use a JSON file to push a flow via API from the Linux command line.

Command: curl -u admin:admin -H 'Accept: application/json' -H 'Content-Type: application/json' -X PUT -d @l2-flows.json http://192.168.56.103:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/

The console keeps returning this error and I can't determine the solution: {"errors":{"error":[{"error-type":"protocol","error-tag":"malformed-message","error-message":"Input is required."}]}}

What does this error indicate? How might I resolve it?

I am running ODL Carbon running system version 3.0.8 and karaf 0.6.4

JSON file here:

{
    "flow-node-inventory:table": [
        {
            "flow": [
                {
                    "cookie": 3026418949592973313,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "#UF$TABLE*0-4",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "1"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:01"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:03"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 310000000,
                            "second": 7
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3026418949592973312,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "#UF$TABLE*0-3",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "3"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:03"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:01"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 310000000,
                            "second": 7
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3026418949592973315,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "L2switch-3",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "2"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:02"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:03"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 310000000,
                            "second": 7
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3098476543630901250,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 0,
                    "id": "L2switch-2",
                    "idle-timeout": 0,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 2,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "CONTROLLER"
                                            }
                                        },
                                        {
                                            "order": 1,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "2"
                                            }
                                        },
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "3"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "in-port": "1"
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 105000000,
                            "second": 10
                        },
                        "packet-count": 0
                    },
                    "priority": 2,
                    "table_id": 0
                },
                {
                    "cookie": 3026418949592973314,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "#UF$TABLE*0-5",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "3"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:03"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:02"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 310000000,
                            "second": 7
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3098476543630901249,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 0,
                    "id": "L2switch-1",
                    "idle-timeout": 0,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 2,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "CONTROLLER"
                                            }
                                        },
                                        {
                                            "order": 1,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "1"
                                            }
                                        },
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "3"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "in-port": "2"
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 104000000,
                            "second": 10
                        },
                        "packet-count": 0
                    },
                    "priority": 2,
                    "table_id": 0
                },
                {
                    "cookie": 3098476543630901248,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 0,
                    "id": "L2switch-0",
                    "idle-timeout": 0,
                    "match": {},
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 741000000,
                            "second": 11
                        },
                        "packet-count": 0
                    },
                    "priority": 0,
                    "table_id": 0
                },
                {
                    "cookie": 3026418949592973319,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "L2switch-7",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "2"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:02"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:01"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 906000000,
                            "second": 3
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3026418949592973318,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 300,
                    "id": "L2switch-6",
                    "idle-timeout": 600,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "1"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-destination": {
                                "address": "00:00:00:00:00:01"
                            },
                            "ethernet-source": {
                                "address": "00:00:00:00:00:02"
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 907000000,
                            "second": 3
                        },
                        "packet-count": 0
                    },
                    "priority": 10,
                    "table_id": 0
                },
                {
                    "cookie": 3098476543630901248,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 0,
                    "id": "#UF$TABLE*0-2",
                    "idle-timeout": 0,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 2,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "CONTROLLER"
                                            }
                                        },
                                        {
                                            "order": 1,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "1"
                                            }
                                        },
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "2"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "in-port": "3"
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 104000000,
                            "second": 10
                        },
                        "packet-count": 0
                    },
                    "priority": 2,
                    "table_id": 0
                },
                {
                    "cookie": 3098476543630901248,
                    "cookie_mask": 0,
                    "flags": "",
                    "hard-timeout": 0,
                    "id": "#UF$TABLE*0-1",
                    "idle-timeout": 0,
                    "instructions": {
                        "instruction": [
                            {
                                "apply-actions": {
                                    "action": [
                                        {
                                            "order": 0,
                                            "output-action": {
                                                "max-length": 65535,
                                                "output-node-connector": "CONTROLLER"
                                            }
                                        }
                                    ]
                                },
                                "order": 0
                            }
                        ]
                    },
                    "match": {
                        "ethernet-match": {
                            "ethernet-type": {
                                "type": 35020
                            }
                        }
                    },
                    "opendaylight-flow-statistics:flow-statistics": {
                        "byte-count": 0,
                        "duration": {
                            "nanosecond": 740000000,
                            "second": 11
                        },
                        "packet-count": 0
                    },
                    "priority": 100,
                    "table_id": 0
                }
            ],
            "id": 0,
            "opendaylight-flow-table-statistics:flow-table-statistics": {
                "active-flows": 0,
                "packets-looked-up": 0,
                "packets-matched": 0
            }
        }
    ]
}

Upvotes: 0

Views: 81

Answers (1)

genesisjoec
genesisjoec

Reputation: 1

I resolved my issue. I am running Ubuntu 18.04 , which didn't have the necessary dependencies by default. The packages below fixed the issue.

sudo apt install -y ruby-dev
sudo gem install json

Upvotes: 0

Related Questions