From d7d9e20060b8deb1f8c8bacf677c192704360ddf Mon Sep 17 00:00:00 2001 From: Ezra Kissel Date: Thu, 10 Dec 2015 00:00:24 -0500 Subject: [PATCH] Add a method to PUT a raw flow in JSON format. Signed-off-by: Ezra Kissel --- odl/table.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/odl/table.py b/odl/table.py index bb2a4cd..9be7de0 100644 --- a/odl/table.py +++ b/odl/table.py @@ -165,13 +165,6 @@ def get_flow_by_clean_id(self, clean_id): if flow.clean_id == clean_id: return flow - # Try to get in operational flows - flows = self.get_operational_flows() - for flow in flows.values(): - print flow.clean_id, clean_id - if flow.clean_id == clean_id: - return flow - def get_config_flows_by_name(self, name): """ Return a list of config flows based on name. @@ -184,6 +177,16 @@ def get_config_flows_by_name(self, name): return result + def put_flow_from_data_json(self, data, flow): + """ + Insert a flow in this table (config endpoint) based on raw json data. + """ + odl_instance = self.node.odl_instance + endpoint = self.config_endpoint + 'flow/' + str(flow) + return odl_instance.put(endpoint, + data=data, + content="application/yang.data+json") + def put_flow_from_data(self, data, flow): """ Insert a flow in this table (config endpoint) based on raw xml data.